コード例 #1
0
ファイル: nwk_ping.c プロジェクト: ApertureLabsLtd/ChronIC
fhStatus_t nwk_processPing(mrfiPacket_t *frame)
{
    fhStatus_t rc;
    uint8_t replyType;

    /* If we sent this then this is the reply. Validate the
     * packet for reception by client app. If we didn't send
     * it then we are the target. Send the reply.
     */
    replyType = nwk_isValidReply(frame, sTid, PB_REQ_OS, PB_TID_OS);
    if (SMPL_MY_REPLY == replyType)
    {
        /* It's a match and it's a reply. Validate the received packet by
         * returning a 1 so it can be received by the client app.
         */
        MRFI_PostKillSem();
        rc = FHS_KEEP;
    }
#if !defined(END_DEVICE)
    else if (SMPL_A_REPLY == replyType)
    {
        /* no match. If I'm not an ED this is a reply that should be passed on. */
        rc = FHS_REPLAY;
    }
#endif  /* !END_DEVICE */
    else
    {
        /* No, we didn't send it. Send reply assuming it's a Ping intended for us. */
        handlePingRequest(frame);

        rc = FHS_RELEASE;
    }

    return rc;
}
コード例 #2
0
void MqttSnClient::handleInternal(uint8_t* iBuffer) {
   Header* header = reinterpret_cast<Header*>(iBuffer);
   switch(header->msgType) {
      case PUBLISH   : handlePublish(iBuffer);      return;
      case REGISTER  : handleRegister(iBuffer);     return;
      case PINGREQ   : handlePingRequest(iBuffer);  return;
      case PINGRESP  : handlePingResponse(iBuffer); return;
   }

   BT_LOG_WARNING_AND_PARAMETER("drop unexpected/unsupported message of type ", header->msgType);
}