multiConnectionDevice.cpp
00001
00002
00003
00004
00005
00006
00007 #include "multiConnectionDevice.h"
00008
00009
00010 MultiConnectionDevice::MultiConnectionDevice(void) : sub_con(NULL) {
00011 }
00012
00013
00014 MultiConnectionDevice::~MultiConnectionDevice(void) {
00015 delete sub_con;
00016 }
00017
00018
00019 void MultiConnectionDevice::raw_disconnect(void) {
00020 SerialDevice::raw_disconnect();
00021 delete sub_con;
00022 sub_con = NULL;
00023 }
00024
00025
00026 int MultiConnectionDevice::raw_send(const char* data, int len) {
00027 int ret_value = SerialDevice::raw_send(data, len);
00028 if (sub_con) {
00029 sub_con->send(data, len);
00030 sub_con->flush();
00031 }
00032 return ret_value;
00033 }
00034
00035
00036 int MultiConnectionDevice::subConnect(const char* host, long port) {
00037 delete sub_con;
00038
00039 sub_con = new TcpipDevice();
00040 return sub_con->connect(host, port);
00041 }
00042