#include "stdint.h"
#include <stdlib.h>
#include <string.h>
#include "dn_additional.h"
#include "dn_common.h"
#include "dn_device.h"
Go to the source code of this file.
Macros | |
#define | __LITTLE_ENDIAN__ |
#define | _PARA_MAX_COM (7) |
#define | _PARA_MAX_ETH (5) |
#define | _STR_ISNUMERIC "0123456789" |
#define | _TYPE_MIN (3) |
Functions | |
HRESULT | check_conn_param (const struct CONN_PARAM_COMMON *device, int flag) |
Checks the communication parameters. More... | |
HRESULT | check_timeout (int sock, uint32_t timeout) |
Checks the communication timeout. More... | |
static int | is_numeric (const char *src) |
Checks the argument is numeric or not. More... | |
void | memcpy_be (void *dst, const void *src, uint32_t len) |
Orders to big endian. More... | |
void | memcpy_le (void *dst, const void *src, uint32_t len) |
Orders to little endian. More... | |
HRESULT | parse_conn_param_ether (const char *opt, struct CONN_PARAM_ETH *param) |
Parses Ethernet connection parameters. More... | |
HRESULT | parse_conn_param_serial (const char *opt, struct CONN_PARAM_COM *param) |
Parses serial connection parameters. More... | |
int | parse_conn_type (const char *opt) |
Parses and returns the connection type. More... | |
#define __LITTLE_ENDIAN__ |
Definition at line 56 of file dn_device.c.
#define _PARA_MAX_COM (7) |
Definition at line 49 of file dn_device.c.
#define _PARA_MAX_ETH (5) |
Definition at line 50 of file dn_device.c.
#define _STR_ISNUMERIC "0123456789" |
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 46 of file dn_device.c.
#define _TYPE_MIN (3) |
Definition at line 48 of file dn_device.c.
HRESULT check_conn_param | ( | const struct CONN_PARAM_COMMON * | device, |
int | flag | ||
) |
Checks the communication parameters.
[in] | device | Communication parameters to be checked. |
[in] | flag | Flags to be checked with CONN_PARAM_CHECK_FLAG. |
Definition at line 419 of file dn_device.c.
Checks the communication timeout.
[in] | sock | File descriptor to be checked. |
[in] | timeout | Timeout value. |
Definition at line 385 of file dn_device.c.
|
static |
Checks the argument is numeric or not.
[in] | src | The characters to be checked. |
Definition at line 69 of file dn_device.c.
void memcpy_be | ( | void * | dst, |
const void * | src, | ||
uint32_t | len | ||
) |
Orders to big endian.
[out] | dst | The pointer of ordered variable. |
[in] | src | The pointer of variable to be ordered. |
[in] | len | The number of buffers to be ordered. |
Definition at line 495 of file dn_device.c.
void memcpy_le | ( | void * | dst, |
const void * | src, | ||
uint32_t | len | ||
) |
Orders to little endian.
[out] | dst | The pointer of ordered variable. |
[in] | src | The pointer of variable to be ordered. |
[in] | len | The number of buffers to be ordered. |
Definition at line 469 of file dn_device.c.
HRESULT parse_conn_param_ether | ( | const char * | opt, |
struct CONN_PARAM_ETH * | param | ||
) |
Parses Ethernet connection parameters.
[in] | opt | Connection option string. |
[out] | param | Parsed Ethernet connection parameters. |
Definition at line 121 of file dn_device.c.
HRESULT parse_conn_param_serial | ( | const char * | opt, |
struct CONN_PARAM_COM * | param | ||
) |
Parses serial connection parameters.
[in] | opt | Connection option string. |
[out] | param | Parsed serial connection parameters. |
Definition at line 235 of file dn_device.c.
int parse_conn_type | ( | const char * | opt | ) |
Parses and returns the connection type.
[in] | opt | Connection option string. |
Definition at line 93 of file dn_device.c.