Classes | Defines | Functions | Variables
dn_tpcomm.c File Reference
#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 "dn_com.h"
#include "dn_thread.h"
#include "dn_robotalk.h"
#include "dn_tpcomm.h"
Include dependency graph for dn_tpcomm.c:

Go to the source code of this file.

Classes

struct  CONN_PARAM_TP
 TP communication object. More...
struct  TP_FLAGS
 TP flag objects. More...

Defines

#define _DEBUG   (0)
#define _PING_INTERVAL_CONNECT   (300)
 A definition for the sending interval of the ping packet when TP connected.
#define _PING_INTERVAL_TPERROR   (1000)
 A definition for the sending interval of the ping packet when TP is error state.
#define _TIMER_INTERVAL   (10)
 A definition for the interval of the timer event.
#define _TP_CMD_SPECIAL   (0x0FFF)
 A definition for the ROBOTalk command which means special command.
#define _TP_INIT_WAIT_CLIENT   (100)
 A definition for the wait time of the initialization when the client mode.
#define _TP_INIT_WAIT_SERVER   (3000)
 A definition for the wait time of the initialization when the server mode.
#define _TPERROR_TIMEOUT   (10000)
 A definition for the timeout which is used to raise disconnect event.
#define _TPLESS_INTERVAL   (10000)
 A definition for the interval of the TP less event.

Functions

static struct CONN_PARAM_TPcheck_address (int index)
 Checks whether the index has been used or not.
static int find_open_address ()
 Returns the open address of m_conn_param.
static HRESULT receive_execute (struct CONN_PARAM_TP *tp_param)
 Receives the ROBOTalk packet and executes callback functions.
static THRET THTYPE recv_thread (void *arg)
 The receiving thread.
static HRESULT send_receive (int index, unsigned int retry_timeout, uint16_t command_send, uint8_t *data_send, uint8_t len_send, uint16_t *command_recv, uint8_t *data_recv, uint8_t *len_recv)
static HRESULT timer_event (struct CONN_PARAM_TP *tp_param)
 Executes timer event procedure.
static THRET THTYPE timer_thread (void *arg)
 The timer thread.
static HRESULT tp_callfunc (uint16_t command, const uint8_t *data, uint8_t len_data)
 Execute a callback function with the ROBOTalk command.
static HRESULT tp_recv (struct CONN_PARAM_TP *tp_param, unsigned int retry_nak, uint16_t *command, uint8_t *data, uint8_t *len_data)
static HRESULT tp_send (struct CONN_PARAM_TP *tp_param, uint16_t command, uint8_t *data, uint8_t len_data)
HRESULT TPComm_BEEP (int fd, int16_t time)
 TP beeps.
HRESULT TPComm_Close (int *pfd)
 Ends TP communication.
HRESULT TPComm_DrawLine (int fd, uint8_t start_x, uint8_t start_y, uint8_t end_x, uint8_t end_y, uint8_t color_fg)
 Draws a line to Mini TP.
HRESULT TPComm_DrawMiniTP (int fd, VARIANT commands)
 Sends Draw Mini TP commands.
HRESULT TPComm_DrawRectangle (int fd, uint8_t start_x, uint8_t start_y, uint8_t end_x, uint8_t end_y, uint8_t color_fg, uint8_t color_bg)
 Draws a rectangle to Mini TP.
HRESULT TPComm_DrawString (int fd, BSTR bstr, uint8_t pos_x, uint8_t pos_y, uint8_t size, uint8_t attr, uint8_t color_fg, uint8_t color_bg)
 Draws a string to Mini TP.
HRESULT TPComm_GetTimeout (int fd, uint32_t *timeout)
 Gets timeout.
HRESULT TPComm_GetTPState (int fd, int *state)
 Gets TP state.
HRESULT TPComm_LCD (int fd, int16_t contrast)
 Changes TP LCD.
HRESULT TPComm_LED (int fd, int16_t number, int16_t state)
 Changes TP LED.
HRESULT TPComm_Open (const char *connect, uint32_t timeout, int client, int *pfd)
 Starts TP communication.
HRESULT TPComm_SetCallFunc (const struct CALL_FUNC_TP *func)
 Sets callback functions.
HRESULT TPComm_SetTimeout (int fd, uint32_t timeout)
 Sets timeout.

Variables

static struct CALL_FUNC_TP m_call_func
static struct CONN_PARAM_TP m_conn_param [TP_CONN_MAX]

Define Documentation

#define _DEBUG   (0)

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 50 of file dn_tpcomm.c.

