2018-07-17 15:15:58 +02:00
|
|
|
#ifndef _RCOMMAND_H
|
|
|
|
#define _RCOMMAND_H
|
2018-07-15 14:28:05 +02:00
|
|
|
|
2020-03-29 18:08:52 +02:00
|
|
|
#include <rom/rtc.h>
|
|
|
|
|
2018-07-17 11:53:43 +02:00
|
|
|
#include "senddata.h"
|
2018-11-04 19:25:11 +01:00
|
|
|
#include "cyclic.h"
|
2018-07-17 11:53:43 +02:00
|
|
|
#include "configmanager.h"
|
2018-07-31 00:00:24 +02:00
|
|
|
#include "lorawan.h"
|
2020-03-29 18:08:52 +02:00
|
|
|
#include "sensor.h"
|
2018-07-31 00:00:24 +02:00
|
|
|
#include "macsniff.h"
|
2019-11-11 12:28:31 +01:00
|
|
|
#include "wifiscan.h"
|
2018-12-22 14:37:47 +01:00
|
|
|
#include "cyclic.h"
|
2019-03-06 23:21:46 +01:00
|
|
|
#include "timekeeper.h"
|
2019-03-09 00:53:11 +01:00
|
|
|
#include "timesync.h"
|
2020-03-29 18:08:52 +02:00
|
|
|
#include "blescan.h"
|
2018-08-12 00:17:57 +02:00
|
|
|
|
2021-01-01 15:25:56 +01:00
|
|
|
// maximum number of elements in rcommand interpreter queue
|
|
|
|
#define RCMD_QUEUE_SIZE 5
|
|
|
|
|
|
|
|
extern TaskHandle_t rcmdTask;
|
|
|
|
|
2018-07-29 16:16:50 +02:00
|
|
|
// table of remote commands and assigned functions
|
|
|
|
typedef struct {
|
2018-07-31 00:00:24 +02:00
|
|
|
const uint8_t opcode;
|
2020-12-11 16:34:17 +01:00
|
|
|
void (*func)(uint8_t[]);
|
2019-08-31 18:37:36 +02:00
|
|
|
const uint8_t params;
|
2018-07-29 16:16:50 +02:00
|
|
|
const bool store;
|
|
|
|
} cmd_t;
|
|
|
|
|
2021-01-01 15:25:56 +01:00
|
|
|
// Struct for remote command processing queue
|
|
|
|
typedef struct {
|
|
|
|
uint8_t cmd[10];
|
|
|
|
uint8_t cmdLen;
|
|
|
|
} RcmdBuffer_t;
|
2020-12-11 16:34:17 +01:00
|
|
|
|
2021-01-01 15:25:56 +01:00
|
|
|
void IRAM_ATTR rcommand(const uint8_t *cmd, const size_t cmdlength);
|
|
|
|
void rcmd_queuereset(void);
|
|
|
|
uint32_t rcmd_queuewaiting(void);
|
|
|
|
void rcmd_deinit(void);
|
|
|
|
esp_err_t rcmd_init(void);
|
2018-07-15 14:28:05 +02:00
|
|
|
|
2019-03-11 18:09:01 +01:00
|
|
|
#endif
|