本文整理汇总了C++中Packet::AddValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Packet::AddValue方法的具体用法?C++ Packet::AddValue怎么用?C++ Packet::AddValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet::AddValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TakeAction
// Decide proper action and perform the job.
void Action::TakeAction(){
// Do action following message type
Packet pkt;
std::string result;
std::string temp;
switch(m_GivenPkt.m_MsgType){
case AP_REGISTRATION_REQUEST:
InsertDatabase();
SendResponseMessage(AP_REGISTRATION_RESPONSE, pkt);
break;
//case AP_REGISTRATION_RESPONSE:
//break;
case AP_STATE_UPDATE_REQUEST:
UpdateDatabase();
SendResponseMessage(AP_STATE_UPDATE_RESPONSE, pkt);
break;
//case AP_STATE_UPDATE_RESPONSE:
//break;
case AP_LIST_REQUEST:
result = m_db->GetResult("select ID, IP, SSID from AP_Information;");
//Parse the result by '|' mark
//and make pkt context
while(true)
{
temp = result.substr(0,result.find('|'));
result.erase(0,result.find('|')+1);
pkt.AddValue(AP_ID, temp);
temp = result.substr(0,result.find('|'));
result.erase(0,result.find('|')+1);
pkt.AddValue(AP_IP, temp);
temp = result.substr(0,result.find('|'));
result.erase(0,result.find('|')+1);
pkt.AddValue(AP_SSID, temp);
if(result.length() < 1) break;
}
SendResponseMessage(AP_LIST_RESPONSE, pkt);
break;
default:
break;
}
}
示例2: SendAPStateUpdateRequest
/***********************************************
*void Report::SendAPUpdateRequest()
* Make AP Update Request
* Send Message to Manager
* Receive ACK from Manager
********************************************/
void Report::SendAPStateUpdateRequest(){
//Make Message
Packet pkt;
pkt.DecideMessageType(AP_STATE_UPDATE_REQUEST);
for(int type=AP_ID; type<=AP_CHANNEL; type++){
pkt.AddValue(type, m_APInfo.GetAPInformation(type));
}
/*
for(int type=AP_ID; type<=AP_DESCRIPTION; type++){
pkt.AddValue(type, m_APInfo.GetAPInformation(type));
}*/
string msg = pkt.CreateMessage();
//Send Message to OpenWinNet Manager
cout << PrintTime() << "[S] AP_STATE_UPDATE REQUEST" << endl;
m_sock.send(msg);
msg.clear();
}