ROBOTalk API file. More...
Go to the source code of this file.
Classes | |
union | RTK_PACKET |
A type definition for the ROBOTalk packet. More... | |
Defines | |
#define | _DN_EXP_ROBOTALK |
#define | NativeCommand(cmd) ((cmd) & ~RTK_RETRY_MASK) |
A macro that removes the retry flag and count from the ROBOTalk command. | |
#define | RTK_CHECK_RECV (RTK_CHECK_TYPE | CHECK_FUNC_SEND | CHECK_FUNC_RECV) |
A definition for the check_conn_param function. | |
#define | RTK_CHECK_SEND (RTK_CHECK_TYPE | CHECK_FUNC_SEND) |
A definition for the check_conn_param function. | |
#define | RTK_CHECK_TYPE (CHECK_TYPE_UDP | CHECK_TYPE_COM) |
A definition for the check_conn_param function. | |
#define | RTK_CMD_ACK (0x0E02) |
A definition for the ROBOTalk command which means acknowledge. | |
#define | RTK_CMD_NAK (0x0E82) |
A definition for the ROBOTalk command which means negative acknowledge. | |
#define | RTK_CMD_REJ (0x0E01) |
A definition for the ROBOTalk command which means reject. | |
#define | RTK_ENQ (0x05) |
A definition for the ROBOTalk enquiry. | |
#define | RTK_RETRY_COUNT (0x2000) |
A definition for the ROBOTalk command. The upper 3bits mean the retry count. | |
#define | RTK_RETRY_FLAG (0x1000) |
A definition for the ROBOTalk command. This bit means the retry packet. | |
#define | RTK_RETRY_MASK (0xF000) |
A definition for the ROBOTalk command. The upper 4bits mean the retry packet. | |
#define | RTK_SIZE_COMMAND (2) |
The command buffer size of a ROBOTalk packet. | |
#define | RTK_SIZE_CRC (2) |
The CRC buffer size of a ROBOTalk packet. | |
#define | RTK_SIZE_DATA (RTK_SIZE_PACKET - RTK_SIZE_HEADER) |
The data buffer size of a ROBOTalk packet. | |
#define | RTK_SIZE_HEADER (6) |
The header buffer size of a ROBOTalk packet. | |
#define | RTK_SIZE_PACKET (256) |
The maximum buffer size of a ROBOTalk packet. | |
Functions | |
_DN_EXP_ROBOTALK uint16_t | rtk_calc_crc (const union RTK_PACKET *packet) |
Calculates CRC of the ROBOTalk packet. | |
_DN_EXP_ROBOTALK HRESULT | rtk_param2packet (uint16_t command, const uint8_t *data, uint8_t len_data, uint8_t from_id, uint8_t to_id, union RTK_PACKET *packet) |
Creates a ROBOTalk packet. | |
_DN_EXP_ROBOTALK HRESULT | rtk_recv (const struct CONN_PARAM_COMMON *device, union RTK_PACKET *packet_recv, int client, unsigned int retry_nak) |
Receives ROBOTalk packet. | |
_DN_EXP_ROBOTALK HRESULT | rtk_send (const struct CONN_PARAM_COMMON *device, union RTK_PACKET *packet_send) |
Sends ROBOTalk packet. |
ROBOTalk API file.
Defines ROBOTalk APIs.
Software License Agreement (MIT License)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file dn_robotalk.h.
#define _DN_EXP_ROBOTALK |
Definition at line 37 of file dn_robotalk.h.
#define NativeCommand | ( | cmd | ) | ((cmd) & ~RTK_RETRY_MASK) |
A macro that removes the retry flag and count from the ROBOTalk command.
[in] | cmd | The ROBOTalk command. |
Definition at line 136 of file dn_robotalk.h.
#define RTK_CHECK_RECV (RTK_CHECK_TYPE | CHECK_FUNC_SEND | CHECK_FUNC_RECV) |
A definition for the check_conn_param function.
Definition at line 57 of file dn_robotalk.h.
#define RTK_CHECK_SEND (RTK_CHECK_TYPE | CHECK_FUNC_SEND) |
A definition for the check_conn_param function.
Definition at line 51 of file dn_robotalk.h.
#define RTK_CHECK_TYPE (CHECK_TYPE_UDP | CHECK_TYPE_COM) |
A definition for the check_conn_param function.
Definition at line 45 of file dn_robotalk.h.
#define RTK_CMD_ACK (0x0E02) |
A definition for the ROBOTalk command which means acknowledge.
Definition at line 75 of file dn_robotalk.h.
#define RTK_CMD_NAK (0x0E82) |
A definition for the ROBOTalk command which means negative acknowledge.
Definition at line 81 of file dn_robotalk.h.
#define RTK_CMD_REJ (0x0E01) |
A definition for the ROBOTalk command which means reject.
Definition at line 69 of file dn_robotalk.h.
#define RTK_ENQ (0x05) |
A definition for the ROBOTalk enquiry.
Definition at line 63 of file dn_robotalk.h.
#define RTK_RETRY_COUNT (0x2000) |
A definition for the ROBOTalk command. The upper 3bits mean the retry count.
Definition at line 123 of file dn_robotalk.h.
#define RTK_RETRY_FLAG (0x1000) |
A definition for the ROBOTalk command. This bit means the retry packet.
Definition at line 117 of file dn_robotalk.h.
#define RTK_RETRY_MASK (0xF000) |
A definition for the ROBOTalk command. The upper 4bits mean the retry packet.
Definition at line 129 of file dn_robotalk.h.
#define RTK_SIZE_COMMAND (2) |
The command buffer size of a ROBOTalk packet.
Definition at line 105 of file dn_robotalk.h.
#define RTK_SIZE_CRC (2) |
The CRC buffer size of a ROBOTalk packet.
Definition at line 111 of file dn_robotalk.h.
#define RTK_SIZE_DATA (RTK_SIZE_PACKET - RTK_SIZE_HEADER) |
The data buffer size of a ROBOTalk packet.
Definition at line 99 of file dn_robotalk.h.
#define RTK_SIZE_HEADER (6) |
The header buffer size of a ROBOTalk packet.
Definition at line 93 of file dn_robotalk.h.
#define RTK_SIZE_PACKET (256) |
The maximum buffer size of a ROBOTalk packet.
Definition at line 87 of file dn_robotalk.h.
uint16_t rtk_calc_crc | ( | const union RTK_PACKET * | packet | ) |
Calculates CRC of the ROBOTalk packet.
[in] | packet | The ROBOTalk packet to be calculated. |
Definition at line 118 of file dn_robotalk.c.
HRESULT rtk_param2packet | ( | uint16_t | command, |
const uint8_t * | data, | ||
uint8_t | len_data, | ||
uint8_t | from_id, | ||
uint8_t | to_id, | ||
union RTK_PACKET * | dst | ||
) |
Creates a ROBOTalk packet.
[in] | command | The ROBOTalk command. |
[in] | data | The ROBOTalk data. |
[in] | len_data | The length of data. |
[in] | from_id | The id of host. |
[in] | to_id | The id of the target client. |
[out] | packet | The created ROBOTalk packet. |
Definition at line 86 of file dn_robotalk.c.
HRESULT rtk_recv | ( | const struct CONN_PARAM_COMMON * | device, |
union RTK_PACKET * | packet_recv, | ||
int | client, | ||
unsigned int | retry_nak | ||
) |
Receives ROBOTalk packet.
[in] | device | The common communication parameters. |
[out] | packet_recv | The ROBOTalk packet to be received. |
[in] | client | Flag that means the receiver is client(1) or not(0). |
[in] | retry_nak | The retry count when receiving the NAK packet. |
Definition at line 193 of file dn_robotalk.c.
HRESULT rtk_send | ( | const struct CONN_PARAM_COMMON * | device, |
union RTK_PACKET * | packet_send | ||
) |
Sends ROBOTalk packet.
[in] | device | The common communication parameters. |
[in] | packet_send | The ROBOTalk packet to be sent. |
Definition at line 143 of file dn_robotalk.c.