#include "stdint.h"
#include <stdlib.h>
#include <string.h>
#include "dn_additional.h"
#include "dn_common.h"
#include "dn_device.h"
#include "dn_udp.h"
#include "bcap_common.h"
Go to the source code of this file.
Defines | |
#define | _SEC_ONEDAY (24 * 60 * 60) |
A definition for the second of one day. | |
#define | _TIME_DIFFERENCE (25569.0) |
A definition for the time difference between time_t(0) and DATE(0). | |
Functions | |
HRESULT | bcap_bytary2packet (const char *src, uint32_t len_src, struct BCAP_PACKET *dst) |
Converts the byte array to a b-CAP packet. | |
static HRESULT | bcap_bytary2vnt (const char *src, uint32_t len_src, VARIANT *dst, uint32_t argc, uint32_t *offset) |
Converts the byte array to a VARIANT value. | |
static HRESULT | bcap_bytary2vntary (const char *src, uint32_t len_src, VARIANT *dst, uint32_t argc, uint32_t *offset, int flag) |
Converts the byte array to a VARIANT array. | |
static void | bcap_bytary2vntdate (const char *src, DATE *dst) |
Converts the byte array to a DATE value. | |
uint16_t | bcap_calc_crc (uint8_t *buf, uint32_t len_buf) |
Calculates CRC of the b-CAP packet. | |
uint32_t | bcap_calc_size_packet (const struct BCAP_PACKET *packet) |
Calculates the converted buffer size of the b-CAP packet. | |
static uint32_t | bcap_calc_size_variant (const VARIANT *vnt) |
Calculates the buffer length of the VARIANT. | |
HRESULT | bcap_packet2bytary (const struct BCAP_PACKET *src, char *dst, uint32_t len_dst) |
Converts the b-CAP packet to a byte array. | |
HRESULT | bcap_recv (struct CONN_PARAM_COMMON *device, struct BCAP_PACKET *packet_recv, int client) |
Receives b-CAP packet. | |
HRESULT | bcap_send (struct CONN_PARAM_COMMON *device, struct BCAP_PACKET *packet_send) |
Sends b-CAP packet. | |
static HRESULT | bcap_vnt2bytary (const VARIANT *src, uint32_t argc, char *dst, uint32_t len_dst, uint32_t *offset) |
static HRESULT | bcap_vntary2bytary (const VARIANT *src, uint32_t argc, char *dst, uint32_t len_dst, uint32_t *offset, int flag) |
static void | bcap_vntdate2bytary (const DATE *src, char *dst) |
Converts the DATE value to a byte array. |
#define _SEC_ONEDAY (24 * 60 * 60) |
A definition for the second of one day.
Definition at line 48 of file bcap_common.c.
#define _TIME_DIFFERENCE (25569.0) |
A definition for the time difference between time_t(0) and DATE(0).
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 at line 42 of file bcap_common.c.
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.
HRESULT bcap_bytary2vnt | ( | const char * | src, |
uint32_t | len_src, | ||
VARIANT * | dst, | ||
uint32_t | argc, | ||
uint32_t * | offset | ||
) | [static] |
Converts the byte array to a VARIANT value.
[in] | src | The byte array to be converted. |
[in] | len_src | The length of allocated byte array. |
[out] | dst | The converted VARIANT value. |
[in] | argc | The number of arrays. |
[in,out] | offset | The current buffer position to convert. |
Definition at line 528 of file bcap_common.c.
static HRESULT bcap_bytary2vntary | ( | const char * | src, |
uint32_t | len_src, | ||
VARIANT * | dst, | ||
uint32_t | argc, | ||
uint32_t * | offset, | ||
int | flag | ||
) | [static] |
Converts the byte array to a VARIANT array.
[in] | src | The byte array to be converted. |
[in] | len_src | The length of allocated byte array. |
[out] | dst | The converted VARIANT array. |
[in] | argc | The number of arrays. |
[in,out] | offset | The current buffer position to convert. |
[in] | flag | Flag that means whether this function called from bcap_bytary2packet or not. |
Definition at line 732 of file bcap_common.c.
void bcap_bytary2vntdate | ( | const char * | src, |
DATE * | dst | ||
) | [static] |
Converts the byte array to a DATE value.
[in] | src | The byte array to be converted. |
[out] | dst | The converted DATE value. |
Definition at line 196 of file bcap_common.c.
uint16_t bcap_calc_crc | ( | uint8_t * | buf, |
uint32_t | len_buf | ||
) |
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.
uint32_t bcap_calc_size_variant | ( | const VARIANT * | vnt | ) | [static] |
Calculates the buffer length of the VARIANT.
[in] | vnt | The VARIANT value to be calculated. |
Definition at line 70 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.
static HRESULT bcap_vnt2bytary | ( | const VARIANT * | src, |
uint32_t | argc, | ||
char * | dst, | ||
uint32_t | len_dst, | ||
uint32_t * | offset | ||
) | [static] |
Definition at line 219 of file bcap_common.c.
static HRESULT bcap_vntary2bytary | ( | const VARIANT * | src, |
uint32_t | argc, | ||
char * | dst, | ||
uint32_t | len_dst, | ||
uint32_t * | offset, | ||
int | flag | ||
) | [static] |
Definition at line 415 of file bcap_common.c.
void bcap_vntdate2bytary | ( | const DATE * | src, |
char * | dst | ||
) | [static] |
Converts the DATE value to a byte array.
[in] | src | The DATE value to be converted. |
[out] | dst | The converted byte array. |
Definition at line 176 of file bcap_common.c.