Classes | Macros | Enumerations | Functions
dn_device.h File Reference

Common device API file. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CONN_PARAM_COM
 A type definition for serial connection parameters. More...
 
struct  CONN_PARAM_COMMON
 A type definition for common communication parameters. More...
 
struct  CONN_PARAM_ETH
 A type definition for Ethernet connection parameters. More...
 

Macros

#define _DN_EXP_DEVICE
 
#define DEV_BUF_MAX   ((uint16_t)-1)
 The maximum buffer size of a packet. More...
 
#define E_INVALIDPACKET   _HRESULT_TYPEDEF_(0x80010000L)
 Failed because the packet is invalid. More...
 
#define EVENPARITY   (2)
 A definition for serial communication setting. More...
 
#define NOPARITY   (0)
 A definition for serial communication setting. More...
 
#define ODDPARITY   (1)
 A definition for serial communication setting. More...
 
#define ONESTOPBIT   (0)
 A definition for serial communication setting. More...
 
#define TWOSTOPBITS   (2)
 A definition for serial communication setting. More...
 

Enumerations

enum  CONN_PARAM_CHECK_FLAG {
  CHECK_TYPE_TCP = 0x0001, CHECK_TYPE_UDP = 0x0002, CHECK_TYPE_COM = 0x0004, CHECK_TYPE_ALL = 0x00FF,
  CHECK_FUNC_OPEN = 0x0100, CHECK_FUNC_CLOSE = 0x0200, CHECK_FUNC_SEND = 0x0400, CHECK_FUNC_RECV = 0x0800,
  CHECK_FUNC_TIMEOUT = 0x1000, CHECK_FUNC_CLEAR = 0x2000, CHECK_FUNC_ALL = 0xFF00
}
 Definitions for check_conn_param function. More...
 
enum  CONN_TYPE { CONN_TCP = CHECK_TYPE_TCP, CONN_UDP = CHECK_TYPE_UDP, CONN_COM = CHECK_TYPE_COM }
 Connection type. More...
 

Functions

_DN_EXP_DEVICE HRESULT check_conn_param (const struct CONN_PARAM_COMMON *device, int flag)
 Checks the communication parameters. More...
 
_DN_EXP_DEVICE HRESULT check_timeout (int sock, uint32_t timeout)
 Checks the communication timeout. More...
 
_DN_EXP_DEVICE void memcpy_be (void *dst, const void *src, uint32_t len)
 Orders to big endian. More...
 
_DN_EXP_DEVICE void memcpy_le (void *dst, const void *src, uint32_t len)
 Orders to little endian. More...
 
_DN_EXP_DEVICE HRESULT parse_conn_param_ether (const char *opt, struct CONN_PARAM_ETH *param)
 Parses Ethernet connection parameters. More...
 
_DN_EXP_DEVICE HRESULT parse_conn_param_serial (const char *opt, struct CONN_PARAM_COM *param)
 Parses serial connection parameters. More...
 
_DN_EXP_DEVICE int parse_conn_type (const char *opt)
 Parses and returns the connection type. More...
 

Detailed Description

Common device API file.

Defines common device APIs.

Version
1.0
Date
2014/11/06
Author
DENSO WAVE

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_device.h.

Macro Definition Documentation

#define _DN_EXP_DEVICE

Definition at line 37 of file dn_device.h.

#define DEV_BUF_MAX   ((uint16_t)-1)

The maximum buffer size of a packet.

Definition at line 101 of file dn_device.h.

#define E_INVALIDPACKET   _HRESULT_TYPEDEF_(0x80010000L)

Failed because the packet is invalid.

Definition at line 107 of file dn_device.h.

#define EVENPARITY   (2)

A definition for serial communication setting.

Definition at line 81 of file dn_device.h.

#define NOPARITY   (0)

A definition for serial communication setting.

Definition at line 69 of file dn_device.h.

#define ODDPARITY   (1)

A definition for serial communication setting.

Definition at line 75 of file dn_device.h.

#define ONESTOPBIT   (0)

A definition for serial communication setting.

Definition at line 87 of file dn_device.h.

#define TWOSTOPBITS   (2)

A definition for serial communication setting.

Definition at line 93 of file dn_device.h.

Enumeration Type Documentation

Definitions for check_conn_param function.

Enumerator
CHECK_TYPE_TCP 

Allows to connect with TCP.

CHECK_TYPE_UDP 

Allows to connect with UDP.

CHECK_TYPE_COM 

Allows to connect with COM.

CHECK_TYPE_ALL 

Allows to connect with all type.

CHECK_FUNC_OPEN 

Must be set the dn_open function.

CHECK_FUNC_CLOSE 

Must be set the dn_close function.

CHECK_FUNC_SEND 

Must be set the dn_send function.

CHECK_FUNC_RECV 

Must be set the dn_recv function.

CHECK_FUNC_TIMEOUT 

Must be set the dn_timeout function.

CHECK_FUNC_CLEAR 

Must be set the dn_clear function.

CHECK_FUNC_ALL 

Must be set the all function.

Definition at line 113 of file dn_device.h.

enum CONN_TYPE

Connection type.

Enumerator
CONN_TCP 

TCP connection.

CONN_UDP 

UDP connection.

CONN_COM 

Serial connection.

Definition at line 132 of file dn_device.h.

Function Documentation

HRESULT check_conn_param ( const struct CONN_PARAM_COMMON device,
int  flag 
)

Checks the communication parameters.

Parameters
[in]deviceCommunication parameters to be checked.
[in]flagFlags to be checked with CONN_PARAM_CHECK_FLAG.

Definition at line 419 of file dn_device.c.

HRESULT check_timeout ( int  sock,
uint32_t  timeout 
)

Checks the communication timeout.

Parameters
[in]sockFile descriptor to be checked.
[in]timeoutTimeout value.

Definition at line 385 of file dn_device.c.

void memcpy_be ( void *  dst,
const void *  src,
uint32_t  len 
)

Orders to big endian.

Parameters
[out]dstThe pointer of ordered variable.
[in]srcThe pointer of variable to be ordered.
[in]lenThe 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.

Parameters
[out]dstThe pointer of ordered variable.
[in]srcThe pointer of variable to be ordered.
[in]lenThe 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.

Parameters
[in]optConnection option string.
[out]paramParsed Ethernet connection parameters.
Note
tcp[:<DestIP>[:<DestPort>[:<SourceIP>[:<SourcePort>]]]]
udp[:<DestIP>[:<DestPort>[:<SourceIP>[:<SourcePort>]]]]

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.

Parameters
[in]optConnection option string.
[out]paramParsed serial connection parameters.
Note
com[:<COM port>="">[:<BaudRate>[:<Parity>:<DataBits>:<StopBits>[:<Flow>]]]
<COM port>=""> := 0, 1, ...
<BaudRate> := 50, 75, ...
<Parity> := N, O, E
<DataBits> := 5, 6, 7, 8
<StopBits> := 1, 2
<Flow> := 0, 1, 2, 3

Definition at line 235 of file dn_device.c.

int parse_conn_type ( const char *  opt)

Parses and returns the connection type.

Parameters
[in]optConnection option string.

Definition at line 93 of file dn_device.c.



bcap_core
Author(s): DENSO WAVE INCORPORATED
autogenerated on Mon Jun 10 2019 13:12:20