#include #include #include #include #include #include #include #include using namespace iPlature; using namespace baosight; extern iDA::Connection con; extern int gb_eventno; extern string gb_name; using namespace log4cplus; using namespace iXcomTCP2; using namespace IceUtil; /********************************************************************** * 概述: 构造函数,进行所需的初始化工作 * 函数名: zudpICEI * 返回值: * 参数列表: 参数类型 取值范围 描述 * *ndle tHDL = new UdpConnection("10.25.27.66",8089,submsg); IceUtil::ThreadControl tTC = tHDL->start(); 版本历史 * 1.0 2010-06-18 echo_li 初次建立 * **********************************************************************/ zudpICEI::zudpICEI() { LOG d("zudpIDLI::zudpICEI"); // ConfigMag configmag("CRGS"); // string ip=configmag.ReadProperty(gb_name,"server"); // string port=configmag.ReadProperty(gb_name,"port"); // string eventNo=configmag.ReadProperty(gb_name,"eventNo"); // string proxy=configmag.ReadProperty(gb_name,"proxy"); FileStream file; string outstr = ""; file.read(file.getPath(file.getEnvPath()+"/config/udpconfig.json"),outstr); Json::Value jvalue; Json::Reader reader; if(!reader.parse(outstr,jvalue)) { d.Error()<<"can't read json:"< sHDL = new UdpConnection(jvalue[gb_name]["server"].asString(),jvalue[gb_name]["port"].asInt() ); IceUtil::ThreadControl sTC = sHDL->start(); Handle tHDL = new HandleMessage(jvalue[gb_name]["eventno"].asInt(),jvalue[gb_name]["proxy"].asString()); IceUtil::ThreadControl tTC = tHDL->start(); } /********************************************************************** * 概述: 析构函数,进行必要的资源回收 * 函数名: ~zudpICEI * 返回值: * 参数列表: 参数类型 取值范围 描述 * * 版本历史 * 1.0 2010-06-18 echo_li 初次建立 * **********************************************************************/ zudpICEI::~zudpICEI(){ LOG d("zudpIDLI::~zudpICEI"); } /********************************************************************** * 概述: 向外提供的接口,用于接收简单的数据 * 函数名: SendDataShort * 返回值: void * 参数列表: 参数类型 取值范围 描述 * eventNo : [IN/OUT] ::Ice::Int 事件号 * seq : [IN/OUT] const ::Ice::ByteSeq & 传输的数据 * length : [IN/OUT] ::Ice::Int 数据的长度 * current : [IN/OUT] const Ice::Current & * * 版本历史 * 1.0 2010-06-18 echo_li 初次建立 * **********************************************************************/ void baosight::zudpICEI::SendDataShort(::Ice::Int eventNo, const ::Ice::ByteSeq& seq, ::Ice::Int length, const Ice::Current& current) { LOG log("zudpICEI::SendDataShort"); return; } /********************************************************************** * 概述: 向外提供的接口,用于接收复杂的数据传输 * 函数名: SendDataLong * 返回值: void * 参数列表: 参数类型 取值范围 描述 * eventNo : [IN] ::Ice::Int 事件号 * seq : [IN] const ::Ice::ByteSeq & 数据流 * length : [IN] ::Ice::Int 数据长度 * sender : [IN] const ::std::string & 发送方 * reciver : [IN] const ::std::string & 接受方 * aditional : [IN] const ::std::string & 附加信息 * current : [IN] const Ice::Current & * * 版本历史 * 1.0 2010-06-18 echo_li 初次建立 * **********************************************************************/ void baosight::zudpICEI::SendDataLong(::Ice::Int eventNo, const ::Ice::ByteSeq& seq, ::Ice::Int length, const ::std::string& sender, const ::std::string& reciver, const ::std::string& aditional, const Ice::Current& current) { LOG log("zudpICEI::SendDataLong"); log.Debug()<<"zudp SendDataLong"<