mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 07:00:05 +08:00
71 lines
1.9 KiB
C
Executable File
71 lines
1.9 KiB
C
Executable File
/*******************************************************************************
|
|
* Copyright (c) 2014, 2015 IBM Corp.
|
|
*
|
|
* All rights reserved. This program and the accompanying materials
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
* and Eclipse Distribution License v1.0 which accompany this distribution.
|
|
*
|
|
* The Eclipse Public License is available at
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
* and the Eclipse Distribution License is available at
|
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
|
*
|
|
* Contributors:
|
|
* Allan Stockdill-Mander - initial API and implementation and/or initial documentation
|
|
*******************************************************************************/
|
|
|
|
#if !defined(MQTTFreeRTOS_H)
|
|
#define MQTTFreeRTOS_H
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/semphr.h"
|
|
#include "freertos/task.h"
|
|
|
|
typedef struct Timer
|
|
{
|
|
portTickType xTicksToWait;
|
|
xTimeOutType xTimeOut;
|
|
} Timer;
|
|
|
|
typedef struct Network Network;
|
|
|
|
struct Network
|
|
{
|
|
int my_socket;
|
|
int (*mqttread) (Network*, unsigned char*, int, int);
|
|
int (*mqttwrite) (Network*, unsigned char*, int, int);
|
|
void (*disconnect) (Network*);
|
|
};
|
|
|
|
void TimerInit(Timer*);
|
|
char TimerIsExpired(Timer*);
|
|
void TimerCountdownMS(Timer*, unsigned int);
|
|
void TimerCountdown(Timer*, unsigned int);
|
|
int TimerLeftMS(Timer*);
|
|
|
|
typedef struct Mutex
|
|
{
|
|
xSemaphoreHandle sem;
|
|
} Mutex;
|
|
|
|
void MutexInit(Mutex*);
|
|
int MutexLock(Mutex*);
|
|
int MutexUnlock(Mutex*);
|
|
|
|
typedef struct Thread
|
|
{
|
|
xTaskHandle task;
|
|
} Thread;
|
|
|
|
int ThreadStart(Thread*, void (*fn)(void*), void* arg);
|
|
|
|
int esp_read(Network*, unsigned char*, int, int);
|
|
int esp_write(Network*, unsigned char*, int, int);
|
|
void esp_disconnect(Network*);
|
|
|
|
void NetworkInit(Network*);
|
|
int NetworkConnect(Network*, char*, int);
|
|
/*int NetworkConnectTLS(Network*, char*, int, SlSockSecureFiles_t*, unsigned char, unsigned int, char);*/
|
|
|
|
#endif
|