Jack Hansdampf / mbed-mqtt-GSOE1

Dependents:   ESP8266MQTT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MQTTSNGWEncapsulatedPacket.h Source File

MQTTSNGWEncapsulatedPacket.h

00001 /**************************************************************************************
00002  * Copyright (c) 2018, Tomoaki Yamaguchi
00003  *
00004  * All rights reserved. This program and the accompanying materials
00005  * are made available under the terms of the Eclipse Public License v1.0
00006  * and Eclipse Distribution License v1.0 which accompany this distribution.
00007  *
00008  * The Eclipse Public License is available at
00009  *    http://www.eclipse.org/legal/epl-v10.html
00010  * and the Eclipse Distribution License is available at
00011  *   http://www.eclipse.org/org/documents/edl-v10.php.
00012  *
00013  * Contributors:
00014  *    Tomoaki Yamaguchi - initial API and implementation and/or initial documentation
00015  **************************************************************************************/
00016 
00017 #ifndef MQTTSNGATEWAY_SRC_MQTTSNGWENCAPSULATEDPACKET_H_
00018 #define MQTTSNGATEWAY_SRC_MQTTSNGWENCAPSULATEDPACKET_H_
00019 
00020 namespace MQTTSNGW
00021 {
00022 
00023 class WirelessNodeId
00024 {
00025     friend class MQTTSNGWEncapsulatedPacket;
00026 public:
00027     WirelessNodeId();
00028     ~WirelessNodeId();
00029     void setId(uint8_t* id, uint8_t len);
00030     void setId(WirelessNodeId* id);
00031     bool operator ==(WirelessNodeId& id);
00032 private:
00033     uint8_t _len;
00034     uint8_t* _nodeId;
00035 };
00036 
00037 class MQTTSNGWEncapsulatedPacket
00038 {
00039 public:
00040     MQTTSNGWEncapsulatedPacket();
00041     MQTTSNGWEncapsulatedPacket(MQTTSNPacket* packet);
00042     ~MQTTSNGWEncapsulatedPacket();
00043     int unicast(SensorNetwork* network, SensorNetAddress* sendTo);
00044     int serialize(uint8_t* buf);
00045     int desirialize(unsigned char* buf, unsigned short len);
00046     int getType(void);
00047     unsigned char* getPacketData(void);
00048     int getPacketLength(void);
00049     const char* getName();
00050     MQTTSNPacket* getMQTTSNPacket(void);
00051     void setWirelessNodeId(WirelessNodeId* id);
00052     WirelessNodeId* getWirelessNodeId(void);
00053     char* print(char* buf);
00054 
00055 private:
00056     MQTTSNPacket* _mqttsn;
00057     WirelessNodeId _id;
00058     uint8_t _ctrl;
00059 };
00060 
00061 }
00062 
00063 
00064 
00065 #endif /* MQTTSNGATEWAY_SRC_MQTTSNGWENCAPSULATEDPACKET_H_ */