Jack Hansdampf / mbed-mqtt-GSOE1

Dependents:   ESP8266MQTT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LTaskManager.h Source File

LTaskManager.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 TASKMANAGER_H_
00018 #define TASKMANAGER_H_
00019 
00020 #include <stdio.h>
00021 #include <string.h>
00022 #include <time.h>
00023 
00024 #include "LMqttsnClientApp.h"
00025 #include "LTimer.h"
00026 
00027 using namespace std;
00028 
00029 namespace linuxAsyncClient {
00030 
00031 struct TaskList{
00032     void     (*callback)(void);
00033     time_t   interval;
00034     time_t    prevTime;
00035     uint8_t  count;
00036 };
00037 
00038 struct TestList {
00039     const char* testLabel;
00040     void     (*testTask)(void);
00041     uint8_t  count;
00042 };
00043 
00044 /*========================================
00045        Class TaskManager
00046  =======================================*/
00047 class LTaskManager{
00048 public:
00049     LTaskManager();
00050     ~LTaskManager();
00051     void add(TaskList* task);
00052     void add(TestList* test);
00053     void run(void);
00054     void done(uint8_t index);
00055     void suspend(uint8_t index);
00056     uint8_t getIndex(void);
00057 private:
00058     TaskList* _tasks;
00059     TestList* _tests;
00060     uint8_t   _index;
00061 
00062 };
00063 
00064 } /* end of namespace */
00065 #endif /* TASKMANAGER_H_ */
00066