当前位置: 首页>>代码示例>>C++>>正文


C++ WirelessPacket::payload方法代码示例

本文整理汇总了C++中WirelessPacket::payload方法的典型用法代码示例。如果您正苦于以下问题:C++ WirelessPacket::payload方法的具体用法?C++ WirelessPacket::payload怎么用?C++ WirelessPacket::payload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WirelessPacket的用法示例。


在下文中一共展示了WirelessPacket::payload方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

    bool 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_nodeErrorReply ||             //app data type
           packet.nodeAddress() != m_nodeAddress ||                                  //node address
           payload.size() != 0x05 ||                                                 //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 error code from the response
        m_success = false;
        m_errorCode = static_cast<WirelessPacket::ResponseErrorCode>(packet.payload().read_uint8(4));

        return true;
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:25,代码来源:ReadEeprom_v2.cpp

示例2: integrityCheck

    bool HclSmartBearing_CalPacket::integrityCheck(const WirelessPacket& packet)
    {
        //verify the delivery stop flags are what we expected
        if(!packet.deliveryStopFlags().pc)
        {
            //packet not intended for the PC
            return false;
        }

        //verify the packet type is correct
        if(packet.type() != packetType_HclSmartBearing_Calibrated)
        {
            //packet is not a Sync Sampling packet
            return false;
        }

        const WirelessPacket::Payload& payload = packet.payload();

        //verify the payload size
        if(payload.size() < 42)
        {
            return false;
        }

        return true;
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:26,代码来源:HclSmartBearing_CalPacket.cpp

示例3:

    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;
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:27,代码来源:StartNonSyncSampling_v2.cpp

示例4:

    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;
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:29,代码来源:BaseStation_Ping_v2.cpp

示例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;
}
开发者ID:estump,项目名称:MSCL,代码行数:32,代码来源:AutoCal.cpp

示例6:

    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;
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:31,代码来源:LongPing.cpp

示例7:

    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;
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:25,代码来源:BaseStation_RfSweepStart.cpp

示例8:

    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;
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:25,代码来源:BaseStation_ReadEeprom_v2.cpp

示例9:

    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;
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:25,代码来源:BaseStation_SetBeacon_v2.cpp

示例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();
    }
开发者ID:fsaks,项目名称:MSCL,代码行数:14,代码来源:DiagnosticPacket.cpp

示例11:

bool NodeDiscoveryPacket_v2::integrityCheck(const WirelessPacket& packet)
{
    const uint8 RADIO_CHANNEL_MIN = 11;
    const uint8 RADIO_CHANNEL_MAX = 26;

    //verify the payload size is correct
    if(packet.payload().size() != 15)
    {
        return false;
    }

    //read what should be the radio channel byte
    uint8 radioChannel = packet.payload().read_uint8(PAYLOAD_OFFSET_RADIO_CHANNEL);

    //verify that the radio channel byte is valid
    if(radioChannel < RADIO_CHANNEL_MIN || radioChannel > RADIO_CHANNEL_MAX)
    {
        return false;
    }

    //verify the delivery stop flags are what we expected
    if(packet.deliveryStopFlags() != stopFlags_nodeDiscovery)
    {
        //packet not intended for the PC
        return false;
    }

    //verify the packet type is correct
    if(packet.type() != packetType_nodeDiscovery_v2)
    {
        //packet is not a node discovery packet
        return false;
    }

    //packet looks valid
    return true;
}
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:37,代码来源:NodeDiscoveryPacket_v2.cpp

示例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();
	}
开发者ID:estump,项目名称:MSCL,代码行数:15,代码来源:HclSmartBearing_RawPacket.cpp

示例13: 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;
}
开发者ID:estump,项目名称:MSCL,代码行数:15,代码来源:Test_AutoCal.cpp

示例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;
}
开发者ID:estump,项目名称:MSCL,代码行数:15,代码来源:Test_WriteEeprom.cpp

示例15: 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();
    }
开发者ID:LORD-MicroStrain,项目名称:MSCL,代码行数:15,代码来源:BufferedLdcPacket.cpp


注:本文中的WirelessPacket::payload方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。