bcap_service_test.cpp
Go to the documentation of this file.
00001 
00025 #include <ros/ros.h>
00026 #include "bcap_service/bcap.h"
00027 
00028 using namespace bcap_service;
00029 
00030 int main(int argc, char **argv)
00031 {
00032   if ((argc < 4) || (argc % 2 != 0))
00033   {
00034     ROS_WARN("Usage: bcap_service_test func_id vt value ...");
00035     return 1;
00036   }
00037 
00038   ros::init(argc, argv, "bcap_service_test");
00039 
00040   ros::NodeHandle node;
00041   ros::ServiceClient client = node.serviceClient<bcap>("bcap_service");
00042 
00043   int i;
00044   bcap packet;
00045 
00046   packet.request.func_id = atoi(argv[1]);
00047 
00048   for(i = 0; i < (argc - 2) / 2; i++) {
00049     variant vnt;
00050     vnt.vt    = atoi(argv[2 + 2 * i]);
00051     vnt.value = argv[3 + 2 * i];
00052     packet.request.vntArgs.push_back(vnt);
00053   }
00054 
00055   if (client.call(packet))
00056   {
00057     ROS_INFO("HRESULT: %X", packet.response.HRESULT);
00058     ROS_INFO("vntRet: vt := %d, value := %s", packet.response.vntRet.vt, packet.response.vntRet.value.c_str());
00059   }
00060   else
00061   {
00062     ROS_ERROR("Failed to call.");
00063     return 1;
00064   }
00065 
00066   return 0;
00067 
00068 }


bcap_service_test
Author(s): DENSO WAVE INCORPORATED
autogenerated on Thu Jun 6 2019 21:00:09