00001 #ifndef BCAP_COMMON_H_ 00002 #define BCAP_COMMON_H_ 00003 00036 #ifndef _BCAP_EXP_COMMON 00037 #define _BCAP_EXP_COMMON 00038 #endif /* _BCAP_EXP_COMMON */ 00039 00045 #define BCAP_CHECK_TYPE (0) 00046 00051 #define BCAP_CHECK_SEND (BCAP_CHECK_TYPE | CHECK_FUNC_SEND) 00052 00057 #define BCAP_CHECK_RECV (BCAP_CHECK_TYPE | CHECK_FUNC_RECV) 00058 00063 #define S_EXECUTING _HRESULT_TYPEDEF_(0x00000900L) 00064 00069 #define BCAP_HEADER (0x01) 00070 00075 #define BCAP_TERMINATOR (0x04) 00076 00081 #define BCAP_SIZE_HEADER (1) 00082 00087 #define BCAP_SIZE_TERMINATOR (1) 00088 00093 #define BCAP_SIZE_LEN (4) 00094 00099 #define BCAP_SIZE_SERIAL (2) 00100 00105 #define BCAP_SIZE_RESERVE (2) 00106 00111 #define BCAP_SIZE_ID (4) 00112 00117 #define BCAP_SIZE_ARGC (2) 00118 00123 #define BCAP_SIZE_DATA_LEN (4) 00124 00129 #define BCAP_POS_HEADER (0) 00130 00135 #define BCAP_POS_LEN (BCAP_POS_HEADER + BCAP_SIZE_HEADER) 00136 00141 #define BCAP_POS_SERIAL (BCAP_POS_LEN + BCAP_SIZE_LEN) 00142 00147 #define BCAP_POS_RESERVE (BCAP_POS_SERIAL + BCAP_SIZE_SERIAL) 00148 00153 #define BCAP_POS_ID (BCAP_POS_RESERVE + BCAP_SIZE_RESERVE) 00154 00159 #define BCAP_POS_ARGC (BCAP_POS_ID + BCAP_SIZE_ID) 00160 00165 #define BCAP_POS_DATA_LEN (BCAP_POS_ARGC + BCAP_SIZE_ARGC) 00166 00172 #define BCAP_SIZE_INFO_LEN (14) 00173 00178 #define BCAP_SIZE_MIN (BCAP_SIZE_HEADER + BCAP_SIZE_INFO_LEN + BCAP_SIZE_TERMINATOR) 00179 00184 #define BCAP_SIZE_BSTR_LEN (4) 00185 00190 #define BCAP_SIZE_BSTR_BUFFER (2) 00191 00196 #define BCAP_SIZE_VARIANT_TYPE (2) 00197 00202 #define BCAP_SIZE_VARIANT_NUM (4) 00203 00208 #define BCAP_SIZE_CRC (2) 00209 00214 #define BCAP_POS_CRC(total_size) (total_size - BCAP_SIZE_CRC - BCAP_SIZE_TERMINATOR) 00215 00220 #define BCAP_SIZE_CALC_CRC(total_size) (total_size - BCAP_SIZE_HEADER - BCAP_SIZE_CRC - BCAP_SIZE_TERMINATOR) 00221 00227 struct BCAP_PACKET 00228 { 00229 uint16_t serial; 00230 uint16_t reserv; 00231 int32_t id; 00232 uint16_t argc; 00233 VARIANT* args; 00234 }; 00235 00236 #ifdef __cplusplus 00237 extern "C" 00238 { 00239 #endif 00240 00248 _BCAP_EXP_COMMON HRESULT 00249 bcap_packet2bytary(const struct BCAP_PACKET *src, char *dst, 00250 uint32_t len_dst); 00251 00260 _BCAP_EXP_COMMON HRESULT 00261 bcap_bytary2packet(const char *src, uint32_t len_src, 00262 struct BCAP_PACKET *dst); 00263 00269 _BCAP_EXP_COMMON uint32_t 00270 bcap_calc_size_packet(const struct BCAP_PACKET *packet); 00271 00277 _BCAP_EXP_COMMON uint16_t 00278 bcap_calc_crc(uint8_t *buf, uint32_t len_buf); 00279 00286 _BCAP_EXP_COMMON HRESULT 00287 bcap_send(struct CONN_PARAM_COMMON *device, struct BCAP_PACKET *packet_send); 00288 00296 _BCAP_EXP_COMMON HRESULT 00297 bcap_recv(struct CONN_PARAM_COMMON *device, struct BCAP_PACKET *packet_recv, 00298 int client); 00299 00300 #ifdef __cplusplus 00301 } 00302 #endif 00303 00304 #endif /* BCAP_COMMON_H_ */