Jack Hansdampf / mbed-mqtt-GSOE1

Dependents:   ESP8266MQTT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MQTTSNGWPacketHandleTask.h Source File

MQTTSNGWPacketHandleTask.h

00001 /**************************************************************************************
00002  * Copyright (c) 2016, 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 MQTTSNGWPACKETHANDLETASK_H_
00018 #define MQTTSNGWPACKETHANDLETASK_H_
00019 
00020 #include "Timer.h"
00021 #include "MQTTSNGWProcess.h"
00022 namespace MQTTSNGW
00023 {
00024 class Gateway;
00025 class Client;
00026 class MQTTSNPacket;
00027 class MQTTGWPacket;
00028 class Timer;
00029 class MQTTGWConnectionHandler;
00030 class MQTTGWPublishHandler;
00031 class MQTTGWSubscribeHandler;
00032 class MQTTSNConnectionHandler;
00033 class MQTTSNPublishHandler;
00034 class MQTTSNSubscribeHandler;
00035 
00036 class MQTTSNAggregateConnectionHandler;
00037 
00038 #define ERRNO_APL_01  11    // Task Initialize Error
00039 
00040 class Thread;
00041 class Timer;
00042 /*=====================================
00043         Class PacketHandleTask
00044  =====================================*/
00045 class PacketHandleTask : public Thread
00046 {
00047     MAGIC_WORD_FOR_THREAD;
00048     friend class MQTTGWAggregatePublishHandler;
00049     friend class MQTTGWAggregateSubscribeHandler;
00050     friend class MQTTSNAggregateConnectionHandler;
00051     friend class MQTTSNAggregatePublishHandler;
00052     friend class MQTTSNAggregateSubscribeHandler;
00053 public:
00054     PacketHandleTask(Gateway* gateway);
00055     ~PacketHandleTask();
00056     void run();
00057 private:
00058     void aggregatePacketHandler(Client*client, MQTTSNPacket* packet);
00059     void aggregatePacketHandler(Client*client, MQTTGWPacket* packet);
00060     void transparentPacketHandler(Client*client, MQTTSNPacket* packet);
00061     void transparentPacketHandler(Client*client, MQTTGWPacket* packet);
00062 
00063     Gateway* _gateway {nullptr};
00064     Timer _advertiseTimer;
00065     Timer _sendUnixTimer;
00066     MQTTGWConnectionHandler* _mqttConnection {nullptr};
00067     MQTTGWPublishHandler*    _mqttPublish {nullptr};
00068     MQTTGWSubscribeHandler*  _mqttSubscribe {nullptr};
00069     MQTTSNConnectionHandler* _mqttsnConnection {nullptr};
00070     MQTTSNPublishHandler*    _mqttsnPublish {nullptr};
00071     MQTTSNSubscribeHandler*  _mqttsnSubscribe {nullptr};
00072 
00073     MQTTSNAggregateConnectionHandler* _mqttsnAggrConnection {nullptr};
00074 };
00075 
00076 
00077 }
00078 
00079 #endif /* MQTTSNGWPACKETHANDLETASK_H_ */