Classes | Macros | Typedefs | Functions | Variables
b-Cap.c File Reference

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 "denso_ros_control/b-Cap.h"
Include dependency graph for b-Cap.c:

Go to the source code of this file.

Classes

struct  BCAP_ARG
 BCAP_ARG. More...
 
struct  BCAP_PACKET
 BCAP_PACKET. More...
 

Macros

#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_ARGArg_Create (u_short iType, u_int lArrays, u_int lLength, void *data)
 
static void Arg_Release (BCAP_ARG *pArg)
 
BCAP_HRESULT bCap_Close (int iSockFd)
 
BCAP_HRESULT bCap_ControllerConnect (int iSockFd, char *pStrCtrlname, char *pStrProvName, char *pStrPcName, char *pStrOption, u_int *plhController)
 
BCAP_HRESULT bCap_ControllerDisconnect (int iSockFd, u_int lhController)
 
BCAP_HRESULT bCap_ControllerExecute (int iSockFd, u_int lhController, char *pStrCommand, char *pStrOption, void *pResult)
 
BCAP_HRESULT bCap_ControllerExecute2 (int iSockFd, u_int lhController, char *pStrCommand, BCAP_VARIANT *pVntOption, BCAP_VARIANT *pVntResult)
 
BCAP_HRESULT bCap_ControllerGetRobot (int iSockFd, u_int lhController, char *pStrRobotName, char *pStrOption, u_int *plhRobot)
 
BCAP_HRESULT bCap_ControllerGetTask (int iSockFd, u_int lhController, char *pTskName, char *pstrOption, u_int *plhVar)
 
BCAP_HRESULT bCap_ControllerGetVariable (int iSockFd, u_int lhController, char *pVarName, char *pstrOption, u_int *plhVar)
 
BCAP_HRESULT bCap_Open (const char *pIPStr, int iPort, int *iSockFd)
 
BCAP_HRESULT bCap_RobotChange (int iSockFd, u_int lhRobot, char *pStrCommand)
 
BCAP_HRESULT bCap_RobotExecute (int iSockFd, u_int lhRobot, char *pStrCommand, char *pStrOption, void *pResult)
 
BCAP_HRESULT bCap_RobotExecute2 (int iSockFd, u_int lhRobot, char *pStrCommand, BCAP_VARIANT *pVntOption, BCAP_VARIANT *pVntResult)
 
BCAP_HRESULT bCap_RobotExecuteSlaveMove (int iSockFd, u_int lhRobot, char *pStrCommand, float *pfOption, void *pResult)
 
BCAP_HRESULT bCap_RobotGetVariable (int iSockFd, u_int lhRobot, char *pVarName, char *pstrOption, u_int *plhVar)
 
BCAP_HRESULT bCap_RobotMove (int iSockFd, u_int lhRobot, long lComp, char *pStrPose, char *pStrOption)
 
BCAP_HRESULT bCap_RobotRelease (int iSockFd, u_int lhRobot)
 
BCAP_HRESULT bCap_ServiceStart (int iSockFd)
 
BCAP_HRESULT bCap_ServiceStop (int iSockFd)
 
BCAP_HRESULT bCap_TaskGetVariable (int iSockFd, u_int lhTask, char *pVarName, char *pstrOption, u_int *plhVar)
 
BCAP_HRESULT bCap_TaskRelease (int iSockFd, u_int lhTask)
 
BCAP_HRESULT bCap_TaskStart (int iSockFd, u_int lhTask, long lMode, char *pStrOption)
 
BCAP_HRESULT bCap_TaskStop (int iSockFd, u_int lhTask, long lMode, char *pStrOption)
 
BCAP_HRESULT bCap_VariableGetValue (int iSockFd, u_int lhVar, void *pVntValue)
 
BCAP_HRESULT bCap_VariablePutValue (int iSockFd, u_int lhVar, u_short iType, u_int lArrays, void *pVntValue)
 
