TP communication API file. More...
#include "../dn_common.h"
Go to the source code of this file.
Classes | |
struct | CALL_FUNC_TP |
Callback functions of TP event. More... | |
struct | TP_KEY_INFO |
TP key bit mapping. More... | |
struct | TP_TOUCH_INFO |
TP touch bit mapping. More... | |
Defines | |
#define | _DN_EXP_TPCOMM |
#define | TP_CMD_BEEP (0x0C28) |
A definition for the ROBOTalk command which means requests BEEP. | |
#define | TP_CMD_BKL_ON (0x0C33) |
A definition for the ROBOTalk command which means requests backlight on. | |
#define | TP_CMD_GET_KEYSTATE (0x0C2D) |
A definition for the ROBOTalk command which means requests key state. | |
#define | TP_CMD_KEYINFO (0x0C20) |
A definition for the ROBOTalk command which means requests or raised key event. | |
#define | TP_CMD_LCD (0x0C49) |
A definition for the ROBOTalk command which means requests change LCD. | |
#define | TP_CMD_LED_FLASH (0x0C2B) |
A definition for the ROBOTalk command which means requests LED flash. | |
#define | TP_CMD_LED_OFF (0x0C2A) |
A definition for the ROBOTalk command which means requests LED off. | |
#define | TP_CMD_LED_ON (0x0C29) |
A definition for the ROBOTalk command which means requests LED on. | |
#define | TP_CMD_MTP_DRAW (0x0C81) |
A definition for the ROBOTalk command which means requests draw Mini TP. | |
#define | TP_CMD_PING (0x0C2F) |
A definition for the ROBOTalk command which means requests check wire. | |
#define | TP_CMD_REQ_ID (0x0EF0) |
A definition for the ROBOTalk command which means requests ID. | |
#define | TP_CMD_TOUTCHINFO (0x0C21) |
A definition for the ROBOTalk command which means requests or raised touch event. | |
#define | TP_CONN_MAX (1) |
A definition for the maximum count of TP connections. | |
#define | TP_ID_CLIENT (0x11) |
A definition for the client ID. | |
#define | TP_ID_SERVER (0x90) |
A definition for the server ID. | |
#define | TP_RETRY_NAK (2) |
A definition for the retry count of sending and receiving NAK packet. | |
#define | TP_RETRY_TIMEOUT (2) |
A definition for the retry count of communication timeout. | |
Enumerations | |
enum | LED_STATE { LED_OFF = 0, LED_ON, LED_FLASH } |
LED state information. More... | |
enum | MINITP_COMMAND { COLOR_FG = 0x10, COLOR_BG = 0x11, COLOR_FILL = 0x12, DRAW_STRING = 0x20, DRAW_LINE = 0x30, DRAW_RECT = 0x31 } |
Mini TP command information. More... | |
enum | MINITP_PARAM { COLOR_BLACK = 0, COLOR_WHITE = 0xF, COLOR_TRANS = 0xFF, SIZE_SMALL = 0, SIZE_MIDDLE = 1, SIZE_LARGE = 2, SIZE_LARGE_H = 3, ATTR_NORMAL = 0, ATTR_REVERSE = 1, ATTR_FLASH = 2, ATTR_EMPHASIS = 4, ATTR_UNDERLINE = 8 } |
Mini TP parameter information. More... | |
enum | TP_KEY_ENUM { DIAL_MODE_AUTO = 1, DIAL_MODE_MANUAL = 2, DIAL_MODE_TEACH = 4, BTN_DIR_UP = 1, BTN_DIR_DOWN = 2, BTN_DIR_LEFT = 4, BTN_DIR_RIGHT = 8, BTN_FUNC_F1 = 1, BTN_FUNC_F2 = 2, BTN_FUNC_F3 = 4, BTN_FUNC_F4 = 8, BTN_FUNC_F5 = 16, BTN_FUNC_F6 = 32, DIAL_DIR_MINUS = 1, DIAL_DIR_PLUS = 2, JOG_MINUS_J1 = 1, JOG_MINUS_J2 = 2, JOG_MINUS_J3 = 4, JOG_MINUS_J4 = 8, JOG_MINUS_J5 = 16, JOG_MINUS_J6 = 32, JOG_PLUS_J1 = 1, JOG_PLUS_J2 = 2, JOG_PLUS_J3 = 4, JOG_PLUS_J4 = 8, JOG_PLUS_J5 = 16, JOG_PLUS_J6 = 32 } |
TP key information. More... | |
enum | TP_STATE { TP_DISCONNECT = 0, TP_CONNECT, TP_TPLESS, TP_TPERROR } |
TP connection state. More... | |
enum | TP_TOUCH_ENUM { MODE_TOUCH = 0x54, MODE_RELEASE = 0x52 } |
TP touch information. More... | |
Functions | |
_DN_EXP_TPCOMM HRESULT | TPComm_BEEP (int fd, int16_t time) |
TP beeps. | |
_DN_EXP_TPCOMM HRESULT | TPComm_Close (int *pfd) |
Ends TP communication. | |
_DN_EXP_TPCOMM 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. | |
_DN_EXP_TPCOMM HRESULT | TPComm_DrawMiniTP (int fd, VARIANT commands) |
Sends Draw Mini TP commands. | |
_DN_EXP_TPCOMM 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. | |
_DN_EXP_TPCOMM 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. | |
_DN_EXP_TPCOMM HRESULT | TPComm_GetTimeout (int fd, uint32_t *timeout) |
Gets timeout. | |
_DN_EXP_TPCOMM HRESULT | TPComm_GetTPState (int fd, int *state) |
Gets TP state. | |
_DN_EXP_TPCOMM HRESULT | TPComm_LCD (int fd, int16_t contrast) |
Changes TP LCD. | |
_DN_EXP_TPCOMM HRESULT | TPComm_LED (int fd, int16_t number, int16_t state) |
Changes TP LED. | |
_DN_EXP_TPCOMM HRESULT | TPComm_Open (const char *connect, uint32_t timeout, int client, int *pfd) |
Starts TP communication. | |
_DN_EXP_TPCOMM HRESULT | TPComm_SetCallFunc (const struct CALL_FUNC_TP *func) |
Sets callback functions. | |
_DN_EXP_TPCOMM HRESULT | TPComm_SetTimeout (int fd, uint32_t timeout) |
Sets timeout. |
TP communication API file.
Defines TP communication APIs.
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_tpcomm.h.
#define _DN_EXP_TPCOMM |
Definition at line 36 of file dn_tpcomm.h.
#define TP_CMD_BEEP (0x0C28) |
A definition for the ROBOTalk command which means requests BEEP.
Definition at line 94 of file dn_tpcomm.h.
#define TP_CMD_BKL_ON (0x0C33) |
A definition for the ROBOTalk command which means requests backlight on.
Definition at line 124 of file dn_tpcomm.h.
#define TP_CMD_GET_KEYSTATE (0x0C2D) |
A definition for the ROBOTalk command which means requests key state.
Definition at line 118 of file dn_tpcomm.h.
#define TP_CMD_KEYINFO (0x0C20) |
A definition for the ROBOTalk command which means requests or raised key event.
Definition at line 82 of file dn_tpcomm.h.
#define TP_CMD_LCD (0x0C49) |
A definition for the ROBOTalk command which means requests change LCD.
Definition at line 130 of file dn_tpcomm.h.
#define TP_CMD_LED_FLASH (0x0C2B) |
A definition for the ROBOTalk command which means requests LED flash.
Definition at line 112 of file dn_tpcomm.h.
#define TP_CMD_LED_OFF (0x0C2A) |
A definition for the ROBOTalk command which means requests LED off.
Definition at line 106 of file dn_tpcomm.h.
#define TP_CMD_LED_ON (0x0C29) |
A definition for the ROBOTalk command which means requests LED on.
Definition at line 100 of file dn_tpcomm.h.
#define TP_CMD_MTP_DRAW (0x0C81) |
A definition for the ROBOTalk command which means requests draw Mini TP.
Definition at line 136 of file dn_tpcomm.h.
#define TP_CMD_PING (0x0C2F) |
A definition for the ROBOTalk command which means requests check wire.
Definition at line 142 of file dn_tpcomm.h.
#define TP_CMD_REQ_ID (0x0EF0) |
A definition for the ROBOTalk command which means requests ID.
Definition at line 76 of file dn_tpcomm.h.
#define TP_CMD_TOUTCHINFO (0x0C21) |
A definition for the ROBOTalk command which means requests or raised touch event.
Definition at line 88 of file dn_tpcomm.h.
#define TP_CONN_MAX (1) |
A definition for the maximum count of TP connections.
Definition at line 46 of file dn_tpcomm.h.
#define TP_ID_CLIENT (0x11) |
A definition for the client ID.
Definition at line 64 of file dn_tpcomm.h.
#define TP_ID_SERVER (0x90) |
A definition for the server ID.
Definition at line 70 of file dn_tpcomm.h.
#define TP_RETRY_NAK (2) |
A definition for the retry count of sending and receiving NAK packet.
Definition at line 52 of file dn_tpcomm.h.
#define TP_RETRY_TIMEOUT (2) |
A definition for the retry count of communication timeout.
Definition at line 58 of file dn_tpcomm.h.
enum LED_STATE |
LED state information.
Definition at line 205 of file dn_tpcomm.h.
enum MINITP_COMMAND |
Mini TP command information.
COLOR_FG |
Sets character color. |
COLOR_BG |
Sets background color. |
COLOR_FILL |
Sets fill color. |
DRAW_STRING |
Draws a string. |
DRAW_LINE |
Draws a line. |
DRAW_RECT |
Draws a rectangle. |
Definition at line 216 of file dn_tpcomm.h.
enum MINITP_PARAM |
Mini TP parameter information.
Definition at line 230 of file dn_tpcomm.h.
enum TP_KEY_ENUM |
TP key information.
Definition at line 160 of file dn_tpcomm.h.
enum TP_STATE |
TP connection state.
Definition at line 148 of file dn_tpcomm.h.
enum TP_TOUCH_ENUM |
TP touch information.
Definition at line 195 of file dn_tpcomm.h.
HRESULT TPComm_BEEP | ( | int | fd, |
int16_t | time | ||
) |
TP beeps.
[in] | fd | File descriptor. |
[in] | time | Beeping time. |
Definition at line 1002 of file dn_tpcomm.c.
HRESULT TPComm_Close | ( | int * | pfd | ) |
Ends TP communication.
[in,out] | pfd | The 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.
[in] | fd | File descriptor. |
[in] | start_x | The start position for axis X. |
[in] | start_y | The start position for axis Y. |
[in] | end_x | The end position for axis X. |
[in] | end_y | The end position for axis Y. |
[in] | color_fg | The 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.
[in] | fd | File descriptor. |
[in] | commands | Mini 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.
[in] | fd | File descriptor. |
[in] | start_x | The start position for axis X. |
[in] | start_y | The start position for axis Y. |
[in] | end_x | The end position for axis X. |
[in] | end_y | The end position for axis Y. |
[in] | color_fg | The color of drawing rectangle. |
[in] | color_fg | The 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.
[in] | fd | File descriptor. |
[in] | bstr | The drawing string. |
[in] | pos_x | The drawing position for axis X. |
[in] | pos_y | The drawing position for axis Y. |
[in] | size | The size of drawing string. |
[in] | attr | The attribute of drawing string. |
[in] | color_fg | The color of drawing string. |
[in] | color_bg | The background color of drawing string. |
Definition at line 1203 of file dn_tpcomm.c.
HRESULT TPComm_GetTimeout | ( | int | fd, |
uint32_t * | timeout | ||
) |
Gets timeout.
[in] | fd | File descriptor. |
[out] | timeout | The gotten timeout value. |
Definition at line 966 of file dn_tpcomm.c.
HRESULT TPComm_GetTPState | ( | int | fd, |
int * | state | ||
) |
Gets TP state.
[in] | fd | File descriptor. |
[out] | state | The gotten TP state. |
Definition at line 985 of file dn_tpcomm.c.
_DN_EXP_TPCOMM HRESULT TPComm_LCD | ( | int | fd, |
int16_t | contrast | ||
) |
Changes TP LCD.
[in] | fd | File descriptor. |
[in] | contrast | The 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.
[in] | fd | File descriptor. |
[in] | number | The LED number. (1: MORTOR, 2: LOCK, -1: Both) |
[in] | state | State 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.
[in] | connect | Connection parameters. |
[in] | timeout | Timeout value. |
[in] | client | TP mode flag. (Client: = 1, Server: 0) |
[out] | pfd | The 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.
[in] | func | Callback functions to be set. |
Definition at line 737 of file dn_tpcomm.c.
HRESULT TPComm_SetTimeout | ( | int | fd, |
uint32_t | timeout | ||
) |
Sets timeout.
[in] | fd | File descriptor. |
[in] | timeout | Timeout value to be set. |
Definition at line 935 of file dn_tpcomm.c.