#define _PING_INTERVAL_CONNECT   (300)

A definition for the sending interval of the ping packet when TP connected.

Note:
times in milliseconds.

Definition at line 85 of file dn_tpcomm.c.

#define _PING_INTERVAL_TPERROR   (1000)

A definition for the sending interval of the ping packet when TP is error state.

Note:
times in milliseconds.

Definition at line 92 of file dn_tpcomm.c.

#define _TIMER_INTERVAL   (10)

A definition for the interval of the timer event.

Note:
times in milliseconds.

Definition at line 64 of file dn_tpcomm.c.

#define _TP_CMD_SPECIAL   (0x0FFF)

A definition for the ROBOTalk command which means special command.

Definition at line 57 of file dn_tpcomm.c.

#define _TP_INIT_WAIT_CLIENT   (100)

A definition for the wait time of the initialization when the client mode.

Note:
times in milliseconds.

Definition at line 99 of file dn_tpcomm.c.

#define _TP_INIT_WAIT_SERVER   (3000)

A definition for the wait time of the initialization when the server mode.

Note:
times in milliseconds.

Definition at line 106 of file dn_tpcomm.c.

#define _TPERROR_TIMEOUT   (10000)

A definition for the timeout which is used to raise disconnect event.

Note:
times in milliseconds.

Definition at line 71 of file dn_tpcomm.c.

#define _TPLESS_INTERVAL   (10000)

A definition for the interval of the TP less event.

Note:
times in milliseconds.

Definition at line 78 of file dn_tpcomm.c.


Function Documentation

struct CONN_PARAM_TP * check_address ( int  index) [static, read]

Checks whether the index has been used or not.

Parameters:
[in]indexThe index of m_conn_param.
Note:
If the index has not been used then returns NULL.

Definition at line 173 of file dn_tpcomm.c.

int find_open_address ( ) [static]

Returns the open address of m_conn_param.

Note:
If there is no open space, then returns 0.

Definition at line 152 of file dn_tpcomm.c.

HRESULT receive_execute ( struct CONN_PARAM_TP tp_param) [static]

Receives the ROBOTalk packet and executes callback functions.

Parameters:
[in]tp_paramTP communication object.

Definition at line 452 of file dn_tpcomm.c.

THRET recv_thread ( void *  arg) [static]

The receiving thread.

Parameters:
[in]argThe argument of receiving thread: CONN_PARAM_TP.

Definition at line 663 of file dn_tpcomm.c.

static HRESULT send_receive ( int  index,
unsigned int  retry_timeout,
uint16_t  command_send,
uint8_t data_send,
uint8_t  len_send,
uint16_t command_recv,
uint8_t data_recv,
uint8_t len_recv 
) [static]

Definition at line 394 of file dn_tpcomm.c.

HRESULT timer_event ( struct CONN_PARAM_TP tp_param) [static]

Executes timer event procedure.

Parameters:
[in]tp_paramTP communication object.

Definition at line 583 of file dn_tpcomm.c.

THRET timer_thread ( void *  arg) [static]

The timer thread.

Parameters:
[in]argThe argument of timer thread: CONN_PARAM_TP.

Definition at line 697 of file dn_tpcomm.c.

HRESULT tp_callfunc ( uint16_t  command,
const uint8_t data,
uint8_t  len_data 
) [static]

Execute a callback function with the ROBOTalk command.

Parameters:
[in]commandThe received ROBOTalk command.
[in]dataThe received ROBOTalk data.
[in]len_dataThe length of received ROBOTalk data.

Definition at line 195 of file dn_tpcomm.c.

static HRESULT tp_recv ( struct CONN_PARAM_TP tp_param,
unsigned int  retry_nak,
uint16_t command,
uint8_t data,
uint8_t len_data 
) [static]

Definition at line 321 of file dn_tpcomm.c.

static HRESULT tp_send ( struct CONN_PARAM_TP tp_param,
uint16_t  command,
uint8_t data,
uint8_t  len_data 
) [static]

Definition at line 287 of file dn_tpcomm.c.

HRESULT TPComm_BEEP ( int  fd,
int16_t  time 
)

TP beeps.

Parameters:
[in]fdFile descriptor.
[in]timeBeeping time.

Definition at line 1002 of file dn_tpcomm.c.

HRESULT TPComm_Close ( int *  pfd)

Ends TP communication.

Parameters:
[in,out]pfdThe pointer of File descriptor.

Definition at line 885 of file dn_tpcomm.c.

