Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MQTTFreeRTOS.h
00001 /******************************************************************************* 00002 * Copyright (c) 2014, 2015 IBM Corp. 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 * Allan Stockdill-Mander - initial API and implementation and/or initial documentation 00015 *******************************************************************************/ 00016 00017 #if !defined(MQTTFreeRTOS_H) 00018 #define MQTTFreeRTOS_H 00019 00020 #include "FreeRTOS.h" 00021 #include "FreeRTOS_Sockets.h" 00022 #include "FreeRTOS_IP.h" 00023 #include "semphr.h" 00024 #include "task.h" 00025 00026 typedef struct Timer 00027 { 00028 TickType_t xTicksToWait; 00029 TimeOut_t xTimeOut; 00030 } Timer; 00031 00032 typedef struct Network Network; 00033 00034 struct Network 00035 { 00036 xSocket_t my_socket; 00037 int (*mqttread) (Network*, unsigned char*, int, int); 00038 int (*mqttwrite) (Network*, unsigned char*, int, int); 00039 void (*disconnect) (Network*); 00040 }; 00041 00042 void TimerInit(Timer*); 00043 char TimerIsExpired(Timer*); 00044 void TimerCountdownMS(Timer*, unsigned int); 00045 void TimerCountdown(Timer*, unsigned int); 00046 int TimerLeftMS(Timer*); 00047 00048 typedef struct Mutex 00049 { 00050 SemaphoreHandle_t sem; 00051 } Mutex; 00052 00053 void MutexInit(Mutex*); 00054 int MutexLock(Mutex*); 00055 int MutexUnlock(Mutex*); 00056 00057 typedef struct Thread 00058 { 00059 TaskHandle_t task; 00060 } Thread; 00061 00062 int ThreadStart(Thread*, void (*fn)(void*), void* arg); 00063 00064 int FreeRTOS_read(Network*, unsigned char*, int, int); 00065 int FreeRTOS_write(Network*, unsigned char*, int, int); 00066 void FreeRTOS_disconnect(Network*); 00067 00068 void NetworkInit(Network*); 00069 int NetworkConnect(Network*, char*, int); 00070 /*int NetworkConnectTLS(Network*, char*, int, SlSockSecureFiles_t*, unsigned char, unsigned int, char);*/ 00071 00072 #endif
Generated on Wed Jul 13 2022 10:46:02 by
1.7.2