Comm Task

Communication handling task.

This task handles serial port communication with Controller.

An intent to send something is delivered as ChibiOS Message. This message is then serialized to CBOR format according to dcrcp (DeadCom Reader<->Controller Protocol) schema. The resulting byte buffer is then packed to dcl2 (DeadCom Layer 2) frame and transmitted over RS232 link.

This task handles sending and receiving dcrcp messages, and dcl2 link management.


enum dl_task_comm_linkstate




void dlTaskCommInit(uint8_t ctrl_task_id, uint8_t rcv_task_id, dl_task_comm_callbacks *callbacks)

Task initializer.

This function initalizes internal data structure of the task and sets up callbacks to the Master Task

  • task_id: Our identificator the Master Task has chosen
  • callbacks: Structure of function pointers to callbacks this task should use

void dlTaskCommStart(void)

Task starter.

This function starts the task thread.

void dlTaskCommStop(void)

Task stopper.

This function stops the task thread.

void dlTaskCommSendSysQueryResp(uint16_t rdrClass, uint16_t hwModel, uint16_t hwRev, char serial[DCRCP_SERIAL_MAX_LEN], uint8_t swVerMajor, uint8_t swVerMinor)

Send System Query Response CRPM.

void dlTaskCommSendRdrFailure(char *str)

Send Reader Failure CRPM.

void dlTaskCommSendAM0GotUids(dl_picc_uid *uids, size_t uids_len)

Send Auth method: PICC UID obtained CRPM.

struct dl_task_comm_callbacks
#include <comm-task.h>

A structure of Master Task callbacks.

These callbacks must be thread safe

Public Members

void (*heartbeat)(uint8_t task_id)

A heartbeat callback.

A Heartbeat callback of the Master Task. See firmware documentation, section “Reader Firmware Architecture”, subsection “Watchdog”

  • task_id: ID of this task, assigned to us by the Master Task

void (*linkChange)(dl_task_comm_linkstate new_link_state)

A link status has changes.

Either the link was established dropped

void (*rcvdSystemQueryRequest)(void)

A System Query Request CRPM has been received.

void (*rcvdActivateAuthMethods)(DeadcomCRPMAuthMethod *methods, size_t methods_len)

An Activate Auth Methods CRPM was received.

void (*rcvdUiUpdate)(DeadcomCRPMUIClass0States uistate)

UI Update CRPM was received.