b-CAP client library More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
#include <termios.h>
#include "b-Cap.h"
Go to the source code of this file.
Classes | |
struct | BCAP_ARG |
BCAP_ARG. More... | |
struct | BCAP_PACKET |
BCAP_PACKET. More... | |
Defines | |
#define | __LITTLE_ENDIAN__ |
#define | BCAP_EOT 0x04 /* size of packet terminater(EOT) */ |
#define | BCAP_FUNC_Controller_Connect 3 |
#define | BCAP_FUNC_Controller_Disconnect 4 |
#define | BCAP_FUNC_Controller_Execute 17 |
#define | BCAP_FUNC_Controller_GetRobot 7 |
#define | BCAP_FUNC_Controller_GetTask 8 |
#define | BCAP_FUNC_Controller_GetVariable 9 |
#define | BCAP_FUNC_Robot_Change 66 |
#define | BCAP_FUNC_Robot_Execute 64 |
#define | BCAP_FUNC_Robot_GetVariable 62 |
#define | BCAP_FUNC_Robot_Move 72 |
#define | BCAP_FUNC_Robot_Release 84 |
#define | BCAP_FUNC_Service_Start 1 |
#define | BCAP_FUNC_Service_Stop 2 |
#define | BCAP_FUNC_Task_GetVariable 85 |
#define | BCAP_FUNC_Task_Release 99 |
#define | BCAP_FUNC_Task_Start 88 |
#define | BCAP_FUNC_Task_Stop 89 |
#define | BCAP_FUNC_Variable_GetValue 101 |
#define | BCAP_FUNC_Variable_PutValue 102 |
#define | BCAP_FUNC_Variable_PutValue 102 |
#define | BCAP_FUNC_Variable_Release 111 |
#define | BCAP_MAX_ARG_SIZE 0x1000000 /* max arg size (bytes) */ |
#define | BCAP_MAX_PACKET_SIZE 0x1000000 /* max packet size (bytes) */ |
#define | BCAP_SIZE_ARGARRAYS 4 /* size of arrays */ |
#define | BCAP_SIZE_ARGBASE (BCAP_SIZE_ARGLEN+BCAP_SIZE_ARGTYPE+BCAP_SIZE_ARGARRAYS) |
#define | BCAP_SIZE_ARGLEN 4 /* size of length */ |
#define | BCAP_SIZE_ARGNUM 2 /* size of Args */ |
#define | BCAP_SIZE_ARGSTRLEN 4 /* size of string length */ |
#define | BCAP_SIZE_ARGTYPE 2 /* size of type */ |
#define | BCAP_SIZE_BASE |
#define | BCAP_SIZE_CRC 2 /* size of CRC */ |
#define | BCAP_SIZE_EOT 1 /* size of terminater(EOT) */ |
#define | BCAP_SIZE_FUNCID 4 /* size of FunctionID */ |
#define | BCAP_SIZE_LEN 4 /* size of message size */ |
#define | BCAP_SIZE_RESERVE 2 /* size of reserved */ |
#define | BCAP_SIZE_SERIAL 2 /* size of serial number */ |
#define | BCAP_SIZE_SOH 1 /* size of header(SOH) */ |
#define | BCAP_SOH 0x01 /* size of packet header(SOH) */ |
#define | DebugPrint(message) |
#define | DebugPrint2(f, a, b) |
#define | LOCALBUFFER_SZ 1024 |
#define | LOCALRECBUFFER_SZ 1024 |
Typedefs | |
typedef struct BCAP_ARG | BCAP_ARG |
typedef struct BCAP_PACKET | BCAP_PACKET |
Functions | |
static BCAP_ARG * | Arg_Create (u_short iType, u_int lArrays, u_int lLength, void *data) |
static void | Arg_Release (BCAP_ARG *pArg) |
BCAP_HRESULT | bCap_Open (const char *pIPStr, int iPort, int *iSockFd) |
static BCAP_HRESULT | bCapSendAndRec (int iSockFd, BCAP_PACKET *pSndPacket, BCAP_PACKET *pRecPacket) |
static void | bFree (void *pPtr) |
static void * | bMalloc (size_t size) |
static u_int | copyFromBSTR (void *pDstAsciiPtr, void *pSrcBstrPtr) |
static u_int | copyToBSTR (void *pbDstPtr, void *pbSrcPtr) |
static u_int | copyValue (void *pDst, void *pVntValue, u_int lLength) |
static u_int | copyVariantFromArg (BCAP_VARIANT *pVntDst, BCAP_ARG *pArg) |
static BCAP_HRESULT | Packet_AddArg (BCAP_PACKET *pPacket, BCAP_ARG *pNewArg) |
static BCAP_PACKET * | Packet_Create (u_int lFuncID) |
static BCAP_HRESULT | Packet_Deserialize (void *pBinData, BCAP_PACKET *pPacket) |
static BCAP_HRESULT | Packet_GetResult (BCAP_PACKET *pRecPacket, void *pResult) |
static void | Packet_Release (BCAP_PACKET *pPacket) |
static BCAP_HRESULT | Packet_Send (int iSd, BCAP_PACKET *pPacket) |
static BCAP_HRESULT | Packet_Serialize (BCAP_PACKET *pPacket, void *pBinData) |
static u_char * | receivePacket (int iSockFd, int *retryp) |
static BCAP_HRESULT | sendBinary (int iSockFd, u_char *pBuff, u_int lSize) |
static u_int | sizeOfVariant (BCAP_VARIANT vntValue) |
static u_int | sizeOfVarType (u_short iType) |
Variables | |
static u_short | m_iSerialNo = 1 |
#define __LITTLE_ENDIAN__ |
#define BCAP_FUNC_Controller_Connect 3 |
#define BCAP_FUNC_Controller_Disconnect 4 |
#define BCAP_FUNC_Controller_Execute 17 |
#define BCAP_FUNC_Controller_GetRobot 7 |
#define BCAP_FUNC_Controller_GetTask 8 |
#define BCAP_FUNC_Controller_GetVariable 9 |
#define BCAP_FUNC_Robot_Change 66 |
#define BCAP_FUNC_Robot_Execute 64 |
#define BCAP_FUNC_Robot_GetVariable 62 |
#define BCAP_FUNC_Robot_Move 72 |
#define BCAP_FUNC_Robot_Release 84 |
#define BCAP_FUNC_Service_Start 1 |
#define BCAP_FUNC_Service_Stop 2 |
#define BCAP_FUNC_Task_GetVariable 85 |
#define BCAP_FUNC_Task_Release 99 |
#define BCAP_FUNC_Task_Start 88 |
#define BCAP_FUNC_Task_Stop 89 |
#define BCAP_FUNC_Variable_GetValue 101 |
#define BCAP_FUNC_Variable_PutValue 102 |
#define BCAP_FUNC_Variable_PutValue 102 |
#define BCAP_FUNC_Variable_Release 111 |
#define BCAP_MAX_ARG_SIZE 0x1000000 /* max arg size (bytes) */ |
#define BCAP_MAX_PACKET_SIZE 0x1000000 /* max packet size (bytes) */ |
#define BCAP_SIZE_ARGARRAYS 4 /* size of arrays */ |
#define BCAP_SIZE_ARGLEN 4 /* size of length */ |
#define BCAP_SIZE_ARGNUM 2 /* size of Args */ |
#define BCAP_SIZE_ARGSTRLEN 4 /* size of string length */ |
#define BCAP_SIZE_ARGTYPE 2 /* size of type */ |
#define BCAP_SIZE_BASE |
(BCAP_SIZE_SOH + BCAP_SIZE_EOT + \ BCAP_SIZE_LEN + BCAP_SIZE_SERIAL + \ BCAP_SIZE_RESERVE + BCAP_SIZE_FUNCID + \ BCAP_SIZE_ARGNUM)
#define BCAP_SIZE_CRC 2 /* size of CRC */ |
#define BCAP_SIZE_EOT 1 /* size of terminater(EOT) */ |
#define BCAP_SIZE_FUNCID 4 /* size of FunctionID */ |
#define BCAP_SIZE_LEN 4 /* size of message size */ |
#define BCAP_SIZE_RESERVE 2 /* size of reserved */ |
#define BCAP_SIZE_SERIAL 2 /* size of serial number */ |
#define BCAP_SIZE_SOH 1 /* size of header(SOH) */ |
#define DebugPrint | ( | message | ) |
#define DebugPrint2 | ( | f, | |
a, | |||
b | |||
) |
#define LOCALBUFFER_SZ 1024 |
#define LOCALRECBUFFER_SZ 1024 |
typedef struct BCAP_PACKET BCAP_PACKET |
static BCAP_ARG* Arg_Create | ( | u_short | iType, |
u_int | lArrays, | ||
u_int | lLength, | ||
void * | data | ||
) | [static] |
static void Arg_Release | ( | BCAP_ARG * | pArg | ) | [static] |
BCAP_HRESULT bCap_Open | ( | const char * | pIPStr, |
int | iPort, | ||
int * | iSockFd | ||
) |
static BCAP_HRESULT bCapSendAndRec | ( | int | iSockFd, |
BCAP_PACKET * | pSndPacket, | ||
BCAP_PACKET * | pRecPacket | ||
) | [static] |
static void bFree | ( | void * | pPtr | ) | [static] |
static void* bMalloc | ( | size_t | size | ) | [static] |
static u_int copyFromBSTR | ( | void * | pDstAsciiPtr, |
void * | pSrcBstrPtr | ||
) | [static] |
static u_int copyToBSTR | ( | void * | pbDstPtr, |
void * | pbSrcPtr | ||
) | [static] |
static u_int copyValue | ( | void * | pDst, |
void * | pVntValue, | ||
u_int | lLength | ||
) | [static] |
static u_int copyVariantFromArg | ( | BCAP_VARIANT * | pVntDst, |
BCAP_ARG * | pArg | ||
) | [static] |
static BCAP_HRESULT Packet_AddArg | ( | BCAP_PACKET * | pPacket, |
BCAP_ARG * | pNewArg | ||
) | [static] |
static BCAP_PACKET* Packet_Create | ( | u_int | lFuncID | ) | [static] |
static BCAP_HRESULT Packet_Deserialize | ( | void * | pBinData, |
BCAP_PACKET * | pPacket | ||
) | [static] |
static BCAP_HRESULT Packet_GetResult | ( | BCAP_PACKET * | pRecPacket, |
void * | pResult | ||
) | [static] |
static void Packet_Release | ( | BCAP_PACKET * | pPacket | ) | [static] |
static BCAP_HRESULT Packet_Send | ( | int | iSd, |
BCAP_PACKET * | pPacket | ||
) | [static] |
static BCAP_HRESULT Packet_Serialize | ( | BCAP_PACKET * | pPacket, |
void * | pBinData | ||
) | [static] |
static u_char* receivePacket | ( | int | iSockFd, |
int * | retryp | ||
) | [static] |
static BCAP_HRESULT sendBinary | ( | int | iSockFd, |
u_char * | pBuff, | ||
u_int | lSize | ||
) | [static] |
static u_int sizeOfVariant | ( | BCAP_VARIANT | vntValue | ) | [static] |
static u_int sizeOfVarType | ( | u_short | iType | ) | [static] |
u_short m_iSerialNo = 1 [static] |