BCAP_HRESULT bCap_VariableRelease (int iSockFd, u_int lhVar)
 
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_PACKETPacket_Create (u_int lFuncID)
 
static BCAP_HRESULT Packet_Deserialize (void *pBinData, BCAP_PACKET *pPacket)
 
static BCAP_ARG ** Packet_GetLastArgHandle (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_charreceivePacket (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

int failed_to_send_packet = 0
 
static u_short m_iSerialNo = 1
 
static long m_lAllocCount = 0
 
static long m_lAllocSize = 0
 

Detailed Description

b-CAP client library

Version
1.2
Date
2012/12/10
Author
DENSO WAVE (y)

Definition in file b-Cap.c.

Macro Definition Documentation

#define __LITTLE_ENDIAN__

Definition at line 50 of file b-Cap.c.

#define BCAP_EOT   0x04 /* size of packet terminater(EOT) */

Definition at line 80 of file b-Cap.c.

#define BCAP_FUNC_Controller_Connect   3

Definition at line 113 of file b-Cap.c.

#define BCAP_FUNC_Controller_Disconnect   4

Definition at line 114 of file b-Cap.c.

#define BCAP_FUNC_Controller_Execute   17

Definition at line 118 of file b-Cap.c.

#define BCAP_FUNC_Controller_GetRobot   7

Definition at line 115 of file b-Cap.c.

#define BCAP_FUNC_Controller_GetTask   8

Definition at line 116 of file b-Cap.c.

#define BCAP_FUNC_Controller_GetVariable   9

Definition at line 117 of file b-Cap.c.

#define BCAP_FUNC_Robot_Change   66

Definition at line 122 of file b-Cap.c.

#define BCAP_FUNC_Robot_Execute   64

Definition at line 121 of file b-Cap.c.

#define BCAP_FUNC_Robot_GetVariable   62

Definition at line 120 of file b-Cap.c.

#define BCAP_FUNC_Robot_Move   72

Definition at line 123 of file b-Cap.c.

#define BCAP_FUNC_Robot_Release   84

Definition at line 124 of file b-Cap.c.

#define BCAP_FUNC_Service_Start   1

Definition at line 111 of file b-Cap.c.

#define BCAP_FUNC_Service_Stop   2

Definition at line 112 of file b-Cap.c.

#define BCAP_FUNC_Task_GetVariable   85

Definition at line 126 of file b-Cap.c.

#define BCAP_FUNC_Task_Release   99

Definition at line 129 of file b-Cap.c.

#define BCAP_FUNC_Task_Start   88

Definition at line 127 of file b-Cap.c.

#define BCAP_FUNC_Task_Stop   89

Definition at line 128 of file b-Cap.c.

#define BCAP_FUNC_Variable_GetValue   101

Definition at line 132 of file b-Cap.c.

#define BCAP_FUNC_Variable_PutValue   102

Definition at line 133 of file b-Cap.c.

#define BCAP_FUNC_Variable_PutValue   102

Definition at line 133 of file b-Cap.c.

#define BCAP_FUNC_Variable_Release   111

Definition at line 134 of file b-Cap.c.

#define BCAP_MAX_ARG_SIZE   0x1000000 /* max arg size (bytes) */

Definition at line 107 of file b-Cap.c.

#define BCAP_MAX_PACKET_SIZE   0x1000000 /* max packet size (bytes) */

Definition at line 106 of file b-Cap.c.

#define BCAP_SIZE_ARGARRAYS   4 /* size of arrays */

Definition at line 100 of file b-Cap.c.

#define BCAP_SIZE_ARGBASE   (BCAP_SIZE_ARGLEN+BCAP_SIZE_ARGTYPE+BCAP_SIZE_ARGARRAYS)

Definition at line 101 of file b-Cap.c.

#define BCAP_SIZE_ARGLEN   4 /* size of length */

Definition at line 98 of file b-Cap.c.

#define BCAP_SIZE_ARGNUM   2 /* size of Args */

Definition at line 87 of file b-Cap.c.

#define BCAP_SIZE_ARGSTRLEN   4 /* size of string length */

Definition at line 103 of file b-Cap.c.

#define BCAP_SIZE_ARGTYPE   2 /* size of type */

Definition at line 99 of file b-Cap.c.

#define BCAP_SIZE_BASE
Value:
#define BCAP_SIZE_EOT
Definition: b-Cap.c:82
#define BCAP_SIZE_LEN
Definition: b-Cap.c:83
#define BCAP_SIZE_RESERVE
Definition: b-Cap.c:85
#define BCAP_SIZE_FUNCID
Definition: b-Cap.c:86
#define BCAP_SIZE_ARGNUM
Definition: b-Cap.c:87
#define BCAP_SIZE_SERIAL
Definition: b-Cap.c:84
#define BCAP_SIZE_SOH
Definition: b-Cap.c:81

Definition at line 91 of file b-Cap.c.

#define BCAP_SIZE_CRC   2 /* size of CRC */

Definition at line 88 of file b-Cap.c.

#define BCAP_SIZE_EOT   1 /* size of terminater(EOT) */

Definition at line 82 of file b-Cap.c.

#define BCAP_SIZE_FUNCID   4 /* size of FunctionID */

Definition at line 86 of file b-Cap.c.

#define BCAP_SIZE_LEN   4 /* size of message size */

Definition at line 83 of file b-Cap.c.

#define BCAP_SIZE_RESERVE   2 /* size of reserved */

Definition at line 85 of file b-Cap.c.

#define BCAP_SIZE_SERIAL   2 /* size of serial number */

Definition at line 84 of file b-Cap.c.

#define BCAP_SIZE_SOH   1 /* size of header(SOH) */

Definition at line 81 of file b-Cap.c.

#define BCAP_SOH   0x01 /* size of packet header(SOH) */

Definition at line 79 of file b-Cap.c.

#define DebugPrint (   message)

Definition at line 65 of file b-Cap.c.

#define DebugPrint2 (   f,
  a,
 
)

Definition at line 66 of file b-Cap.c.

#define LOCALBUFFER_SZ   1024

Definition at line 73 of file b-Cap.c.

#define LOCALRECBUFFER_SZ   1024

Definition at line 75 of file b-Cap.c.

Typedef Documentation

typedef struct BCAP_ARG BCAP_ARG
typedef struct BCAP_PACKET BCAP_PACKET

Function Documentation

static BCAP_ARG * Arg_Create ( u_short  iType,
u_int  lArrays,
u_int  lDataSize,
void *  data 
)
static

Arg_Create

Create and allocate b-Cap argument structure

 @param  iType           :       [in]  Variable type
 @param  lArrays         :       [in]  Arrays
 @param  lDataSize       :       [in]  total byte of ( "*data" ) 
 @param   *data          :       [in]  value pointer
 @retval allocated pointer is returned

 @detail Note:When BSTR is used, *data must be store "Length:4byte" + "DoubleByte String"
                                 See alose function CopyToBSTR().

Definition at line 2515 of file b-Cap.c.

static void Arg_Release ( BCAP_ARG pArg)
static

Arg_Release

Release all args in recursive

Parameters
*pArg: [in] Arg pointer
Return values
void

Definition at line 2562 of file b-Cap.c.

BCAP_HRESULT bCap_Close ( int  iSockFd)

Close socket

Close socket

 @param  iSockFd :       [in]  Socket descriptor
 @retval BCAP_HRESULT

Definition at line 359 of file b-Cap.c.

BCAP_HRESULT bCap_ControllerConnect ( int  iSockFd,
char *  pStrCtrlname,
char *  pStrProvName,
char *  pStrPcName,
char *  pStrOption,
u_int plhController 
)

Controller_Connect

Controller_Connect

 @param  iSockFd                 :       [in]  Socket descriptor
 @param  pStrCtrlname    :       [in]  CtrlName in AsciiZ
 @param  pStrProvName    :       [in]  ProvName in AsciiZ 
 @param  pStrPcName              :       [in]  PCName in AsciiZ
 @param  pStrOption              :       [in]  Option string in AsciiZ
 @param  plhController   :       [out]  handle of the controller that returned from the robot controller.
 @retval BCAP_HRESULT

Definition at line 467 of file b-Cap.c.

BCAP_HRESULT bCap_ControllerDisconnect ( int  iSockFd,
u_int  lhController 
)

Disconnect b-Cap

Controller_Disconnect

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhController            :       [in]  controller handle to disconnect
 @retval BCAP_HRESULT

Definition at line 542 of file b-Cap.c.

BCAP_HRESULT bCap_ControllerExecute ( int  iSockFd,
u_int  lhController,
char *  pStrCommand,
char *  pStrOption,
void *  pResult 
)

Controller_Execute

Controller_Execute

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhController            :       [in]  controller handle
 @param  pStrCommand             :       [in]  command string in AsciiZ
 @param  pstrOption              :       [in]  option string in AsciiZ
 @param  *pResult                :       [out]  value stored pointer
 @retval BCAP_HRESULT
 @detail Note:    This function write value into *pResult,
                                 So, Client program must allocate enough memory as *pResult.

Definition at line 800 of file b-Cap.c.

BCAP_HRESULT bCap_ControllerExecute2 ( int  iSockFd,
u_int  lhController,
char *  pStrCommand,
BCAP_VARIANT pVntOption,
BCAP_VARIANT pVntResult 
)

Controller_Execute

Controller_Execute with a variant option

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhController            :       [in]  controller handle
 @param  pStrCommand             :       [in]  command string in AsciiZ
 @param  iOption                 :       [in]  option value in Integer(VT_I2)
 @param  plResult                :       [out]  result value
 @retval BCAP_HRESULT

Definition at line 867 of file b-Cap.c.

BCAP_HRESULT bCap_ControllerGetRobot ( int  iSockFd,
u_int  lhController,
char *  pStrRobotName,
char *  pStrOption,
u_int plhRobot 
)

Controller_GetRobot

Controller_GetRobot

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhController            :       [in]  controller handle
 @param  pStrRobotName           :       [in]  Robot name string in AsciiZ
 @param  pStrOption                      :       [in]  Option string in AsciiZ
 @param  lhRobot                         :       [out]  robot handle 
 @retval BCAP_HRESULT

Definition at line 587 of file b-Cap.c.

BCAP_HRESULT bCap_ControllerGetTask ( int  iSockFd,
u_int  lhController,
char *  pTskName,
char *  pstrOption,
u_int plhVar 
)

Controller_GetTask

Controller_GetTask

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhController            :       [in]  controller handle
 @param  pTskName                :       [in]  task name string in AsciiZ
 @param  pstrOption              :       [in]  option string in AsciiZ
 @param  plhVar          :       [out]  task handle
 @retval BCAP_HRESULT

Definition at line 726 of file b-Cap.c.

BCAP_HRESULT bCap_ControllerGetVariable ( int  iSockFd,
u_int  lhController,
char *  pVarName,
char *  pstrOption,
u_int plhVar 
)

Controller_GetVariable

Controller_GetVariable

 @param  iSockFd                 :       [in]  Socket descriptor
 @param  lhController    :       [in]  controller handle 
 @param  pVarName                :       [in]  Variable name string in AsciiZ
 @param  pstrOption              :       [in]  Option string in AsciiZ
 @param  plhVar                  :       [out]  variable handle 
 @retval BCAP_HRESULT

Definition at line 655 of file b-Cap.c.

BCAP_HRESULT bCap_Open ( const char *  pIPStr,
int  iPort,
int *  iSockFd 
)

Init and Open socket

Init and Open socket

 @param  iSockFd :       [in]  Socket descriptor
 @retval BCAP_HRESULT

Definition at line 225 of file b-Cap.c.

BCAP_HRESULT bCap_RobotChange ( int  iSockFd,
u_int  lhRobot,
char *  pStrCommand 
)

Robot_Change

Robot_Change

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhRobot         :       [in]  robot handle
 @param  pStrCommand             :       [in]  command string in AsciiZ
 @param  pstrOption              :       [in]  option string in AsciiZ
 @param  plhVar          :       [out]  result value
 @retval BCAP_HRESULT

Definition at line 1194 of file b-Cap.c.

BCAP_HRESULT bCap_RobotExecute ( int  iSockFd,
u_int  lhRobot,
char *  pStrCommand,
char *  pStrOption,
void *  pResult 
)

Robot_Execute

Robot_Execute

 @param  iSockFd                 :       [in]  Socket descriptor
 @param  lhRobot                 :       [in]  robot handle
 @param  pStrCommand             :       [in]  command string in AsciiZ
 @param  pstrOption              :       [in]  option string in AsciiZ
 @param  *pResult                :       [out]  value stored pointer
 @retval BCAP_HRESULT
 @detail Note:    This function write value into *pResult,
                                 So, Client program must allocate enough memory as *pResult.

Definition at line 1054 of file b-Cap.c.

BCAP_HRESULT bCap_RobotExecute2 ( int  iSockFd,
u_int  lhRobot,
char *  pStrCommand,
BCAP_VARIANT pVntOption,
BCAP_VARIANT pVntResult 
)

Robot_Execute

Robot_Execute with a variant option

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhRobot         :       [in]  robot handle
 @param  pStrCommand             :       [in]  command string in AsciiZ
 @param  iOption                 :       [in]  option value in Integer(VT_I2)
 @param  plResult                :       [out]  result value
 @retval BCAP_HRESULT

Definition at line 1121 of file b-Cap.c.

BCAP_HRESULT bCap_RobotExecuteSlaveMove ( int  iSockFd,
u_int  lhRobot,
char *  pStrCommand,
float *  pfOption,
void *  pResult 
)

Robot_Execute for SlaveMove

Robot_Execute

 @param  iSockFd                 :       [in]  Socket descriptor
 @param  lhRobot                 :       [in]  robot handle
 @param  pStrCommand             :       [in]  command string in AsciiZ
 @param  pstrOption              :       [in]  option string in AsciiZ
 @param  *pResult                :       [out]  value stored pointer
 @retval BCAP_HRESULT
 @detail Note:    This function write value into *pResult,
                                 So, Client program must allocate enough memory as *pResult.

Definition at line 1327 of file b-Cap.c.

BCAP_HRESULT bCap_RobotGetVariable ( int  iSockFd,
u_int  lhRobot,
char *  pVarName,
char *  pstrOption,
u_int plhVar 
)

Robot_GetVariable

Robot_GetVariable

 @param  iSockFd                 :       [in]  Socket descriptor
 @param  lhRobot                 :       [in]  robot handle
 @param  pVarName                :       [in]  Variable name string in AsciiZ
 @param  pstrOption              :       [in]  Option string in AsciiZ
 @param  plhVar                  :       [out]  result value = variable handle
 @retval BCAP_HRESULT

Definition at line 982 of file b-Cap.c.

BCAP_HRESULT bCap_RobotMove ( int  iSockFd,
u_int  lhRobot,
long  lComp,
char *  pStrPose,
char *  pStrOption 
)

Robot_Move

Robot_Move

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhRobot         :       [in]  robot handle
 @param  lComp           :       [in]  completion parameter
 @param  pStrPose                :       [in]  Pose string in AsciiZ
 @param  pstrOption              :       [in]  Option string in AsciiZ
 @retval BCAP_HRESULT

Definition at line 1252 of file b-Cap.c.

BCAP_HRESULT bCap_RobotRelease ( int  iSockFd,
u_int  lhRobot 
)

Robot_Release

Robot_Release

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhRobot         :       [in]  robot handle
 @retval BCAP_HRESULT

Definition at line 936 of file b-Cap.c.

BCAP_HRESULT bCap_ServiceStart ( int  iSockFd)

Start b-Cap service

Start b-Cap servic

 @param  iSockFd :       [in]  Socket descriptor
 @retval BCAP_HRESULT

Definition at line 396 of file b-Cap.c.

BCAP_HRESULT bCap_ServiceStop ( int  iSockFd)

Stop b-Cap service

Stop b-Cap service

 @param  iSockFd :       [in]  Socket descriptor
 @retval BCAP_HRESULT

Definition at line 428 of file b-Cap.c.

BCAP_HRESULT bCap_TaskGetVariable ( int  iSockFd,
u_int  lhTask,
char *  pVarName,
char *  pstrOption,
u_int plhVar 
)

Task_GetVariable

Task_GetVariable

 @param  iSockFd                 :       [in]  Socket descriptor
 @param  lhTask                  :       [in]  task handle
 @param  pVarName                :       [in]  Variable name string in AsciiZ
 @param  pstrOption              :       [in]  Option string in AsciiZ
 @param  plhVar                  :       [out]  result value = variable handle
 @retval BCAP_HRESULT

Definition at line 1434 of file b-Cap.c.

BCAP_HRESULT bCap_TaskRelease ( int  iSockFd,
u_int  lhTask 
)

Task_Release

Task_Release

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhTask          :       [in]  task handle
 @retval BCAP_HRESULT

Definition at line 1389 of file b-Cap.c.

BCAP_HRESULT bCap_TaskStart ( int  iSockFd,
u_int  lhTask,
long  lMode,
char *  pStrOption 
)

Task_Start

Task_Start

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhTask          :       [in]  task handle
 @param  lMode           :       [in]  start parameter
 @param  pstrOption              :       [in]  Option string in AsciiZ
 @retval BCAP_HRESULT

Definition at line 1503 of file b-Cap.c.

BCAP_HRESULT bCap_TaskStop ( int  iSockFd,
u_int  lhTask,
long  lMode,
char *  pStrOption 
)

Task_Stop

Task_Stop

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhTask          :       [in]  task handle
 @param  lMode           :       [in]  stop parameter
 @param  pstrOption              :       [in]  Option string in AsciiZ
 @retval BCAP_HRESULT

Definition at line 1569 of file b-Cap.c.

BCAP_HRESULT bCap_VariableGetValue ( int  iSockFd,
u_int  lhVar,
void *  pVntValue 
)

Variable_GetValue

Variable_GetValue

 @param  iSockFd                 :       [in]  Socket descriptor
 @param  lhVar                   :       [in]  robot handle
 @param  *pVntValue              :       [out]  value stored pointer
 @retval BCAP_HRESULT
 @detail Note:    This function write value into *pVntValue,
                                 So, Client program must allocate enough memory as *pVntValue.

Definition at line 1676 of file b-Cap.c.

BCAP_HRESULT bCap_VariablePutValue ( int  iSockFd,
u_int  lhVar,
u_short  iType,
u_int  lArrays,
void *  pVntValue 
)

Variable_PutValue

Variable_PutValue

 @param  iSockFd                 :       [in]  Socket descriptor
 @param  lhVar                   :       [in]  robot handle
 @param  iType                   :       [in]  variable type
 @param  lArrays                 :       [in]  array counter
 @param  *pVntValue              :       [in]  value stored pointer
 @retval BCAP_HRESULT

Definition at line 1727 of file b-Cap.c.

BCAP_HRESULT bCap_VariableRelease ( int  iSockFd,
u_int  lhVar 
)

Variable_Release

Variable_Release

 @param  iSockFd :       [in]  Socket descriptor
 @param  lhVariable              :       [in]  variable handle
 @retval BCAP_HRESULT

Definition at line 1633 of file b-Cap.c.

static BCAP_HRESULT bCapSendAndRec ( int  iSockFd,
BCAP_PACKET pSndPacket,
BCAP_PACKET pRecPacket 
)
static

Definition at line 1825 of file b-Cap.c.

static void bFree ( void *  pPtr)
static

Definition at line 2901 of file b-Cap.c.

static void * bMalloc ( size_t  size)
static

Definition at line 2882 of file b-Cap.c.

static u_int copyFromBSTR ( void *  pDstAsciiPtr,
void *  pSrcBstrPtr 
)
static

Convert From BSTR into AsciiZ

Convert Send a b-Cap packet and Receive a Packet

 @param  pDstPtr         :       [out]  String pointer in AsciiZ
 @param  pSrcPtr         :       [in]  BSTR pointer
 @retval total size of BSTR is returned.

Definition at line 2717 of file b-Cap.c.

u_int copyToBSTR ( void *  pDstBstrPtr,
void *  pSrcAsciiPtr 
)
static

Convert into BSTR from AsciiZ

Convert Send a b-Cap packet and Receive a Packet

 @param  pDstPtr :       [out]  BSTR pointer
 @param  pSrcPtr         :       [in]  String pointer in AsciiZ
 @retval total size of BSTR is returned.

Definition at line 2687 of file b-Cap.c.

static u_int copyValue ( void *  pDst,
void *  pVntValue,
u_int  lLength 
)
static

Copy Arg Value to a pointer

Copy Arg value to a destination pointer

 @param  pDstPtr         :       [out]  Destination pointer
 @param  pSrcPtr         :       [in]  Source Arg pointer
 @retval total size of BSTR is returned.

Definition at line 2845 of file b-Cap.c.

static u_int copyVariantFromArg ( BCAP_VARIANT pVntDst,
BCAP_ARG pArg 
)
static

Copy Arg Value to a pointer

Copy Arg value to a destination pointer

 @param  pVntDst         :       [out]  Destination BCAP_VARIANT pointer
 @param  pSrcPtr         :       [in]  Source Arg pointer
 @retval total size of BSTR is returned.

Definition at line 2751 of file b-Cap.c.

static BCAP_HRESULT Packet_AddArg ( BCAP_PACKET pPacket,
BCAP_ARG pNewArg 
)
static

Packet_AddArg

Add the arg into the packet

 @param  *pPacket        :       [in]  Packet pointer .
 @param  *pNewArg        :       [in]  Arg pointer should be added into pPacket.
 @retval BCAP_HRESULT is returned.

Definition at line 2145 of file b-Cap.c.

static BCAP_PACKET * Packet_Create ( u_int  lFuncID)
static

Packet_Create

Create and allocate new packet structure.

 @param  lFuncID         :       [in]  Function ID.
 @retval New packet pointer is returned.

Definition at line 2206 of file b-Cap.c.

static BCAP_HRESULT Packet_Deserialize ( void *  pSrcBinData,
BCAP_PACKET pDstPacket 
)
static

Deserialize from byte array into packet.

Change from byte arrays into struct.

 @param  *pSrcBinData            :       [in]  Byte pointer to send.
 @param  *pDstPacket                     :       [out]  packet pointer to store
 @retval BCAP_HRESULT is returned.
 @detail bin  ---> struct
                 Note:   If something wrong, then release this packet and included args.

Definition at line 2370 of file b-Cap.c.

static BCAP_ARG** Packet_GetLastArgHandle ( BCAP_PACKET pPacket)
static

Packet_GetLastArgHandle

Get last argument pointer in the packet

 @param  *pPacket        :       [in]  packet pointer
 @retval The last arg pointer is returned.

Definition at line 2109 of file b-Cap.c.

BCAP_HRESULT Packet_GetResult ( BCAP_PACKET pRecPacket,
void *  pResult 
)
static

Packet_GetResult

Parameters
*pRecPacket: [in] Received packet
*pResult: [out] value stored pointer
Return values
BCAP_HRESULTNote: This function write value into *pResult, So, Client program must allocate enough memory as *pResult.

Definition at line 2456 of file b-Cap.c.

static void Packet_Release ( BCAP_PACKET pPacket)
static

Packet_Release

Release packet and all args in recursive.

 @param  *pPacket        :       [in]  Packet pointer .
 @retval void

Definition at line 2185 of file b-Cap.c.

static BCAP_HRESULT Packet_Send ( int  iSockFd,
BCAP_PACKET pPacket 
)
static

Send b-Cap packet

Convert Send a b-Cap packet and Receive a Packet

 @param  iSd     :       [in]  Socket descriptor
 @param  pPacket         :       [in]  bCap packet data to send
 @retval BCAP_HRESULT is returned.

Definition at line 2079 of file b-Cap.c.

static BCAP_HRESULT Packet_Serialize ( BCAP_PACKET pSrcPacket,
void *  pDstBinData 
)
static

Serialize from packet into byte arrays.

Change from struct into binary array.

 @param  *pSrcPacket             :       [in]  Packet pointer to send.
 @param  *pDstBinData            :       [out]  byte pointer to store packet
 @retval BCAP_HRESULT is returned.

Definition at line 2244 of file b-Cap.c.

static u_char * receivePacket ( int  iSockFd,
int *  retryp 
)
static

Receive bCap Packet

Receive bCap Packet from server

 @retval u_char pointer storing recieved packet 
 @detail Note:   If valid pointer is returned, this function allocate memory for sotring packet.
                                 Never forget to free() the pointer.
                                 And If NULL pointer is returned , then was allocation error/

Definition at line 1893 of file b-Cap.c.

static BCAP_HRESULT sendBinary ( int  iSockFd,
u_char pBuff,
u_int  lSize 
)
static

Send bCap Packet

Send bCap Packet to server

@param  pRecPacket      :       [out]  Received packet pointer
@retval u_char pointer storing recieved packet 
                Note:   If valid pointer is returned, this function allocate memory for sotring packet.
                                Never forget to free() the pointer.
                                And If NULL pointer is returned , then was allocation error/

Definition at line 2036 of file b-Cap.c.

static u_int sizeOfVariant ( BCAP_VARIANT  vntValue)
static

get size of Variant

get size of Variant

Parameters
BCAP_VARIANT: [in] Variant Value
Return values
sizeof Variant(bytes) Note 1: If (iType = VT_BSTR), then this function returns BCAP_SIZE_ARGSTRLEN (= 4 bytes) Note 2: Not support VT_VARIANT,VT_EMPTY,VT_NULL,VT_ERROR,VT_CY,VT_DATE

Definition at line 2589 of file b-Cap.c.

static u_int sizeOfVarType ( u_short  iType)
static

get size of variable

get size of variable

Parameters
iType: [in] Variable type
Return values
sizeof variable. Note 1: If (iType = VT_BSTR), then this function returns BCAP_SIZE_ARGSTRLEN (= 4 bytes) Note 2: Not support VT_VARIANT,VT_EMPTY,VT_NULL,VT_ERROR,VT_CY,VT_DATE

Definition at line 2629 of file b-Cap.c.

Variable Documentation

int failed_to_send_packet = 0

Send and Receive bCap Packet

Send a b-Cap packet and Receive a Packet

 @param  pSndPacket              :       [in]  Send packet pointer
 @param  pRecPacket              :       [out]  Received packet pointer
 @retval BCAP_HRESULT

Definition at line 1824 of file b-Cap.c.

u_short m_iSerialNo = 1
static

Definition at line 206 of file b-Cap.c.

long m_lAllocCount = 0
static

Definition at line 2876 of file b-Cap.c.

long m_lAllocSize = 0
static

Definition at line 2877 of file b-Cap.c.



denso_ros_control
Author(s):
autogenerated on Mon Jun 10 2019 13:13:14