eis/src/zudp/zudpICEI.cpp

151 lines
5.2 KiB
C++
Raw Normal View History

#include <iXcomTCP2.h>
#include <zudp/zudpICEI.h>
#include <common/L2Event.h>
#include <IceUtil/Thread.h>
#include <iDA/iDA.h>
#include <json/json.h>
#include <zudp/HandleMessage.h>
#include <base/FileStream.h>
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<UdpConnection> 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:"<<outstr<<endl;
return ;
}
// d.Debug()<<jvalue[gb_name]["server"]<<endl;
// d.Debug()<<jvalue[gb_name]["port"]<<endl;
// d.Debug()<<jvalue[gb_name]["eventno"]<<endl;
// d.Debug()<<jvalue[gb_name]["proxy"]<<endl;
Handle<UdpConnection> sHDL = new UdpConnection(jvalue[gb_name]["server"].asString(),jvalue[gb_name]["port"].asInt() );
IceUtil::ThreadControl sTC = sHDL->start();
Handle<HandleMessage> 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"<<endl;
}
/**********************************************************************
* :
* TimeNotify
* void
*
* eventNo : [IN] ::Ice::Int
* seq : [IN] const ::Ice::ByteSeq &
* current : [IN] const Ice::Current &
*
*
* 1.0 2010-06-18 echo_li
*
**********************************************************************/
void
baosight::zudpICEI::TimeNotify(::Ice::Int eventNo,
const ::Ice::ByteSeq& seq,
const Ice::Current& current)
{
LOG log("zudpICEI::TimeNotify");
// commit changes on success
log.Debug()<<"zudp TimeNotify"<<endl;
}