b-Cap.h
Go to the documentation of this file.
00001 
00011 /*
00012 [NOTES]
00013  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.
00014 */
00015 
00016 #ifdef __cplusplus
00017 extern "C"{
00018 #endif
00019 
00020 
00021 #ifndef B_CAP_H
00022 #define B_CAP_H
00023 
00024 /*#define       BCAP_CONNECTION_TCP             TCP/IP (DEFAULT if BCAP_CONNECTION_XXX is not defined.) */ 
00025 /*#define       BCAP_CONNECTION_UDP             UDP/IP */ 
00026 /*#define       BCAP_CONNECTION_COM             COM(Serial device) */ 
00027 #if WIN32
00028 #define SERIAL_BAUDRATE         115200
00029 #else
00030 #define SERIAL_BAUDRATE         0x0000f /*B38400*/
00031 #endif
00032 
00036 typedef enum BCAP_HRESULT {             
00037 
00038         BCAP_S_OK                               = 0                     ,       /*      OK                                                      */
00039         BCAP_E_NOTIMPL                  = 0x80004001,   /*      Not implemented function is called      */
00040         BCAP_E_ABORT                    = 0x80004004,   /*      Function aborted                        */
00041         BCAP_E_FAIL                             = 0x80004005,   /*      Function failed                         */
00042         BCAP_E_UNEXPECTED               = 0x8000FFFF,   /*      Fatal Error occurred            */
00043         BCAP_E_INVALIDRCVPACKET = 0x80010001,   /*      Invalid packet is received. */
00044                                                                                         /* When this error is occurred, robot controller disconnect from client immediately.*/
00045                                                                                         /* Please make sure the packet that you sent. */
00046 
00047         BCAP_E_INVALIDSNDPACKET = 0x80010002,   /*      Invalid packet is sent          */
00048         BCAP_E_INVALIDARGTYPE   = 0x80010003,   /*      Invalid argument type           */
00049         BCAP_E_ROBOTISBUSY              = 0x80010004,   /*      Robot is busy (Wait for a while)        */
00050         BCAP_E_INVALIDCOMMAND   = 0x80010005,   /*      Invalid command string is received      */
00051 
00052         BCAP_E_PACKETSIZEOVER   = 0x80010011,   /*      Received packet size over ( > 16Mbytes) */
00053 
00054         BCAP_E_ARGSIZEOVER              = 0x80010012,   /*      An argument siez over of the received packet. ( > 16Mbytes) */
00055         BCAP_E_ACCESSDENIED             = 0x80070005,   /*      Access denied                           */
00056         BCAP_E_HANDLE                   = 0x80070006,   /*      Invalid handle                          */
00057         BCAP_E_OUTOFMEMORY              = 0x8007000E,   /*      Out of memory                           */
00058         BCAP_E_INVALIDARG               = 0x80070057,   /*      Invalid argument                        */
00059         BCAP_E_BUF_FULL                 = 0x83201483    /* buffer full */
00060 
00061 } BCAP_HRESULT;
00062 
00063 
00064  
00065 /* b-CAP Type id */
00066 #define VT_EMPTY                                0                       /* (0Byte) */
00067 #define VT_NULL                                 1                       /* (0Byte) */
00068 #define VT_ERROR                                10                      /* (2Byte) */
00069 #define VT_UI1                                  17                      /* (1Byte) */
00070 #define VT_I2                                   2                       /* (2Byte) */
00071 #define VT_UI2                                  18                      /* (2Byte) */
00072 #define VT_I4                                   3                       /* (4Byte) */
00073 #define VT_UI4                                  19                      /* (4Byte) */
00074 #define VT_R4                                   4                       /* (4Byte) */
00075 #define VT_R8                                   5                       /* (8Byte) */
00076 #define VT_CY                                   6                       /* (8Byte) */
00077 #define VT_DATE                                 7                       /* (8Byte) */
00078 #define VT_BOOL                                 11                      /* (2Byte) */
00079 #define VT_BSTR                                 8                       /* (ascii string length *2 + 4 Byte) */
00080                                                                                         /* Double bytes per character */
00081 #define VT_VARIANT                              12                      /* Variant */
00082 #define VT_ARRAY                                0x2000          /* Array */
00083 
00084 
00085 /* b-CAP Utility macros */
00086 #ifndef SUCCEEDED
00087 #define SUCCEEDED(Status) ((int)(Status) >= 0)
00088 #endif
00089 
00090 #ifndef FAILED
00091 #define FAILED(Status) ((int)(Status) < 0)
00092 #endif
00093 
00094 /* b-CAP standard types */
00095 #ifndef u_char
00096 typedef unsigned char u_char;
00097 #endif
00098 #ifndef u_short
00099 typedef unsigned short u_short;
00100 #endif
00101 #ifndef u_int
00102 typedef unsigned int u_int;
00103 #endif
00104 
00105 
00106 /*  b-CAP Variant Parameter */
00107 typedef struct  {       
00108         u_short Type;                                                   /* b-CAP Type id */
00109         u_int   Arrays;                                                 /* Array count, must be >= 1 */
00110         union {
00111                 u_char  CharValue; 
00112                 u_short ShortValue; 
00113                 u_int   LongValue;
00114                 float   FloatValue;
00115                 double  DoubleValue;
00116 
00117                 u_char  String[40 + 1]; 
00118                 float   FloatArray[16];
00119                 double  DoubleArray[16];
00120 
00121                 // void *Data;                                          /* When the Type is VT_Array, Value is stored in *Data */
00122                                                                                         /* The client program must allocate memorys and set the pointer to *Data.  */
00123         } Value;
00124 } BCAP_VARIANT;
00125 
00126 /* b-CAP Functions */
00127 BCAP_HRESULT    bCap_Open(const char *pIPStr, int iPort, int *piSockFd);
00128 BCAP_HRESULT    bCap_Close(int iSockFd);
00129 
00130 BCAP_HRESULT    bCap_ServiceStart(int iSockFd);
00131 BCAP_HRESULT    bCap_ServiceStop(int iSockFd);
00132 
00133 /* b-CAP Controller Functions */
00134 BCAP_HRESULT    bCap_ControllerConnect(int iSockFd,char *pStrCtrlname, char *pStrProvName, char *pStrPcName, char *pStrOption, u_int *plhController);
00135 BCAP_HRESULT    bCap_ControllerDisconnect(int iSockFd, u_int lhController);
00136 
00137 BCAP_HRESULT    bCap_ControllerGetRobot(int iSockFd, u_int lhController, char *pStrRobotName, char *pStrOption, u_int *lhRobot);
00138 BCAP_HRESULT    bCap_ControllerGetVariable(int iSockFd, u_int lhController, char *pVarName, char *pstrOption, u_int *plhVar);
00139 BCAP_HRESULT    bCap_ControllerGetTask(int iSockFd, u_int lhController, char *pTskName, char *pstrOption, u_int *plhVar);
00140 BCAP_HRESULT    bCap_ControllerExecute(int iSockFd, u_int lhController, char *pStrCommand, char *pStrOption, void *plResult);
00141 BCAP_HRESULT    bCap_ControllerExecute2(int iSockFd, u_int lhController, char *pStrCommand, BCAP_VARIANT *pVntOption, BCAP_VARIANT *pvntResult);
00142 
00143 /* b-CAP Robot Functions */
00144 BCAP_HRESULT    bCap_RobotRelease(int iSockFd, u_int lhRobot);
00145 BCAP_HRESULT    bCap_RobotGetVariable(int iSockFd, u_int lhRobot, char *pVarName, char *pStrOption, u_int *lhVarCurJnt);
00146 BCAP_HRESULT    bCap_RobotExecute(int iSockFd, u_int lhRobot, char *pStrCommand, char *pStrOption, void *plResult);
00147 BCAP_HRESULT    bCap_RobotChange(int iSockFd, u_int lhRobot, char *pStrCommand);
00148 BCAP_HRESULT    bCap_RobotMove(int iSockFd, u_int lhRobot, long lComp, char *pStrPose, char *pStrOption);
00149 BCAP_HRESULT    bCap_RobotExecuteSlaveMove(int iSockFd, u_int lhRobot, char *pStrCommand, float *pfOption, void *pResult);
00150 BCAP_HRESULT    bCap_RobotExecute2(int iSockFd, u_int lhRobot, char *pStrCommand, BCAP_VARIANT *pVntOption, BCAP_VARIANT *pvntResult);
00151 
00152 /* b-CAP Task Functions */
00153 BCAP_HRESULT    bCap_TaskRelease(int iSockFd, u_int lhTask);
00154 BCAP_HRESULT    bCap_TaskGetVariable(int iSockFd, u_int lhTask, char *pVarName, char *pstrOption, u_int *plhVar);
00155 BCAP_HRESULT    bCap_TaskStart(int iSockFd, u_int lhTask, long lMode, char *pStrOption);
00156 BCAP_HRESULT    bCap_TaskStop(int iSockFd, u_int lhTask, long lMode, char *pStrOption);
00157 
00158 /* b-CAP Variable Functions */
00159 BCAP_HRESULT    bCap_VariableRelease(int iSockFd, u_int lhVar);
00160 BCAP_HRESULT    bCap_VariableGetValue(int iSockFd, u_int lhVar, void *pVntValue);
00161 BCAP_HRESULT    bCap_VariablePutValue(int iSockFd, u_int lhVar, u_short iType, u_int lArrays, void  *pVntValue);
00162 
00163 #endif
00164 
00165 #ifdef __cplusplus
00166 }
00167 #endif


denso_controller
Author(s): Ryohei Ueda
autogenerated on Wed Aug 26 2015 11:21:21