CGM Simulator  0.1.3
A CGM simulator to demonstrate the BLE CGM profile v1.1
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages

This group of constants, macros, variables and functions implement the CRC support. More...

Collaboration diagram for CCITT-CRC Feature:

Functions

static int8 cgmCtlPntMsgFindCRC (cgmCtlPntMsg_t *pMsg)
 This function checks the presence of the CRC field in the CGMCP command. More...
 
static int8 cgmRACPMsgFindCRC (cgmRACPMsg_t *pMsg)
 This function checks the presence of the CRC field in the RACP command. More...
 
unsigned short ccitt_crc16 (unsigned char *message, short length)
 CRC-CCITT calculation using the tabular form. More...
 
char ccitt_crc16_test (unsigned char *message, short length)
 Test the input message against its attached CRC16 code. More...
 

Detailed Description

This group of constants, macros, variables and functions implement the CRC support.

Function Documentation

unsigned short ccitt_crc16 ( unsigned char *  message,
short  length 
)

CRC-CCITT calculation using the tabular form.

Parameters
[in]message- the pointer to the message array.
[in]length- the length of the message.
Returns
the 16-bit CRC value.

Here is the caller graph for this function:

char ccitt_crc16_test ( unsigned char *  message,
short  length 
)

Test the input message against its attached CRC16 code.

Note
Here we assume that the CRC is attached as the last two bytes of the message.
Parameters
[in]message- pointer to the message character array
[in]length- the length of the message array
Returns
the result of the test.
ValueMeaning
0The CRC test is failed
1The CRC test is passed

Here is the call graph for this function:

Here is the caller graph for this function:

static int8 cgmCtlPntMsgFindCRC ( cgmCtlPntMsg_t pMsg)
static

This function checks the presence of the CRC field in the CGMCP command.

The function checks the presence of CRC by checking the command length corresponding to each of the possible CGMCP operation.

Parameters
[in]pMsg- the pointer to the CGMCP command message
Returns
The result
ValueMeaning
0The CRC is missing
1The CRC is present

Here is the caller graph for this function:

static int8 cgmRACPMsgFindCRC ( cgmRACPMsg_t pMsg)
static

This function checks the presence of the CRC field in the RACP command.

The function checks the presence of CRC by checking the command length corresponding to each of the possible RACP operation.

Parameters
[in]pMsg- the pointer to the RACP command message
Returns
The result
ValueMeaning
0The CRC is missing
1The CRC is present