b-CAP Common API file. More...
Go to the source code of this file.
Classes | |
struct | BCAP_PACKET |
A type definition for the b-CAP packet. More... | |
Macros | |
#define | _BCAP_EXP_COMMON |
#define | BCAP_CHECK_RECV (BCAP_CHECK_TYPE | CHECK_FUNC_RECV) |
A definition for the check_conn_param function. More... | |
#define | BCAP_CHECK_SEND (BCAP_CHECK_TYPE | CHECK_FUNC_SEND) |
A definition for the check_conn_param function. More... | |
#define | BCAP_CHECK_TYPE (0) |
A definition for the check_conn_param function. More... | |
#define | BCAP_HEADER (0x01) |
A definition for the b-CAP header. More... | |
#define | BCAP_POS_ARGC (BCAP_POS_ID + BCAP_SIZE_ID) |
A definition for the buffer position of b-CAP number of args. More... | |
#define | BCAP_POS_CRC(total_size) (total_size - BCAP_SIZE_CRC - BCAP_SIZE_TERMINATOR) |
A macro for calculating the buffer position of b-CAP CRC. More... | |
#define | BCAP_POS_DATA_LEN (BCAP_POS_ARGC + BCAP_SIZE_ARGC) |
A definition for the buffer position of b-CAP argument data length. More... | |
#define | BCAP_POS_HEADER (0) |
A definition for the buffer position of b-CAP header. More... | |
#define | BCAP_POS_ID (BCAP_POS_RESERVE + BCAP_SIZE_RESERVE) |
A definition for the buffer position of b-CAP function ID or return code. More... | |
#define | BCAP_POS_LEN (BCAP_POS_HEADER + BCAP_SIZE_HEADER) |
A definition for the buffer position of b-CAP message length. More... | |
#define | BCAP_POS_RESERVE (BCAP_POS_SERIAL + BCAP_SIZE_SERIAL) |
A definition for the buffer position of b-CAP version or retry count. More... | |
#define | BCAP_POS_SERIAL (BCAP_POS_LEN + BCAP_SIZE_LEN) |
A definition for the buffer position of b-CAP serial number. More... | |
#define | BCAP_SIZE_ARGC (2) |
A definition for the size of b-CAP number of args. More... | |
#define | BCAP_SIZE_BSTR_BUFFER (2) |
A definition for the size of a BSTR character. More... | |
#define | BCAP_SIZE_BSTR_LEN (4) |
A definition for the size of BSTR string length. More... | |
#define | BCAP_SIZE_CALC_CRC(total_size) (total_size - BCAP_SIZE_HEADER - BCAP_SIZE_CRC - BCAP_SIZE_TERMINATOR) |
A macro for calculating a b-CAP CRC. More... | |
#define | BCAP_SIZE_CRC (2) |
A definition for the size of b-CAP CRC. More... | |
#define | BCAP_SIZE_DATA_LEN (4) |
A definition for the size of b-CAP argument data length. More... | |
#define | BCAP_SIZE_HEADER (1) |
A definition for the size of b-CAP header. More... | |
#define | BCAP_SIZE_ID (4) |
A definition for the size of b-CAP function ID or return code. More... | |
#define | BCAP_SIZE_INFO_LEN (14) |
A definition for the size of b-CAP information message length. More... | |
#define | BCAP_SIZE_LEN (4) |
A definition for the size of b-CAP message length. More... | |
#define | BCAP_SIZE_MIN (BCAP_SIZE_HEADER + BCAP_SIZE_INFO_LEN + BCAP_SIZE_TERMINATOR) |
A definition for the minimum buffer size of a b-CAP packet. More... | |
#define | BCAP_SIZE_RESERVE (2) |
A definition for the size of b-CAP version or retry count. More... | |
#define | BCAP_SIZE_SERIAL (2) |
A definition for the size of b-CAP serial number. More... | |
#define | BCAP_SIZE_TERMINATOR (1) |
A definition for the size of b-CAP terminator. More... | |
#define | BCAP_SIZE_VARIANT_NUM (4) |
A definition for the size of VARIANT number of elements. More... | |
#define | BCAP_SIZE_VARIANT_TYPE (2) |
A definition for the size of VARIANT data type. More... | |
#define | BCAP_TERMINATOR (0x04) |
A definition for the b-CAP terminator. More... | |
#define | S_EXECUTING _HRESULT_TYPEDEF_(0x00000900L) |
Succeeded but the server has been executing yet. More... | |
Functions | |
_BCAP_EXP_COMMON HRESULT | bcap_bytary2packet (const char *src, uint32_t len_src, struct BCAP_PACKET *dst) |
Converts the byte array to a b-CAP packet. More... | |
_BCAP_EXP_COMMON uint16_t | bcap_calc_crc (uint8_t *buf, uint32_t len_buf) |
Calculates CRC of the b-CAP packet. More... | |
_BCAP_EXP_COMMON uint32_t | bcap_calc_size_packet (const struct BCAP_PACKET *packet) |
Calculates the converted buffer size of the b-CAP packet. More... | |
_BCAP_EXP_COMMON HRESULT | bcap_packet2bytary (const struct BCAP_PACKET *src, char *dst, uint32_t len_dst) |
Converts the b-CAP packet to a byte array. More... | |
_BCAP_EXP_COMMON HRESULT | bcap_recv (struct CONN_PARAM_COMMON *device, struct BCAP_PACKET *packet_recv, int client) |
Receives b-CAP packet. More... | |
_BCAP_EXP_COMMON HRESULT | bcap_send (struct CONN_PARAM_COMMON *device, struct BCAP_PACKET *packet_send) |
Sends b-CAP packet. More... | |
b-CAP Common API file.
Defines b-CAP common 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 bcap_common.h.
#define _BCAP_EXP_COMMON |
Definition at line 37 of file bcap_common.h.
#define BCAP_CHECK_RECV (BCAP_CHECK_TYPE | CHECK_FUNC_RECV) |
A definition for the check_conn_param function.
Definition at line 57 of file bcap_common.h.
#define BCAP_CHECK_SEND (BCAP_CHECK_TYPE | CHECK_FUNC_SEND) |
A definition for the check_conn_param function.
Definition at line 51 of file bcap_common.h.
#define BCAP_CHECK_TYPE (0) |
A definition for the check_conn_param function.
Definition at line 45 of file bcap_common.h.
#define BCAP_HEADER (0x01) |
A definition for the b-CAP header.
Definition at line 69 of file bcap_common.h.
#define BCAP_POS_ARGC (BCAP_POS_ID + BCAP_SIZE_ID) |
A definition for the buffer position of b-CAP number of args.
Definition at line 159 of file bcap_common.h.
#define BCAP_POS_CRC | ( | total_size | ) | (total_size - BCAP_SIZE_CRC - BCAP_SIZE_TERMINATOR) |
A macro for calculating the buffer position of b-CAP CRC.
Definition at line 214 of file bcap_common.h.
#define BCAP_POS_DATA_LEN (BCAP_POS_ARGC + BCAP_SIZE_ARGC) |
A definition for the buffer position of b-CAP argument data length.
Definition at line 165 of file bcap_common.h.
#define BCAP_POS_HEADER (0) |
A definition for the buffer position of b-CAP header.
Definition at line 129 of file bcap_common.h.
#define BCAP_POS_ID (BCAP_POS_RESERVE + BCAP_SIZE_RESERVE) |
A definition for the buffer position of b-CAP function ID or return code.
Definition at line 153 of file bcap_common.h.
#define BCAP_POS_LEN (BCAP_POS_HEADER + BCAP_SIZE_HEADER) |
A definition for the buffer position of b-CAP message length.
Definition at line 135 of file bcap_common.h.
#define BCAP_POS_RESERVE (BCAP_POS_SERIAL + BCAP_SIZE_SERIAL) |
A definition for the buffer position of b-CAP version or retry count.
Definition at line 147 of file bcap_common.h.
#define BCAP_POS_SERIAL (BCAP_POS_LEN + BCAP_SIZE_LEN) |
A definition for the buffer position of b-CAP serial number.
Definition at line 141 of file bcap_common.h.
#define BCAP_SIZE_ARGC (2) |
A definition for the size of b-CAP number of args.
Definition at line 117 of file bcap_common.h.
#define BCAP_SIZE_BSTR_BUFFER (2) |
A definition for the size of a BSTR character.
Definition at line 190 of file bcap_common.h.
#define BCAP_SIZE_BSTR_LEN (4) |
A definition for the size of BSTR string length.
Definition at line 184 of file bcap_common.h.
#define BCAP_SIZE_CALC_CRC | ( | total_size | ) | (total_size - BCAP_SIZE_HEADER - BCAP_SIZE_CRC - BCAP_SIZE_TERMINATOR) |
A macro for calculating a b-CAP CRC.
Definition at line 220 of file bcap_common.h.
#define BCAP_SIZE_CRC (2) |
A definition for the size of b-CAP CRC.
Definition at line 208 of file bcap_common.h.
#define BCAP_SIZE_DATA_LEN (4) |
A definition for the size of b-CAP argument data length.
Definition at line 123 of file bcap_common.h.
#define BCAP_SIZE_HEADER (1) |
A definition for the size of b-CAP header.
Definition at line 81 of file bcap_common.h.
#define BCAP_SIZE_ID (4) |
A definition for the size of b-CAP function ID or return code.
Definition at line 111 of file bcap_common.h.
#define BCAP_SIZE_INFO_LEN (14) |
A definition for the size of b-CAP information message length.
Definition at line 172 of file bcap_common.h.
#define BCAP_SIZE_LEN (4) |
A definition for the size of b-CAP message length.
Definition at line 93 of file bcap_common.h.
#define BCAP_SIZE_MIN (BCAP_SIZE_HEADER + BCAP_SIZE_INFO_LEN + BCAP_SIZE_TERMINATOR) |
A definition for the minimum buffer size of a b-CAP packet.
Definition at line 178 of file bcap_common.h.
#define BCAP_SIZE_RESERVE (2) |
A definition for the size of b-CAP version or retry count.
Definition at line 105 of file bcap_common.h.
#define BCAP_SIZE_SERIAL (2) |
A definition for the size of b-CAP serial number.
Definition at line 99 of file bcap_common.h.
#define BCAP_SIZE_TERMINATOR (1) |
A definition for the size of b-CAP terminator.
Definition at line 87 of file bcap_common.h.
#define BCAP_SIZE_VARIANT_NUM (4) |
A definition for the size of VARIANT number of elements.
Definition at line 202 of file bcap_common.h.
#define BCAP_SIZE_VARIANT_TYPE (2) |
A definition for the size of VARIANT data type.
Definition at line 196 of file bcap_common.h.
#define BCAP_TERMINATOR (0x04) |
A definition for the b-CAP terminator.
Definition at line 75 of file bcap_common.h.
#define S_EXECUTING _HRESULT_TYPEDEF_(0x00000900L) |
Succeeded but the server has been executing yet.
Definition at line 63 of file bcap_common.h.
HRESULT bcap_bytary2packet | ( | const char * | src, |
uint32_t | len_src, | ||
struct BCAP_PACKET * | dst | ||
) |
Converts the byte array to a b-CAP packet.
[in] | src | The byte array to be converted. |
[in] | len_src | The length of allocated byte array. |
[out] | dst | The converted b-CAP packet. |
Definition at line 776 of file bcap_common.c.
Calculates CRC of the b-CAP packet.
[in] | packet | The b-CAP packet to be calculated. |
Definition at line 870 of file bcap_common.c.
uint32_t bcap_calc_size_packet | ( | const struct BCAP_PACKET * | packet | ) |
Calculates the converted buffer size of the b-CAP packet.
[in] | packet | The b-CAP packet to be calculated. |
Definition at line 847 of file bcap_common.c.
HRESULT bcap_packet2bytary | ( | const struct BCAP_PACKET * | src, |
char * | dst, | ||
uint32_t | len_dst | ||
) |
Converts the b-CAP packet to a byte array.
[in] | src | The b-CAP packet to be converted. |
[out] | dst | The converted byte array. |
[in] | len_dst | The length of allocated byte array. |
Definition at line 476 of file bcap_common.c.
HRESULT bcap_recv | ( | struct CONN_PARAM_COMMON * | device, |
struct BCAP_PACKET * | packet_recv, | ||
int | client | ||
) |
Receives b-CAP packet.
[in] | device | The common communication parameters. |
[out] | packet_recv | The b-CAP packet to be received. |
[in] | client | Flag that means the receiver is client(1) or not(0). |
Definition at line 984 of file bcap_common.c.
HRESULT bcap_send | ( | struct CONN_PARAM_COMMON * | device, |
struct BCAP_PACKET * | packet_send | ||
) |
Sends b-CAP packet.
[in] | device | The common communication parameters. |
[in] | packet_send | The b-CAP packet to be sent. |
Definition at line 899 of file bcap_common.c.