b-Cap.h
Go to the documentation of this file.
1 
11 /*
12 [NOTES]
13  This is a sample source code. Copy and modify this code in accordance with a device and a device version. Especially please note timeout and timeout-retry settings.
14 */
15 
16 #pragma pack(push,1) // for BCAP_VARIANT members alignment
17 #ifdef __cplusplus
18 extern "C"{
19 #endif
20 
21 
22 #ifndef B_CAP_H
23 #define B_CAP_H
24 
25 /*#define BCAP_CONNECTION_TCP TCP/IP (DEFAULT if BCAP_CONNECTION_XXX is not defined.) */
26 /*#define BCAP_CONNECTION_UDP UDP/IP */
27 /*#define BCAP_CONNECTION_COM COM(Serial device) */
28 #define BCAP_CONNECTION_UDP
29 #if WIN32
30 #define SERIAL_BAUDRATE 115200
31 #else
32 #define SERIAL_BAUDRATE 0x0000f /*B38400*/
33 #endif
34 
38 typedef enum BCAP_HRESULT {
39 
40  BCAP_S_OK = 0 , /* OK */
41  BCAP_E_NOTIMPL = 0x80004001, /* Not implemented function is called */
42  BCAP_E_ABORT = 0x80004004, /* Function aborted */
43  BCAP_E_FAIL = 0x80004005, /* Function failed */
44  BCAP_E_UNEXPECTED = 0x8000FFFF, /* Fatal Error occurred */
45  BCAP_E_INVALIDRCVPACKET = 0x80010001, /* Invalid packet is received. */
46  /* When this error is occurred, robot controller disconnect from client immediately.*/
47  /* Please make sure the packet that you sent. */
48 
49  BCAP_E_INVALIDSNDPACKET = 0x80010002, /* Invalid packet is sent */
50  BCAP_E_INVALIDARGTYPE = 0x80010003, /* Invalid argument type */
51  BCAP_E_ROBOTISBUSY = 0x80010004, /* Robot is busy (Wait for a while) */
52  BCAP_E_INVALIDCOMMAND = 0x80010005, /* Invalid command string is received */
53 
54  BCAP_E_PACKETSIZEOVER = 0x80010011, /* Received packet size over ( > 16Mbytes) */
55 
56  BCAP_E_ARGSIZEOVER = 0x80010012, /* An argument siez over of the received packet. ( > 16Mbytes) */
57  BCAP_E_ACCESSDENIED = 0x80070005, /* Access denied */
58  BCAP_E_HANDLE = 0x80070006, /* Invalid handle */
59  BCAP_E_OUTOFMEMORY = 0x8007000E, /* Out of memory */
60  BCAP_E_INVALIDARG = 0x80070057, /* Invalid argument */
61  BCAP_E_BUF_FULL = 0x83201483 /* buffer full */
62 
63 } BCAP_HRESULT;
64 
65 
66 
67 /* b-CAP Type id */
68 #define VT_EMPTY 0 /* (0Byte) */
69 #define VT_NULL 1 /* (0Byte) */
70 #define VT_ERROR 10 /* (2Byte) */
71 #define VT_UI1 17 /* (1Byte) */
72 #define VT_I2 2 /* (2Byte) */
73 #define VT_UI2 18 /* (2Byte) */
74 #define VT_I4 3 /* (4Byte) */
75 #define VT_UI4 19 /* (4Byte) */
76 #define VT_R4 4 /* (4Byte) */
77 #define VT_R8 5 /* (8Byte) */
78 #define VT_CY 6 /* (8Byte) */
79 #define VT_DATE 7 /* (8Byte) */
80 #define VT_BOOL 11 /* (2Byte) */
81 #define VT_BSTR 8 /* (ascii string length *2 + 4 Byte) */
82  /* Double bytes per character */
83 #define VT_VARIANT 12 /* Variant */
84 #define VT_ARRAY 0x2000 /* Array */
85 
86 
87 /* b-CAP Utility macros */
88 #ifndef SUCCEEDED
89 #define SUCCEEDED(Status) ((int)(Status) >= 0)
90 #endif
91 
92 #ifndef FAILED
93 #define FAILED(Status) ((int)(Status) < 0)
94 #endif
95 
96 /* b-CAP standard types */
97 #ifndef u_char
98 typedef unsigned char u_char;
99 #endif
100 #ifndef u_short
101 typedef unsigned short u_short;
102 #endif
103 #ifndef u_int
104 typedef unsigned int u_int;
105 #endif
106 
107 
108 /* b-CAP Variant Parameter */
109 typedef struct {
110  u_short Type; /* b-CAP Type id */
111  u_int Arrays; /* Array count, must be >= 1 */
112  union {
113  u_char CharValue;
114  u_short ShortValue;
115  u_int LongValue;
116  float FloatValue;
117  double DoubleValue;
118 
119  u_char String[40 + 1];
120  float FloatArray[16];
121  double DoubleArray[16];
122 
123  // void *Data; /* When the Type is VT_Array, Value is stored in *Data */
124  /* The client program must allocate memorys and set the pointer to *Data. */
125  } Value;
126 } BCAP_VARIANT;
127 
128 /* b-CAP Functions */
129 BCAP_HRESULT bCap_Open(const char *pIPStr, int iPort, int *piSockFd);
130 BCAP_HRESULT bCap_Close(int iSockFd);
131 
132 BCAP_HRESULT bCap_ServiceStart(int iSockFd);
133 BCAP_HRESULT bCap_ServiceStop(int iSockFd);
134 
135 /* b-CAP Controller Functions */
136 BCAP_HRESULT bCap_ControllerConnect(int iSockFd,char *pStrCtrlname, char *pStrProvName, char *pStrPcName, char *pStrOption, u_int *plhController);
137 BCAP_HRESULT bCap_ControllerDisconnect(int iSockFd, u_int lhController);
138 
139 BCAP_HRESULT bCap_ControllerGetRobot(int iSockFd, u_int lhController, char *pStrRobotName, char *pStrOption, u_int *lhRobot);
140 BCAP_HRESULT bCap_ControllerGetVariable(int iSockFd, u_int lhController, char *pVarName, char *pstrOption, u_int *plhVar);
141 BCAP_HRESULT bCap_ControllerGetTask(int iSockFd, u_int lhController, char *pTskName, char *pstrOption, u_int *plhVar);
142 BCAP_HRESULT bCap_ControllerExecute(int iSockFd, u_int lhController, char *pStrCommand, char *pStrOption, void *plResult);
143 BCAP_HRESULT bCap_ControllerExecute2(int iSockFd, u_int lhController, char *pStrCommand, BCAP_VARIANT *pVntOption, BCAP_VARIANT *pvntResult);
144 
145 /* b-CAP Robot Functions */
146 BCAP_HRESULT bCap_RobotRelease(int iSockFd, u_int lhRobot);
147 BCAP_HRESULT bCap_RobotGetVariable(int iSockFd, u_int lhRobot, char *pVarName, char *pStrOption, u_int *lhVarCurJnt);
148 BCAP_HRESULT bCap_RobotExecute(int iSockFd, u_int lhRobot, char *pStrCommand, char *pStrOption, void *plResult);
149 BCAP_HRESULT bCap_RobotChange(int iSockFd, u_int lhRobot, char *pStrCommand);
150 BCAP_HRESULT bCap_RobotMove(int iSockFd, u_int lhRobot, long lComp, char *pStrPose, char *pStrOption);
151 BCAP_HRESULT bCap_RobotExecuteSlaveMove(int iSockFd, u_int lhRobot, char *pStrCommand, float *pfOption, void *pResult);
152 BCAP_HRESULT bCap_RobotExecute2(int iSockFd, u_int lhRobot, char *pStrCommand, BCAP_VARIANT *pVntOption, BCAP_VARIANT *pvntResult);
153 
154 /* b-CAP Task Functions */
155 BCAP_HRESULT bCap_TaskRelease(int iSockFd, u_int lhTask);
156 BCAP_HRESULT bCap_TaskGetVariable(int iSockFd, u_int lhTask, char *pVarName, char *pstrOption, u_int *plhVar);
157 BCAP_HRESULT bCap_TaskStart(int iSockFd, u_int lhTask, long lMode, char *pStrOption);
158 BCAP_HRESULT bCap_TaskStop(int iSockFd, u_int lhTask, long lMode, char *pStrOption);
159 
160 /* b-CAP Variable Functions */
161 BCAP_HRESULT bCap_VariableRelease(int iSockFd, u_int lhVar);
162 BCAP_HRESULT bCap_VariableGetValue(int iSockFd, u_int lhVar, void *pVntValue);
163 BCAP_HRESULT bCap_VariablePutValue(int iSockFd, u_int lhVar, u_short iType, u_int lArrays, void *pVntValue);
164 
165 #endif
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 #pragma pack(pop)
BCAP_HRESULT bCap_RobotExecuteSlaveMove(int iSockFd, u_int lhRobot, char *pStrCommand, float *pfOption, void *pResult)
Definition: b-Cap.c:1327
float FloatValue
Definition: b-Cap.h:116
u_short ShortValue
Definition: b-Cap.h:114
u_int LongValue
Definition: b-Cap.h:115
BCAP_HRESULT bCap_ControllerGetVariable(int iSockFd, u_int lhController, char *pVarName, char *pstrOption, u_int *plhVar)
Definition: b-Cap.c:655
BCAP_HRESULT bCap_ServiceStart(int iSockFd)
Definition: b-Cap.c:396
BCAP_HRESULT
BCAP_HRESULT values.
Definition: b-Cap.h:38
u_short Type
Definition: b-Cap.h:110
unsigned int u_int
Definition: b-Cap.h:104
BCAP_HRESULT bCap_ControllerExecute2(int iSockFd, u_int lhController, char *pStrCommand, BCAP_VARIANT *pVntOption, BCAP_VARIANT *pvntResult)
Definition: b-Cap.c:867
BCAP_HRESULT bCap_RobotGetVariable(int iSockFd, u_int lhRobot, char *pVarName, char *pStrOption, u_int *lhVarCurJnt)
Definition: b-Cap.c:982
BCAP_HRESULT bCap_ControllerConnect(int iSockFd, char *pStrCtrlname, char *pStrProvName, char *pStrPcName, char *pStrOption, u_int *plhController)
Definition: b-Cap.c:467
BCAP_HRESULT bCap_ControllerExecute(int iSockFd, u_int lhController, char *pStrCommand, char *pStrOption, void *plResult)
Definition: b-Cap.c:800
BCAP_HRESULT bCap_TaskStart(int iSockFd, u_int lhTask, long lMode, char *pStrOption)
Definition: b-Cap.c:1503
BCAP_HRESULT bCap_VariableGetValue(int iSockFd, u_int lhVar, void *pVntValue)
Definition: b-Cap.c:1676
BCAP_HRESULT bCap_RobotChange(int iSockFd, u_int lhRobot, char *pStrCommand)
Definition: b-Cap.c:1194
unsigned short u_short
Definition: b-Cap.h:101
BCAP_HRESULT bCap_RobotExecute(int iSockFd, u_int lhRobot, char *pStrCommand, char *pStrOption, void *plResult)
Definition: b-Cap.c:1054
BCAP_HRESULT bCap_RobotExecute2(int iSockFd, u_int lhRobot, char *pStrCommand, BCAP_VARIANT *pVntOption, BCAP_VARIANT *pvntResult)
Definition: b-Cap.c:1121
BCAP_HRESULT bCap_ControllerDisconnect(int iSockFd, u_int lhController)
Definition: b-Cap.c:542
BCAP_HRESULT bCap_ControllerGetTask(int iSockFd, u_int lhController, char *pTskName, char *pstrOption, u_int *plhVar)
Definition: b-Cap.c:726
BCAP_HRESULT bCap_ControllerGetRobot(int iSockFd, u_int lhController, char *pStrRobotName, char *pStrOption, u_int *lhRobot)
Definition: b-Cap.c:587
BCAP_HRESULT bCap_VariablePutValue(int iSockFd, u_int lhVar, u_short iType, u_int lArrays, void *pVntValue)
Definition: b-Cap.c:1727
BCAP_HRESULT bCap_RobotRelease(int iSockFd, u_int lhRobot)
Definition: b-Cap.c:936
BCAP_HRESULT bCap_TaskRelease(int iSockFd, u_int lhTask)
Definition: b-Cap.c:1389
u_char CharValue
Definition: b-Cap.h:113
BCAP_HRESULT bCap_TaskStop(int iSockFd, u_int lhTask, long lMode, char *pStrOption)
Definition: b-Cap.c:1569
u_int Arrays
Definition: b-Cap.h:111
unsigned char u_char
Definition: b-Cap.h:98
BCAP_HRESULT bCap_Open(const char *pIPStr, int iPort, int *piSockFd)
Definition: b-Cap.c:225
BCAP_HRESULT bCap_VariableRelease(int iSockFd, u_int lhVar)
Definition: b-Cap.c:1633
BCAP_HRESULT bCap_TaskGetVariable(int iSockFd, u_int lhTask, char *pVarName, char *pstrOption, u_int *plhVar)
Definition: b-Cap.c:1434
double DoubleValue
Definition: b-Cap.h:117
BCAP_HRESULT bCap_ServiceStop(int iSockFd)
Definition: b-Cap.c:428
BCAP_HRESULT bCap_RobotMove(int iSockFd, u_int lhRobot, long lComp, char *pStrPose, char *pStrOption)
Definition: b-Cap.c:1252
BCAP_HRESULT bCap_Close(int iSockFd)
Definition: b-Cap.c:359


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