HRESULT TPComm_DrawLine ( int  fd,
uint8_t  start_x,
uint8_t  start_y,
uint8_t  end_x,
uint8_t  end_y,
uint8_t  color_fg 
)

Draws a line to Mini TP.

Parameters:
[in]fdFile descriptor.
[in]start_xThe start position for axis X.
[in]start_yThe start position for axis Y.
[in]end_xThe end position for axis X.
[in]end_yThe end position for axis Y.
[in]color_fgThe color of drawing line.

Definition at line 1264 of file dn_tpcomm.c.

HRESULT TPComm_DrawMiniTP ( int  fd,
VARIANT  commands 
)

Sends Draw Mini TP commands.

Parameters:
[in]fdFile descriptor.
[in]commandsMini TP commands.

Definition at line 1062 of file dn_tpcomm.c.

HRESULT TPComm_DrawRectangle ( int  fd,
uint8_t  start_x,
uint8_t  start_y,
uint8_t  end_x,
uint8_t  end_y,
uint8_t  color_fg,
uint8_t  color_bg 
)

Draws a rectangle to Mini TP.

Parameters:
[in]fdFile descriptor.
[in]start_xThe start position for axis X.
[in]start_yThe start position for axis Y.
[in]end_xThe end position for axis X.
[in]end_yThe end position for axis Y.
[in]color_fgThe color of drawing rectangle.
[in]color_fgThe background color of drawing rectangle.

Definition at line 1311 of file dn_tpcomm.c.

HRESULT TPComm_DrawString ( int  fd,
BSTR  bstr,
uint8_t  pos_x,
uint8_t  pos_y,
uint8_t  size,
uint8_t  attr,
uint8_t  color_fg,
uint8_t  color_bg 
)

Draws a string to Mini TP.

Parameters:
[in]fdFile descriptor.
[in]bstrThe drawing string.
[in]pos_xThe drawing position for axis X.
[in]pos_yThe drawing position for axis Y.
[in]sizeThe size of drawing string.
[in]attrThe attribute of drawing string.
[in]color_fgThe color of drawing string.
[in]color_bgThe background color of drawing string.

Definition at line 1203 of file dn_tpcomm.c.

HRESULT TPComm_GetTimeout ( int  fd,
uint32_t timeout 
)

Gets timeout.

Parameters:
[in]fdFile descriptor.
[out]timeoutThe gotten timeout value.

Definition at line 966 of file dn_tpcomm.c.

HRESULT TPComm_GetTPState ( int  fd,
int *  state 
)

Gets TP state.

Parameters:
[in]fdFile descriptor.
[out]stateThe gotten TP state.

Definition at line 985 of file dn_tpcomm.c.

HRESULT TPComm_LCD ( int  fd,
int16_t  contrast 
)

Changes TP LCD.

Parameters:
[in]fdFile descriptor.
[in]contrastThe LCD value. (0: The most darken, 7: The most brightest) note It will take 2 or more seconds to reflect the set LDC value completely.

Definition at line 1047 of file dn_tpcomm.c.

HRESULT TPComm_LED ( int  fd,
int16_t  number,
int16_t  state 
)

Changes TP LED.

Parameters:
[in]fdFile descriptor.
[in]numberThe LED number. (1: MORTOR, 2: LOCK, -1: Both)
[in]stateState to be changed. (0: OFF, 1: ON, 2: FLASH)

Definition at line 1017 of file dn_tpcomm.c.

HRESULT TPComm_Open ( const char *  connect,
uint32_t  timeout,
int  client,
int *  pfd 
)

Starts TP communication.

Parameters:
[in]connectConnection parameters.
[in]timeoutTimeout value.
[in]clientTP mode flag. (Client: = 1, Server: 0)
[out]pfdThe pointer of File descriptor.

Definition at line 748 of file dn_tpcomm.c.

HRESULT TPComm_SetCallFunc ( const struct CALL_FUNC_TP func)

Sets callback functions.

Parameters:
[in]funcCallback functions to be set.

Definition at line 737 of file dn_tpcomm.c.

HRESULT TPComm_SetTimeout ( int  fd,
uint32_t  timeout 
)

Sets timeout.

Parameters:
[in]fdFile descriptor.
[in]timeoutTimeout value to be set.

Definition at line 935 of file dn_tpcomm.c.


Variable Documentation

struct CALL_FUNC_TP m_call_func [static]

Definition at line 144 of file dn_tpcomm.c.

Definition at line 143 of file dn_tpcomm.c.



bcap_core
Author(s): DENSO WAVE INCORPORATED
autogenerated on Thu Jun 6 2019 21:00:03