30 #if defined(_USE_WIN_API) 32 #pragma comment(lib, "wsock32.lib") 33 #elif defined(_USE_LINUX_API) 34 #include <arpa/inet.h> 54 #define _RETRY_MIN (1) 60 #define _RETRY_MAX (7) 128 unsigned int retry_cnt;
133 if (bcap_param == NULL)
145 for (retry_cnt = 0; retry_cnt < bcap_param->
retry; retry_cnt++) {
147 if (bcap_param->
serial == 0)
155 packet_recv->
argc = 1;
177 hr = packet_recv->
id;
201 char *chArg, *chRet, *chTmp;
202 VARIANT *vntArg = NULL, vntRet;
213 for (i = 0; i <
argc; i++) {
222 chRet = strchr(format,
':');
228 va_start(list, format);
232 while ((*chArg) || (i < argc)) {
235 chTmp = strchr(chArg,
',');
241 len += strlen(chArg);
252 vntArg[i].
fltVal = (float) va_arg(list,
double);
259 vntArg[i] = va_arg(list,
VARIANT);
273 packet_send.
args = vntArg;
276 packet_recv.
argc = 1;
277 packet_recv.
args = &vntRet;
283 pRet = va_arg(list,
void *);
293 if ((pRet == NULL) || (vt != vntRet.vt)) {
299 *(
int32_t *) pRet = vntRet.lVal;
312 if (vntArg != NULL) {
337 if (connect == NULL || pfd == NULL)
345 device = &bcap_param->
device;
349 switch (device->
type) {
352 conn_param = ð_param;
359 tcp_conn_timeout = timeout;
363 conn_param = ð_param;
372 device->
arg = (
void *) paddr;
381 conn_param = &com_param;
395 if (device->
arg != NULL) {
406 if (device->
arg != NULL) {
414 sock = &device->
sock;
415 hr = device->
dn_open(conn_param, sock);
418 if (device->
arg != NULL) {
459 if (bcap_param == NULL)
462 device = &bcap_param->
device;
463 sock = &device->
sock;
472 if (device->
arg != NULL) {
494 if (bcap_param == NULL)
497 device = &bcap_param->
device;
498 sock = &device->
sock;
523 if (bcap_param == NULL)
529 device = &bcap_param->
device;
543 if (bcap_param == NULL)
546 device = &bcap_param->
device;
553 switch (device->
type) {
555 bcap_param->
retry = 1;
586 if (bcap_param == NULL)
592 *retry = bcap_param->
retry;
615 char format[] =
"8,8,8,8:3";
616 if (hController == NULL)
619 bstrProvider, bstrMachine, bstrOption, hController);
628 if (hController == NULL)
643 char format[] =
"3,8,8:3";
644 if (hExtension == NULL)
647 bstrName, bstrOption, hExtension);
654 char format[] =
"3,8,8:3";
658 bstrName, bstrOption, hFile);
665 char format[] =
"3,8,8:3";
669 bstrName, bstrOption, hRobot);
676 char format[] =
"3,8,8:3";
680 bstrName, bstrOption, hTask);
687 char format[] =
"3,8,8:3";
688 if (hVariable == NULL)
691 bstrName, bstrOption, hVariable);
698 char format[] =
"3,8,8:3";
699 if (hCommand == NULL)
702 bstrName, bstrOption, hCommand);
709 char format[] =
"3,8:12";
711 hController, bstrOption, pVal);
718 char format[] =
"3,8:12";
727 char format[] =
"3,8:12";
729 hController, bstrOption, pVal);
736 char format[] =
"3,8:12";
745 char format[] =
"3,8:12";
747 hController, bstrOption, pVal);
754 char format[] =
"3,8:12";
756 hController, bstrOption, pVal);
763 char format[] =
"3,8,12:12";
765 bstrCommand, vntParam, pVal);
771 char format[] =
"3:3";
772 if (hMessage == NULL)
781 char format[] =
"3:3";
789 char format[] =
"3:8";
797 char format[] =
"3:8";
805 char format[] =
"3:12";
812 char format[] =
"3,12";
820 char format[] =
"3:12";
827 char format[] =
"3,12";
836 char format[] =
"3,8,8:3";
837 if (hVariable == NULL)
840 bstrName, bstrOption, hVariable);
847 char format[] =
"3,8:12";
849 hExtension, bstrOption, pVal);
856 char format[] =
"3,8,12:12";
858 bstrCommand, vntParam, pVal);
864 char format[] =
"3:3";
872 char format[] =
"3:8";
879 char format[] =
"3:8";
886 char format[] =
"3:12";
893 char format[] =
"3,12";
900 char format[] =
"3:12";
907 char format[] =
"3,12";
917 if (hExtension == NULL)
932 char format[] =
"3,8,8:3";
943 char format[] =
"3,8,8:3";
944 if (hVariable == NULL)
947 bstrOption, hVariable);
953 char format[] =
"3,8:12";
962 char format[] =
"3,8:12";
971 char format[] =
"3,8,12:12";
979 char format[] =
"3,8,8";
987 char format[] =
"3,8";
994 char format[] =
"3,8,8";
1002 char format[] =
"3,8:8";
1009 char format[] =
"3:12";
1016 char format[] =
"3:12";
1024 char format[] =
"3:12";
1032 char format[] =
"3:8";
1039 char format[] =
"3:3";
1046 char format[] =
"3:8";
1053 char format[] =
"3:12";
1060 char format[] =
"3,12";
1067 char format[] =
"3:3";
1074 char format[] =
"3:8";
1081 char format[] =
"3:8";
1088 char format[] =
"3:12";
1095 char format[] =
"3,12";
1102 char format[] =
"3:12";
1109 char format[] =
"3,12";
1116 char format[] =
"3";
1134 char format[] =
"3,8,8:3";
1135 if (hVariable == NULL)
1138 bstrOption, hVariable);
1145 char format[] =
"3,8:12";
1154 char format[] =
"3,8,12:12";
1163 char format[] =
"3,3,4,4";
1171 char format[] =
"3,8";
1178 char format[] =
"3,8";
1186 char format[] =
"3,3,4,8";
1194 char format[] =
"3";
1201 char format[] =
"3,8";
1208 char format[] =
"3,8";
1216 char format[] =
"3,3,12,8";
1225 char format[] =
"3,12,4,12,8";
1227 fDeg, vntPivot, bstrOption);
1233 char format[] =
"3,3,4";
1240 char format[] =
"3,8";
1247 char format[] =
"3,8";
1254 char format[] =
"3:3";
1261 char format[] =
"3:8";
1268 char format[] =
"3:8";
1275 char format[] =
"3:12";
1282 char format[] =
"3,12";
1289 char format[] =
"3:12";
1296 char format[] =
"3,12";
1303 char format[] =
"3";
1321 char format[] =
"3,8,8:3";
1322 if (hVariable == NULL)
1325 bstrOption, hVariable);
1332 char format[] =
"3,8:12";
1341 char format[] =
"3,8,12:12";
1349 char format[] =
"3,3,8";
1356 char format[] =
"3,3,8";
1363 char format[] =
"3,8";
1370 char format[] =
"3:8";
1377 char format[] =
"3:3";
1384 char format[] =
"3:8";
1391 char format[] =
"3:8";
1398 char format[] =
"3:12";
1405 char format[] =
"3,12";
1412 char format[] =
"3:12";
1419 char format[] =
"3,12";
1426 char format[] =
"3";
1443 char format[] =
"3:12";
1451 char format[] =
"3:12";
1458 char format[] =
"3,12";
1465 char format[] =
"3:3";
1473 char format[] =
"3:8";
1480 char format[] =
"3:8";
1487 char format[] =
"3:12";
1494 char format[] =
"3,12";
1501 char format[] =
"3:12";
1508 char format[] =
"3,12";
1515 char format[] =
"3:3";
1523 char format[] =
"3";
1526 if (hVariable == NULL)
1540 char format[] =
"3,3:12";
1548 char format[] =
"3";
1555 char format[] =
"3:3";
1562 char format[] =
"3,3";
1569 char format[] =
"3:3";
1576 char format[] =
"3:12";
1584 char format[] =
"3,12";
1592 char format[] =
"3:12";
1599 char format[] =
"3:3";
1606 char format[] =
"3:8";
1613 char format[] =
"3:8";
1620 char format[] =
"3:12";
1627 char format[] =
"3,12";
1634 char format[] =
"3:12";
1641 char format[] =
"3,12";
1648 char format[] =
"3";
1651 if (hCommand == NULL)
1665 char format[] =
"3,12";
1672 char format[] =
"3";
1679 char format[] =
"3:12";
1686 char format[] =
"3:8";
1694 char format[] =
"3:8";
1702 char format[] =
"3:3";
1709 char format[] =
"3:3";
1717 char format[] =
"3:8";
1724 char format[] =
"3:12";
1731 char format[] =
"3";
1734 if (hMessage == NULL)
HRESULT bCap_CommandPutID(int fd, uint32_t hCommand, VARIANT newVal)
Send the b-CAP ID_COMMAND_PUTID packet.
#define ID_MESSAGE_GETSOURCE
HRESULT bCap_TaskGetVariable(int fd, uint32_t hTask, BSTR bstrName, BSTR bstrOption, uint32_t *hVariable)
Send the b-CAP ID_TASK_GETVARIABLE packet.
HRESULT bCap_ControllerGetExtension(int fd, uint32_t hController, BSTR bstrName, BSTR bstrOption, uint32_t *hExtension)
Send the b-CAP ID_CONTROLLER_GETEXTENSION packet.
HRESULT bCap_RobotHalt(int fd, uint32_t hRobot, BSTR bstrOption)
Send the b-CAP ID_ROBOT_HALT packet.
_DN_EXP_THREAD HRESULT unlock_mutex(MUTEX *pmutex)
Unlocks mutex handle.
HRESULT bCap_CommandGetParameters(int fd, uint32_t hCommand, VARIANT *pVal)
Send the b-CAP ID_COMMAND_GETPARAMETERS packet.
#define ID_COMMAND_GETATTRIBUTE
HRESULT bCap_TaskGetID(int fd, uint32_t hTask, VARIANT *pVal)
Send the b-CAP ID_TASK_GETID packet.
b-CAP client communication object.
#define ID_TASK_GETVARIABLE
HRESULT bCap_FilePutValue(int fd, uint32_t hFile, VARIANT newVal)
Send the b-CAP ID_FILE_PUTVALUE packet.
HRESULT bCap_ControllerGetAttribute(int fd, uint32_t hController, int32_t *pVal)
Send the b-CAP ID_CONTROLLER_GETATTRIBUTE packet.
HRESULT bCap_VariableGetAttribute(int fd, uint32_t hVariable, int32_t *pVal)
Send the b-CAP ID_VARIABLE_GETATTRIBUTE packet.
#define ID_VARIABLE_GETVALUE
#define ID_CONTROLLER_GETROBOTNAMES
HRESULT bCap_RobotGetID(int fd, uint32_t hRobot, VARIANT *pVal)
Send the b-CAP ID_ROBOT_GETID packet.
_BCAP_EXP_COMMON HRESULT bcap_recv(struct CONN_PARAM_COMMON *device, struct BCAP_PACKET *packet_recv, int client)
Receives b-CAP packet.
#define S_EXECUTING
Succeeded but the server has been executing yet.
struct CONN_PARAM_COMMON device
HRESULT bCap_MessageClear(int fd, uint32_t hMessage)
Send the b-CAP ID_MESSAGE_CLEAR packet.
#define ID_CONTROLLER_EXECUTE
HRESULT bCap_FilePutTag(int fd, uint32_t hFile, VARIANT newVal)
Send the b-CAP ID_FILE_PUTTAG packet.
HRESULT bCap_ExtensionGetTag(int fd, uint32_t hExtension, VARIANT *pVal)
Send the b-CAP ID_EXTENSION_GETTAG packet.
HRESULT(* dn_set_timeout)(int sock, uint32_t timeout)
HRESULT bCap_CommandGetID(int fd, uint32_t hCommand, VARIANT *pVal)
Send the b-CAP ID_COMMAND_GETID packet.
HRESULT bCap_MessageGetSource(int fd, uint32_t hMessage, BSTR *pVal)
Send the b-CAP ID_MESSAGE_GETSOURCE packet.
HRESULT bCap_RobotPutTag(int fd, uint32_t hRobot, VARIANT newVal)
Send the b-CAP ID_ROBOT_PUTTAG packet.
static HRESULT send_receive(int index, struct BCAP_PACKET *packet_send, struct BCAP_PACKET *packet_recv)
Sends and receives the b-CAP packet.
HRESULT bCap_ControllerGetVariableNames(int fd, uint32_t hController, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_CONTROLLER_GETVARIABLENAMES packet.
HRESULT bCap_SetTimeout(int fd, uint32_t timeout)
Sets timeout.
HRESULT bCap_RobotGoHome(int fd, uint32_t hRobot)
Send the b-CAP ID_ROBOT_GOHOME packet.
HRESULT bCap_ControllerGetVariable(int fd, uint32_t hController, BSTR bstrName, BSTR bstrOption, uint32_t *hVariable)
Send the b-CAP ID_CONTROLLER_GETVARIABLE packet.
#define ID_CONTROLLER_PUTTAG
#define ID_EXTENSION_PUTID
#define ID_FILE_GETDATELASTMODIFIED
HRESULT bCap_VariableRelease(int fd, uint32_t *hVariable)
Send the b-CAP ID_VARIABLE_RELEASE packet.
HRESULT bCap_ControllerGetTask(int fd, uint32_t hController, BSTR bstrName, BSTR bstrOption, uint32_t *hTask)
Send the b-CAP ID_CONTROLLER_GETTASK packet.
HRESULT bCap_VariablePutValue(int fd, uint32_t hVariable, VARIANT newVal)
Send the b-CAP ID_VARIABLE_PUTVALUE packet.
HRESULT(* dn_recv)(int sock, char *buf, uint32_t len_buf, uint32_t *len_recved, uint32_t timeout, void *arg)
#define ID_TASK_GETVARIABLENAMES
HRESULT bCap_VariableGetMicrosecond(int fd, uint32_t hVariable, int32_t *pVal)
Send the b-CAP ID_VARIABLE_GETMICROSECOND packet.
#define ID_CONTROLLER_CONNECT
HRESULT bCap_FileGetDateLastModified(int fd, uint32_t hFile, VARIANT *pVal)
Send the b-CAP ID_FILE_GETDATELASTMODIFIED packet.
#define ID_EXTENSION_GETID
HRESULT bCap_ExtensionPutID(int fd, uint32_t hExtension, VARIANT newVal)
Send the b-CAP ID_EXTENSION_PUTID packet.
HRESULT bCap_CommandExecute(int fd, uint32_t hCommand, int32_t lMode, VARIANT *pVal)
Send the b-CAP ID_COMMAND_EXECUTE packet.
HRESULT bCap_ControllerGetCommandNames(int fd, uint32_t hController, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_CONTROLLER_GETCOMMANDNAMES packet.
HRESULT bCap_ExtensionGetHelp(int fd, uint32_t hExtension, BSTR *pVal)
Send the b-CAP ID_EXTENSION_GETHELP packet.
_DN_EXP_THREAD HRESULT lock_mutex(MUTEX *pmutex, uint32_t timeout)
Locks mutex handle.
HRESULT bCap_FileGetFile(int fd, uint32_t hFile, BSTR bstrName, BSTR bstrOption, uint32_t *hFile2)
Send the b-CAP ID_FILE_GETFILE packet.
HRESULT bCap_FileGetHelp(int fd, uint32_t hFile, BSTR *pVal)
Send the b-CAP ID_FILE_GETHELP packet.
#define ID_EXTENSION_GETATTRIBUTE
#define ID_FILE_GETFILENAMES
#define _RETRY_MAX
A definition for the maximum retry count.
HRESULT bCap_TaskStop(int fd, uint32_t hTask, int32_t lMode, BSTR bstrOption)
Send the b-CAP ID_TASK_STOP packet.
HRESULT bCap_MessageReply(int fd, uint32_t hMessage, VARIANT vntData)
Send the b-CAP ID_MESSAGE_REPLY packet.
HRESULT bCap_TaskGetTag(int fd, uint32_t hTask, VARIANT *pVal)
Send the b-CAP ID_TASK_GETTAG packet.
static struct CONN_BCAP_CLIENT * check_address(int index)
Checks whether the index has been used or not.
HRESULT bCap_FileGetVariable(int fd, uint32_t hFile, BSTR bstrName, BSTR bstrOption, uint32_t *hVariable)
Send the b-CAP ID_FILE_GETVARIABLE packet.
HRESULT bCap_ServiceStop(int fd)
Send the b-CAP ID_SERVICE_STOP packet.
#define _RETRY_MIN
A definition for the minimum retry count.
HRESULT bCap_FileGetType(int fd, uint32_t hFile, BSTR *pVal)
Send the b-CAP ID_FILE_GETTYPE packet.
#define ID_MESSAGE_GETDATETIME
HRESULT bCap_RobotGetAttribute(int fd, uint32_t hRobot, int32_t *pVal)
Send the b-CAP ID_ROBOT_GETATTRIBUTE packet.
_DN_EXP_UDP HRESULT udp_send(int sock, const char *buf, uint32_t len_buf, void *arg)
Sends UDP packet.
HRESULT bCap_CommandGetTimeout(int fd, uint32_t hCommand, int32_t *pVal)
Send the b-CAP ID_COMMAND_GETTIMEOUT packet.
#define BCAP_CONN_MAX
A definition for the maximum count of b-CAP client connections.
HRESULT bCap_CommandGetName(int fd, uint32_t hCommand, BSTR *pVal)
Send the b-CAP ID_COMMAND_GETNAME packet.
#define ID_MESSAGE_GETVALUE
HRESULT bCap_FileGetTag(int fd, uint32_t hFile, VARIANT *pVal)
Send the b-CAP ID_FILE_GETTAG packet.
#define ID_VARIABLE_GETHELP
HRESULT bCap_TaskGetName(int fd, uint32_t hTask, BSTR *pVal)
Send the b-CAP ID_TASK_GETNAME packet.
#define ID_EXTENSION_PUTTAG
HRESULT bCap_RobotPutID(int fd, uint32_t hRobot, VARIANT newVal)
Send the b-CAP ID_ROBOT_PUTID packet.
HRESULT bCap_RobotGetName(int fd, uint32_t hRobot, BSTR *pVal)
Send the b-CAP ID_ROBOT_GETNAME packet.
#define ID_VARIABLE_RELEASE
#define ID_ROBOT_GETATTRIBUTE
HRESULT bCap_RobotRelease(int fd, uint32_t *hRobot)
Send the b-CAP ID_ROBOT_RELEASE packet.
Thread and mutex API file.
HRESULT bCap_FileGetDateCreated(int fd, uint32_t hFile, VARIANT *pVal)
Send the b-CAP ID_FILE_GETDATECREATED packet.
HRESULT bCap_Open_Client(const char *connect, uint32_t timeout, unsigned int retry, int *pfd)
Starts b-CAP communication.
#define ID_FILE_GETVARIABLENAMES
#define FAILED(hr)
A macro that returns TRUE/FALSE. If hr is less than zero, then returns TRUE.
#define ID_VARIABLE_GETNAME
#define ID_CONTROLLER_GETMESSAGE
_DN_EXP_COM HRESULT com_open(void *param, int *sock)
Opens serial port.
#define ID_TASK_GETFILENAME
HRESULT bCap_SetRetry(int fd, unsigned int retry)
Sets retry count.
HRESULT bCap_ControllerGetID(int fd, uint32_t hController, VARIANT *pVal)
Send the b-CAP ID_CONTROLLER_GETID packet.
HRESULT bCap_MessageGetValue(int fd, uint32_t hMessage, VARIANT *pVal)
Send the b-CAP ID_MESSAGE_GETVALUE packet.
#define E_HANDLE
Failed because the handle is invalid.
HRESULT bCap_CommandGetHelp(int fd, uint32_t hCommand, BSTR *pVal)
Send the b-CAP ID_COMMAND_GETHELP packet.
HRESULT bCap_TaskPutTag(int fd, uint32_t hTask, VARIANT newVal)
Send the b-CAP ID_TASK_PUTTAG packet.
_DN_EXP_UDP HRESULT udp_set_timeout(int sock, uint32_t timeout)
Sets timeout value to the UDP socket.
HRESULT bCap_TaskGetHelp(int fd, uint32_t hTask, BSTR *pVal)
Send the b-CAP ID_TASK_GETHELP packet.
HRESULT bCap_RobotUnchuck(int fd, uint32_t hRobot, BSTR bstrOption)
Send the b-CAP ID_ROBOT_UNCHUCK packet.
#define ID_CONTROLLER_DISCONNECT
#define ID_COMMAND_GETSTATE
HRESULT bCap_RobotMove(int fd, uint32_t hRobot, int32_t lComp, VARIANT vntPose, BSTR bstrOption)
Send the b-CAP ID_ROBOT_MOVE packet.
#define ID_MESSAGE_RELEASE
#define E_INVALIDARG
Failed because some arguments are invalid.
HRESULT(* dn_close)(int *sock)
#define ID_COMMAND_GETPARAMETERS
HRESULT bCap_TaskExecute(int fd, uint32_t hTask, BSTR bstrCommand, VARIANT vntParam, VARIANT *pVal)
Send the b-CAP ID_TASK_EXECUTE packet.
HRESULT bCap_CommandCancel(int fd, uint32_t hCommand)
Send the b-CAP ID_COMMAND_CANCEL packet.
HRESULT bCap_ControllerGetMessage(int fd, uint32_t hController, uint32_t *hMessage)
Send the b-CAP ID_CONTROLLER_GETMESSAGE packet.
#define ID_EXTENSION_GETVARIABLE
HRESULT bCap_VariableGetTag(int fd, uint32_t hVariable, VARIANT *pVal)
Send the b-CAP ID_VARIABLE_GETTAG packet.
HRESULT bCap_FileGetID(int fd, uint32_t hFile, VARIANT *pVal)
Send the b-CAP ID_FILE_GETID packet.
HRESULT bCap_FileGetAttribute(int fd, uint32_t hFile, int32_t *pVal)
Send the b-CAP ID_FILE_GETATTRIBUTE packet.
HRESULT bCap_TaskPutID(int fd, uint32_t hTask, VARIANT newVal)
Send the b-CAP ID_TASK_PUTID packet.
_DN_EXP_COM HRESULT com_set_timeout(int sock, uint32_t timeout)
Sets timeout value to the serial socket.
HRESULT bCap_ExtensionGetVariableNames(int fd, uint32_t hExtension, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_EXTENSION_GETVARIABLENAMES packet.
HRESULT bCap_VariablePutID(int fd, uint32_t hVariable, VARIANT newVal)
Send the b-CAP ID_VARIABLE_PUTID packet.
_DN_EXP_DEVICE HRESULT parse_conn_param_serial(const char *opt, struct CONN_PARAM_COM *param)
Parses serial connection parameters.
#define ID_EXTENSION_RELEASE
#define ID_ROBOT_ACCELERATE
static struct CONN_BCAP_CLIENT m_conn_param[BCAP_CONN_MAX]
HRESULT bCap_ControllerGetExtensionNames(int fd, uint32_t hController, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_CONTROLLER_GETEXTENSIONNAMES packet.
#define ID_VARIABLE_GETMICROSECOND
HRESULT bCap_FileGetName(int fd, uint32_t hFile, BSTR *pVal)
Send the b-CAP ID_FILE_GETNAME packet.
HRESULT bCap_RobotChuck(int fd, uint32_t hRobot, BSTR bstrOption)
Send the b-CAP ID_ROBOT_CHUCK packet.
_DN_EXP_COM HRESULT com_recv(int sock, char *buf, uint32_t len_buf, uint32_t *len_recved, uint32_t timeout, void *arg)
Receives serial packet.
HRESULT bCap_ServiceStart(int fd, BSTR bstrOption)
Send the b-CAP ID_SERVICE_START packet.
HRESULT bCap_RobotUnhold(int fd, uint32_t hRobot, BSTR bstrOption)
Send the b-CAP ID_ROBOT_UNHOLD packet.
HRESULT bCap_RobotGetHelp(int fd, uint32_t hRobot, BSTR *pVal)
Send the b-CAP ID_ROBOT_GETHELP packet.
HRESULT bCap_ControllerGetCommand(int fd, uint32_t hController, BSTR bstrName, BSTR bstrOption, uint32_t *hCommand)
Send the b-CAP ID_CONTROLLER_GETCOMMAND packet.
HRESULT bCap_ControllerGetHelp(int fd, uint32_t hController, BSTR *pVal)
Send the b-CAP ID_CONTROLLER_GETHELP packet.
_DN_EXP_UDP HRESULT udp_open(void *param, int *sock)
Opens UDP socket.
#define E_FAIL
Failed because unspecified error occurs.
#define ID_CONTROLLER_GETFILENAMES
HRESULT bCap_ControllerGetTaskNames(int fd, uint32_t hController, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_CONTROLLER_GETTASKNAMES packet.
#define ID_COMMAND_GETRESULT
HRESULT bCap_ExtensionRelease(int fd, uint32_t *hExtension)
Send the b-CAP ID_EXTENSION_RELEASE packet.
static uint32_t inet_addr(const char *addr)
#define ID_VARIABLE_GETATTRIBUTE
HRESULT bCap_TaskRelease(int fd, uint32_t *hTask)
Send the b-CAP ID_TASK_RELEASE packet.
HRESULT bCap_RobotExecute(int fd, uint32_t hRobot, BSTR bstrCommand, VARIANT vntParam, VARIANT *pVal)
Send the b-CAP ID_ROBOT_EXECUTE packet.
#define ID_CONTROLLER_GETCOMMAND
HRESULT bCap_VariableGetName(int fd, uint32_t hVariable, BSTR *pVal)
Send the b-CAP ID_VARIABLE_GETNAME packet.
#define ID_VARIABLE_GETDATETIME
#define ID_MESSAGE_GETSERIALNUMBER
#define ID_COMMAND_GETTIMEOUT
HRESULT bCap_MessageRelease(int fd, uint32_t *hMessage)
Send the b-CAP ID_MESSAGE_RELEASE packet.
HRESULT bCap_CommandPutParameters(int fd, uint32_t hCommand, VARIANT newVal)
Send the b-CAP ID_VARIABLE_PUTPARAMETERS packet.
HRESULT bCap_FileGetVariableNames(int fd, uint32_t hFile, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_FILE_GETVARIABLENAMES packet.
#define ID_CONTROLLER_PUTID
_DN_EXP_COM HRESULT com_close(int *sock)
Closes the socket.
HRESULT bCap_ControllerExecute(int fd, uint32_t hController, BSTR bstrCommand, VARIANT vntParam, VARIANT *pVal)
Send the b-CAP ID_CONTROLLER_EXECUTE packet.
#define ID_CONTROLLER_GETTAG
#define E_OUTOFMEMORY
Failed because there is no enough memory space.
HRESULT bCap_VariablePutTag(int fd, uint32_t hVariable, VARIANT newVal)
Send the b-CAP ID_VARIABLE_PUTTAG packet.
#define ID_TASK_GETATTRIBUTE
HRESULT bCap_ControllerPutID(int fd, uint32_t hController, VARIANT newVal)
Send the b-CAP ID_CONTROLLER_PUTID packet.
HRESULT bCap_FileMove(int fd, uint32_t hFile, BSTR bstrName, BSTR bstrOption)
Send the b-CAP ID_FILE_MOVE packet.
HRESULT bCap_ControllerConnect(int fd, BSTR bstrName, BSTR bstrProvider, BSTR bstrMachine, BSTR bstrOption, uint32_t *hController)
Send the b-CAP ID_CONTROLLER_CONNECT packet.
HRESULT bCap_FilePutID(int fd, uint32_t hFile, VARIANT newVal)
Send the b-CAP ID_FILE_PUTID packet.
#define ID_ROBOT_GETVARIABLENAMES
#define ID_MESSAGE_GETDESCRIPTION
#define NOPARITY
A definition for serial communication setting.
HRESULT bCap_CommandGetState(int fd, uint32_t hCommand, int32_t *pVal)
Send the b-CAP ID_COMMAND_GETSTATE packet.
HRESULT bCap_VariableGetID(int fd, uint32_t hVariable, VARIANT *pVal)
Send the b-CAP ID_VARIABLE_GETID packet.
_DN_EXP_UDP HRESULT udp_recv(int sock, char *buf, uint32_t len_buf, uint32_t *len_recved, uint32_t timeout, void *arg)
Receives UDP packet.
#define SUCCEEDED(hr)
A macro that returns TRUE/FALSE. If hr is zero or more, then returns TRUE.
HRESULT bCap_FileDelete(int fd, uint32_t hFile, BSTR bstrOption)
Send the b-CAP ID_FILE_DELETE packet.
#define ID_COMMAND_GETNAME
HRESULT bCap_ControllerGetName(int fd, uint32_t hController, BSTR *pVal)
Send the b-CAP ID_CONTROLLER_GETNAME packet.
HRESULT bCap_ControllerGetFileNames(int fd, uint32_t hController, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_CONTROLLER_GETFILENAMES packet.
A type definition for Ethernet connection parameters.
HRESULT bCap_ControllerGetTag(int fd, uint32_t hController, VARIANT *pVal)
Send the b-CAP ID_CONTROLLER_GETTAG packet.
#define ID_EXTENSION_GETNAME
#define ONESTOPBIT
A definition for serial communication setting.
HRESULT bCap_VariableGetHelp(int fd, uint32_t hVariable, BSTR *pVal)
Send the b-CAP ID_VARIABLE_GETHELP packet.
#define ID_VARIABLE_PUTTAG
#define ID_ROBOT_GETVARIABLE
HRESULT bCap_CommandGetTag(int fd, uint32_t hCommand, VARIANT *pVal)
Send the b-CAP ID_COMMAND_GETTAG packet.
HRESULT bCap_RobotDrive(int fd, uint32_t hRobot, int32_t lNo, float fMov, BSTR bstrOption)
Send the b-CAP ID_ROBOT_DRIVE packet.
#define INFINITE
A definition for infinite wait.
_DN_EXP_COMMON void VariantInit(VARIANT *pvarg)
Initializes the VARIANT.
HRESULT bCap_CommandGetAttribute(int fd, uint32_t hCommand, int32_t *pVal)
Send the b-CAP ID_COMMAND_GETATTRIBUTE packet.
HRESULT bCap_RobotAccelerate(int fd, uint32_t hRobot, int32_t lAxis, float fAccel, float fDecel)
Send the b-CAP ID_ROBOT_ACCELERATE packet.
static HRESULT invoke_function(int fd, int32_t id, int argc, char *format,...)
HRESULT bCap_ExtensionGetAttribute(int fd, uint32_t hExtension, int32_t *pVal)
Send the b-CAP ID_EXTENSION_GETATTRIBUTE packet.
#define ID_CONTROLLER_GETTASKNAMES
_DN_EXP_TCP HRESULT tcp_recv(int sock, char *buf, uint32_t len_buf, uint32_t *len_recved, uint32_t timeout, void *arg)
Receives TCP packet.
A type definition for common communication parameters.
HRESULT bCap_RobotGetVariable(int fd, uint32_t hRobot, BSTR bstrName, BSTR bstrOption, uint32_t *hVariable)
Send the b-CAP ID_ROBOT_GETVARIABLE packet.
static uint16_t htons(uint16_t hostshort)
#define ID_VARIABLE_PUTVALUE
#define ID_FILE_GETDATELASTACCESSED
#define ID_COMMAND_RELEASE
HRESULT(* dn_open)(void *param, int *sock)
_DN_EXP_COM HRESULT com_send(int sock, const char *buf, uint32_t len_buf, void *arg)
Sends serial packet.
HRESULT bCap_CommandGetResult(int fd, uint32_t hCommand, VARIANT *pVal)
Send the b-CAP ID_COMMAND_GETRESULT packet.
HRESULT bCap_RobotHold(int fd, uint32_t hRobot, BSTR bstrOption)
Send the b-CAP ID_ROBOT_HOLD packet.
#define ID_FILE_GETDATECREATED
A type definition for the multi type variable.
HRESULT bCap_ControllerGetFile(int fd, uint32_t hController, BSTR bstrName, BSTR bstrOption, uint32_t *hFile)
Send the b-CAP ID_CONTROLLER_GETFILE packet.
HRESULT bCap_FileCopy(int fd, uint32_t hFile, BSTR bstrName, BSTR bstrOption)
Send the b-CAP ID_FILE_COPY packet.
_DN_EXP_COMMON BSTR SysAllocString(const wchar_t *sz)
Allocates and returns BSTR.
HRESULT bCap_ExtensionExecute(int fd, uint32_t hExtension, BSTR bstrCommand, VARIANT vntParam, VARIANT *pVal)
Send the b-CAP ID_EXTENSION_EXECUTE packet.
_DN_EXP_THREAD HRESULT release_mutex(MUTEX *pmutex)
Releases mutex handle.
#define ID_CONTROLLER_GETNAME
#define ID_EXTENSION_GETTAG
#define E_MAX_OBJECT
Failed because the packet is too much.
_DN_EXP_COMMON void VariantClear(VARIANT *pvarg)
Clears the VARIANT.
HRESULT bCap_CommandRelease(int fd, uint32_t *hCommand)
Send the b-CAP ID_COMMAND_RELEASE packet.
HRESULT bCap_CommandPutTag(int fd, uint32_t hCommand, VARIANT newVal)
Send the b-CAP ID_COMMAND_PUTTAG packet.
HRESULT bCap_VariableGetValue(int fd, uint32_t hVariable, VARIANT *pVal)
Send the b-CAP ID_VARIABLE_GETVALUE packet.
_DN_EXP_DEVICE int parse_conn_type(const char *opt)
Parses and returns the connection type.
A type definition for the b-CAP packet.
HRESULT bCap_MessageGetSerialNumber(int fd, uint32_t hMessage, int32_t *pVal)
Send the b-CAP ID_MESSAGE_GETSERIALNUMBER packet.
HRESULT bCap_FileExecute(int fd, uint32_t hFile, BSTR bstrCommand, VARIANT vntParam, VARIANT *pVal)
Send the b-CAP ID_FILE_EXECUTE packet.
HRESULT bCap_RobotRotate(int fd, uint32_t hRobot, VARIANT vntRotSuf, float fDeg, VARIANT vntPivot, BSTR bstrOption)
Send the b-CAP ID_ROBOT_ROTATE packet.
HRESULT bCap_Close_Client(int *pfd)
Ends b-CAP communication.
#define ID_MESSAGE_GETNUMBER
A type definition for serial connection parameters.
HRESULT bCap_FileRun(int fd, uint32_t hFile, BSTR bstrOption, BSTR *pVal)
Send the b-CAP ID_FILE_RUN packet.
#define ID_CONTROLLER_GETEXTENSION
HRESULT bCap_RobotSpeed(int fd, uint32_t hRobot, int32_t lAxis, float fSpeed)
Send the b-CAP ID_ROBOT_SPEED packet.
#define ID_CONTROLLER_GETHELP
HRESULT bCap_GetRetry(int fd, unsigned int *retry)
Gets retry count.
#define ID_MESSAGE_GETDESTINATION
HRESULT bCap_GetTimeout(int fd, uint32_t *timeout)
Gets timeout.
HRESULT bCap_ControllerGetRobotNames(int fd, uint32_t hController, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_CONTROLLER_GETROBOTNAMES packet.
HRESULT bCap_FileGetPath(int fd, uint32_t hFile, BSTR *pVal)
Send the b-CAP ID_FILE_GETPATH packet.
#define ID_COMMAND_PUTTIMEOUT
_DN_EXP_TCP HRESULT tcp_set_timeout(int sock, uint32_t timeout)
Sets timeout value to the TCP socket.
HRESULT bCap_TaskDelete(int fd, uint32_t hTask, BSTR bstrOption)
Send the b-CAP ID_TASK_DELETE packet.
#define ID_COMMAND_GETTAG
#define ID_CONTROLLER_GETTASK
#define ID_CONTROLLER_GETROBOT
_DN_EXP_TCP HRESULT tcp_send(int sock, const char *buf, uint32_t len_buf, void *arg)
Sends TCP packet.
HRESULT bCap_RobotChange(int fd, uint32_t hRobot, BSTR bstrName)
Send the b-CAP ID_ROBOT_CHANGE packet.
#define ID_EXTENSION_GETHELP
uint32_t tcp_conn_timeout
static int find_open_address()
Returns the open address of m_conn_param.
HRESULT bCap_TaskGetAttribute(int fd, uint32_t hTask, int32_t *pVal)
Send the b-CAP ID_TASK_GETATTRIBUTE packet.
HRESULT bCap_CommandPutTimeout(int fd, uint32_t hCommand, int32_t newVal)
Send the b-CAP ID_COMMAND_PUTTIMEOUT packet.
HRESULT bCap_FileGetFileNames(int fd, uint32_t hFile, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_FILE_GETFILENAMES packet.
#define ID_CONTROLLER_GETATTRIBUTE
HRESULT bCap_ControllerPutTag(int fd, uint32_t hController, VARIANT newVal)
Send the b-CAP ID_CONTROLLER_PUTTAG packet.
#define ID_EXTENSION_EXECUTE
#define ID_CONTROLLER_GETVARIABLENAMES
#define ID_CONTROLLER_GETCOMMANDNAMES
#define ID_VARIABLE_GETTAG
#define ID_COMMAND_CANCEL
HRESULT bCap_FileGetValue(int fd, uint32_t hFile, VARIANT *pVal)
Send the b-CAP ID_FILE_GETVALUE packet.
#define ID_CONTROLLER_GETFILE
#define ID_COMMAND_GETHELP
HRESULT bCap_RobotGetVariableNames(int fd, uint32_t hRobot, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_ROBOT_GETVARIABLENAMES packet.
#define ID_COMMAND_PUTPARAMETERS
_DN_EXP_UDP HRESULT udp_close(int *sock)
Closes the socket.
HRESULT bCap_MessageGetDescription(int fd, uint32_t hMessage, BSTR *pVal)
Send the b-CAP ID_MESSAGE_GETDESCRIPTION packet.
HRESULT bCap_ExtensionGetID(int fd, uint32_t hExtension, VARIANT *pVal)
Send the b-CAP ID_EXTENSION_GETID packet.
HRESULT bCap_MessageGetNumber(int fd, uint32_t hMessage, int32_t *pVal)
Send the b-CAP ID_MESSAGE_GETNUMBER packet.
_DN_EXP_TCP HRESULT tcp_close(int *sock)
Closes the socket.
HRESULT bCap_ControllerGetRobot(int fd, uint32_t hController, BSTR bstrName, BSTR bstrOption, uint32_t *hRobot)
Send the b-CAP ID_CONTROLLER_GETROBOT packet.
#define ID_FILE_GETVARIABLE
#define ID_CONTROLLER_GETID
#define ID_FILE_GETATTRIBUTE
#define ID_COMMAND_PUTTAG
_DN_EXP_TCP HRESULT tcp_open_client(void *param, int *sock)
Opens TCP client.
static int connect(SOCKET s, const struct sockaddr *name, int namelen)
HRESULT bCap_FileGetDateLastAccessed(int fd, uint32_t hFile, VARIANT *pVal)
Send the b-CAP ID_FILE_GETDATELASTACCESSED packet.
HRESULT(* dn_send)(int sock, const char *buf, uint32_t len_buf, void *arg)
_BCAP_EXP_COMMON HRESULT bcap_send(struct CONN_PARAM_COMMON *device, struct BCAP_PACKET *packet_send)
Sends b-CAP packet.
_DN_EXP_DEVICE HRESULT parse_conn_param_ether(const char *opt, struct CONN_PARAM_ETH *param)
Parses Ethernet connection parameters.
HRESULT bCap_ControllerDisconnect(int fd, uint32_t *hController)
Send the b-CAP ID_CONTROLLER_DISCONNECT packet.
HRESULT bCap_MessageGetDestination(int fd, uint32_t hMessage, BSTR *pVal)
Send the b-CAP ID_MESSAGE_GETDESTINATION packet.
_DN_EXP_THREAD HRESULT initialize_mutex(MUTEX *pmutex)
Initializes mutex handle.
HRESULT bCap_VariableGetDateTime(int fd, uint32_t hVariable, VARIANT *pVal)
Send the b-CAP ID_VARIABLE_GETDATETIME packet.
HRESULT bCap_ExtensionGetName(int fd, uint32_t hExtension, BSTR *pVal)
Send the b-CAP ID_EXTENSION_GETNAME packet.
HRESULT bCap_MessageGetDateTime(int fd, uint32_t hMessage, VARIANT *pVal)
Send the b-CAP ID_MESSAGE_GETDATETIME packet.
#define ID_CONTROLLER_GETEXTENSIONNAMES
HRESULT bCap_FileRelease(int fd, uint32_t *hFile)
Send the b-CAP ID_FILE_RELEASE packet.
#define ID_VARIABLE_GETID
#define ID_EXTENSION_GETVARIABLENAMES
HRESULT bCap_ExtensionPutTag(int fd, uint32_t hExtension, VARIANT newVal)
Send the b-CAP ID_EXTENSION_PUTTAG packet.
#define ID_VARIABLE_PUTID
HRESULT bCap_TaskGetVariableNames(int fd, uint32_t hTask, BSTR bstrOption, VARIANT *pVal)
Send the b-CAP ID_TASK_GETVARIABLENAMES packet.
HRESULT bCap_FileGetSize(int fd, uint32_t hFile, int32_t *pVal)
Send the b-CAP ID_FILE_GETSIZE packet.
#define ID_CONTROLLER_GETVARIABLE
HRESULT bCap_TaskGetFileName(int fd, uint32_t hTask, BSTR *pVal)
Send the b-CAP ID_TASK_GETFILENAME packet.
HRESULT bCap_TaskStart(int fd, uint32_t hTask, int32_t lMode, BSTR bstrOption)
Send the b-CAP ID_TASK_START packet.
HRESULT bCap_RobotGetTag(int fd, uint32_t hRobot, VARIANT *pVal)
Send the b-CAP ID_ROBOT_GETTAG packet.
#define ID_COMMAND_EXECUTE
HRESULT bCap_ExtensionGetVariable(int fd, uint32_t hExtension, BSTR bstrName, BSTR bstrOption, uint32_t *hVariable)
Send the b-CAP ID_EXTENSION_GETVARIABLE packet.