irtrans_wrapper.cpp
Go to the documentation of this file.
00001 
00024 #include "maggie_ir_drivers/irtrans_wrapper.h"
00025 
00027 
00028 IrTransWrapper::IrTransWrapper() :
00029     _irt_server()
00030 {
00031 }
00032 
00034 
00035 IrTransWrapper::~IrTransWrapper()
00036 {
00037 }
00038 
00040 
00041 int IrTransWrapper::connect()
00042 {
00043     int res, error = 0;
00044     char * host = (char*) "127.0.0.1";
00045 
00046     if ((res = ConnectIRTransServer(host, &_irt_server)) != 0) {
00047         ROS_ERROR("[IRTRANS_WRAPPER] Error: %i connecting to IR controller server", res);
00048         error = -1;
00049     }
00050     else {
00051         ROS_DEBUG("[IRTRANS_WRAPPER] Successful connection with IR controller server");
00052     }
00053 
00054     return error;
00055 }
00056 
00058 
00059 void IrTransWrapper::disconnect()
00060 {
00061     DisconnectIRTransServer(_irt_server);
00062 }
00063 
00065 
00066 int IrTransWrapper::send_remote_command(std::string remote, std::string command)
00067 {
00068     NETWORKSTATUS *stat;
00069     int error = 0;
00070 
00071     stat = SendRemoteCommand(_irt_server, &remote[0], &command[0], 0, 0, 0);
00072     if (stat) {
00073         ROS_WARN("[IRTRANS_WRAPPER] Warning: sending IR command: '%s'", stat->message);
00074         error = -1;
00075     }
00076     else {
00077         ROS_DEBUG("[IRTRANS_WRAPPER] IR command sent: '%s'", remote.c_str());
00078     }
00079 
00080     return error;
00081 }
00082 


maggie_ir_drivers
Author(s): Raul Perula-Martinez
autogenerated on Mon Sep 14 2015 03:06:37