本文整理汇总了C++中WirelessPacket::nodeAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ WirelessPacket::nodeAddress方法的具体用法?C++ WirelessPacket::nodeAddress怎么用?C++ WirelessPacket::nodeAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WirelessPacket
的用法示例。
在下文中一共展示了WirelessPacket::nodeAddress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool StartNonSyncSampling_v2::Response::match(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
//check the main bytes of the packet
if( packet.deliveryStopFlags().toInvertedByte() != 0x07 || //delivery stop flag
packet.type() != WirelessPacket::packetType_nodeSuccessReply || //app data type
packet.nodeAddress() != m_nodeAddress || //node address
payload.size() != 0x02 || //payload length
payload.read_uint16(0) != WirelessProtocol::cmdId_startLdc_v2 //Command ID
)
{
//failed to match some of the bytes
return false;
}
//if we made it here, the packet matches the response pattern
m_success = true;
//we have fully matched the response
m_fullyMatched = true;
//notify that the response was matched
m_matchCondition.notify();
return true;
}
示例2:
bool BaseStation_Ping_v2::Response::match(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
//check the main bytes of the packet
if(packet.deliveryStopFlags().toInvertedByte() != 0x07 || //delivery stop flag
packet.type() != 0x31 || //app data type
packet.nodeAddress() != WirelessProtocol::BASE_STATION_ADDRESS || //node address
payload.size() != 0x02 || //payload length
payload.read_uint16(0) != WirelessProtocol::cmdId_basePing_v2 //command id
)
{
//failed to match some of the bytes
return false;
}
//if we made it here, the packet matches the response pattern
//the ping was a success
m_success = true;
//we have fully matched the response
m_fullyMatched = true;
//notify that the response was matched
m_matchCondition.notify();
return true;
}
示例3:
bool LongPing::Response::match(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
//check the main bytes of the packet
if( packet.deliveryStopFlags().toInvertedByte() != 0x07 || //delivery stop flag
packet.type() != 0x02 || //app data type
packet.nodeAddress() != m_nodeAddress || //node address
payload.size() != 0x02 || //payload length
payload.read_uint16(0) != 0x0000
)
{
//failed to match some of the bytes
return false;
}
//if we made it here, the packet matches the response pattern
//store the node and base RSSI values with the PingResponse
m_result = PingResponse::ResponseSuccess(packet.nodeRSSI(), packet.baseRSSI());
//we have fully matched the response
m_fullyMatched = true;
//notify that the response was matched
m_matchCondition.notify();
m_success = true;
return true;
}
示例4:
bool BaseStation_SetBeacon_v2::Response::matchFailResponse(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
//check the main bytes of the packet
if(packet.deliveryStopFlags().toInvertedByte() != 0x07 || //delivery stop flag
packet.type() != WirelessPacket::packetType_baseErrorReply || //app data type
packet.nodeAddress() != WirelessProtocol::BASE_STATION_ADDRESS || //node address
payload.size() != 0x07 || //payload length
payload.read_uint16(0) != WirelessProtocol::cmdId_base_setBeacon || //command ID
payload.read_uint32(2) != m_beaconStartTime //beacon timestamp
)
{
//failed to match some of the bytes
return false;
}
//Not doing anything with the error code as of now
//uint8 errorCode = payload.read_uint8(6);
//set the result to failure
m_success = false;
return true;
}
示例5:
bool AutoCal::Response::match_nodeReceived(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
//check the main bytes of the packet
if(packet.deliveryStopFlags().toByte() != 0x07 || //delivery stop flag
packet.type() != 0x20 || //app data type
packet.nodeAddress() != m_nodeAddress || //node address
payload.size() != 0x07 //payload length
)
{
//failed to match some of the bytes
return false;
}
//Command ID
if(payload.read_uint16(0) != 0x0064)
{
return false;
}
//if the status flag is success (0)
if(payload.read_uint8(2) == 0)
{
m_calStarted = true;
//only want to read the time until completion if the cal has started
m_timeUntilCompletion = payload.read_float(3);
}
return true;
}
示例6:
bool ReadEeprom_v2::Response::matchSuccessResponse(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
uint8 dsf = packet.deliveryStopFlags().toInvertedByte();
//check the main bytes of the packet
if((dsf != 0x07 && dsf != 0x00) || //delivery stop flag (Unfortunately some nodes report 0x00 and some report 0x07)
packet.type() != 0x00 || //app data type
packet.nodeAddress() != m_nodeAddress || //node address
payload.size() != 0x06 || //payload length
payload.read_uint16(0) != WirelessProtocol::cmdId_readEeprom_v2 || //command ID
payload.read_uint16(2) != m_eepromAddress //eeprom address
)
{
//failed to match some of the bytes
return false;
}
//if we made it here, the packet matches the response pattern
//get the eeprom value from the response
m_success = true;
m_errorCode = WirelessPacket::error_none;
m_eepromValue = packet.payload().read_uint16(4);
return true;
}
示例7:
bool BaseStation_ReadEeprom_v2::Response::matchFailResponse(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
//check the main bytes of the packet
if(packet.deliveryStopFlags().toInvertedByte() != 0x07 || //delivery stop flag
packet.type() != WirelessPacket::packetType_baseErrorReply || //app data type
packet.nodeAddress() != WirelessProtocol::BASE_STATION_ADDRESS || //node address
payload.size() != 0x05 || //payload length
payload.read_uint16(0) != WirelessProtocol::cmdId_base_readEeprom_v2 || //command ID
payload.read_uint16(2) != m_eepromAddress //eeprom address
)
{
//failed to match some of the bytes
return false;
}
//read the error code from the response
m_errorCode = static_cast<WirelessPacket::ResponseErrorCode>(payload.read_uint8(4));
//set the result to failure
m_success = false;
return true;
}
示例8:
bool BaseStation_RfSweepStart::Response::matchSuccessResponse(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
//check the main bytes of the packet
if(packet.deliveryStopFlags().toInvertedByte() != 0x07 || //delivery stop flag
packet.type() != WirelessPacket::packetType_baseSuccessReply || //app data type
packet.nodeAddress() != WirelessProtocol::BASE_STATION_ADDRESS || //node address
payload.size() != 16 || //payload length
payload.read_uint16(0) != WirelessProtocol::cmdId_base_rfScan || //command ID
payload.read_uint16(2) != m_options ||
payload.read_uint32(4) != m_min ||
payload.read_uint32(8) != m_max ||
payload.read_uint32(12) != m_interval
)
{
//failed to match some of the bytes
return false;
}
//set the result to success
m_success = true;
return true;
}
示例9: addNodeDiscoveryPacket
void WirelessPacketCollector::addNodeDiscoveryPacket(const WirelessPacket& packet)
{
//create a boost_lock for thread safety
mutex_lock_guard lock(m_nodeDiscoveryMutex);
//update the last communication time
NodeCommTimes::updateCommTime(packet.nodeAddress());
//add a Node Discovery packet to the node discovery packet container
m_nodeDiscoveryPackets.push_back( NodeDiscovery(packet) );
}
示例10: parseSweeps
DiagnosticPacket::DiagnosticPacket(const WirelessPacket& packet)
{
//construct the data packet from the wireless packet passed in
m_nodeAddress = packet.nodeAddress();
m_deliveryStopFlags = packet.deliveryStopFlags();
m_type = packet.type();
m_nodeRSSI = WirelessTypes::UNKNOWN_RSSI;
m_baseRSSI = packet.baseRSSI();
m_frequency = packet.frequency();
m_payload = packet.payload();
//parse the data sweeps in the packet
parseSweeps();
}
示例11: isDuplicate
bool WirelessParser::isDuplicate(const WirelessPacket& packet)
{
uint16 uniqueId;
uint32 packetsNode = packet.nodeAddress();
//check the packet type
switch(packet.type())
{
//get the unique id depending on the type of packet
case WirelessPacket::packetType_LDC: uniqueId = LdcPacket::getUniqueId(packet); break;
case WirelessPacket::packetType_SyncSampling: uniqueId = SyncSamplingPacket::getUniqueId(packet); break;
case WirelessPacket::packetType_BufferedLDC: uniqueId = BufferedLdcPacket::getUniqueId(packet); break;
case WirelessPacket::packetType_LDC_16ch: uniqueId = LdcPacket_16ch::getUniqueId(packet); break;
case WirelessPacket::packetType_SyncSampling_16ch: uniqueId = SyncSamplingPacket_16ch::getUniqueId(packet); break;
case WirelessPacket::packetType_BufferedLDC_16ch: uniqueId = BufferedLdcPacket_16ch::getUniqueId(packet); break;
case WirelessPacket::packetType_AsyncDigital: uniqueId = AsyncDigitalPacket::getUniqueId(packet); break;
case WirelessPacket::packetType_AsyncDigitalAnalog: uniqueId = AsyncDigitalAnalogPacket::getUniqueId(packet); break;
case WirelessPacket::packetType_diagnostic: uniqueId = DiagnosticPacket::getUniqueId(packet); break;
case WirelessPacket::packetType_roller: uniqueId = RollerPacket::getUniqueId(packet); break;
//isn't a valid data packet that has a unique id, so we can't check for duplicates
case WirelessPacket::packetType_nodeDiscovery:
case WirelessPacket::packetType_nodeDiscovery_v2:
case WirelessPacket::packetType_nodeDiscovery_v3:
case WirelessPacket::packetType_nodeDiscovery_v4:
case WirelessPacket::packetType_SHM:
case WirelessPacket::packetType_beaconEcho:
case WirelessPacket::packetType_rfScanSweep:
default:
return false;
}
//if we found the packet's node address in the lastPacketMap
if(m_lastPacketMap.find(packetsNode) != m_lastPacketMap.end())
{
//if the unique id in the lastPacketMap matches the uniqueId from this packet
if(m_lastPacketMap[packetsNode] == uniqueId)
{
//it is a duplicate packet
return true;
}
}
//update or set m_lastPacketMap's uniqueId for this node
m_lastPacketMap[packetsNode] = uniqueId;
//it is not a duplicate packet
return false;
}
示例12:
HclSmartBearing_RawPacket::HclSmartBearing_RawPacket(const WirelessPacket& packet)
{
//construct the data packet from the wireless packet passed in
m_nodeAddress = packet.nodeAddress();
m_deliveryStopFlags = packet.deliveryStopFlags();
m_type = packet.type();
m_nodeRSSI = packet.nodeRSSI();
m_baseRSSI = packet.baseRSSI();
m_frequency = packet.frequency();
m_payload = packet.payload();
m_payloadOffsetChannelData = 0; //not used for these packets
//parse the data sweeps in the packet
parseSweeps();
}
示例13: parseSweeps
BufferedLdcPacket::BufferedLdcPacket(const WirelessPacket& packet)
{
//construct the data packet from the wireless packet passed in
m_nodeAddress = packet.nodeAddress();
m_deliveryStopFlags = packet.deliveryStopFlags();
m_type = packet.type();
m_nodeRSSI = WirelessTypes::UNKNOWN_RSSI;
m_baseRSSI = packet.baseRSSI();
m_frequency = packet.frequency();
m_payload = packet.payload();
m_payloadOffsetChannelData = PAYLOAD_OFFSET_CHANNEL_DATA;
//parse the data sweeps in the packet
parseSweeps();
}
示例14: buildWriteEepromResponse
WirelessPacket buildWriteEepromResponse(int nodeAddress)
{
Bytes payload;
payload.push_back(0x00);
payload.push_back(0x04);
//build the correct packet response first
WirelessPacket packet;
packet.deliveryStopFlags(DeliveryStopFlags::fromByte(0x00));
packet.type(static_cast<WirelessPacket::PacketType>(0x00));
packet.nodeAddress(nodeAddress);
packet.payload(payload);
return packet;
}
示例15: buildAutoCalNodeRecResponse
WirelessPacket buildAutoCalNodeRecResponse(int nodeAddress)
{
ByteStream payload;
payload.append_uint16(0x0064); //cmd id
payload.append_uint8(0x00); //status flag
payload.append_float(5.0f); //time to completion
WirelessPacket packet;
packet.deliveryStopFlags(DeliveryStopFlags::fromByte(0x07));
packet.type(WirelessPacket::packetType_NodeReceived);
packet.nodeAddress(nodeAddress);
packet.payload(payload.data());
return packet;
}