94 lines
2.8 KiB
C
94 lines
2.8 KiB
C
/*
|
|
* "TinySA_wifi.h"
|
|
*
|
|
* Definitions and function prototypes for the WiFi capability.
|
|
*/
|
|
|
|
#ifndef TINYSA_WIFI_H_
|
|
#define TINYSA_WIFI_H_ // Prevent double inclusion
|
|
|
|
#include "Arduino.h" // Basic Arduino definitions
|
|
#include "simpleSA.h" // Program definitions
|
|
#include "si4432.h" // RF module definitions
|
|
|
|
#include <WiFi.h> // WiFi library
|
|
#include <AsyncTCP.h>
|
|
#include "ESPAsyncWebServer.h" // ESP32 Webserver library
|
|
#include "SPIFFS.h" // ESP32 File system
|
|
#include <TFT_eSPI.h> // Display library
|
|
#include "cmd.h"
|
|
|
|
#include <AsyncJson.h>
|
|
#include <ArduinoJson.h> // Install using Library Manager or go to arduinojson.org
|
|
|
|
|
|
/*
|
|
* Install WebSocketes library by Markus Sattler
|
|
* https://github.com/Links2004/arduinoWebSockets
|
|
*/
|
|
|
|
#include <WebSocketsServer.h>
|
|
|
|
#include <HardwareSerial.h>
|
|
#include <time.h>
|
|
#include <sys/time.h>
|
|
|
|
#define SSID_NAME "simpleSA" // Name of access point
|
|
|
|
|
|
/*
|
|
* Function prototypes:
|
|
*/
|
|
|
|
boolean startAP ();
|
|
boolean connectWiFi ();
|
|
void buildServer ();
|
|
void addTagNameValue ( char *b, char *_name, char *value );
|
|
char *escapeXML ( char *s );
|
|
void webSocketEvent ( uint8_t num, WStype_t type, uint8_t* payload, size_t lenght );
|
|
char *FormatIPAddress ( IPAddress ipAddress );
|
|
void pushSettings ();
|
|
void pushIFSweepSettings ();
|
|
void pushRXSweepSettings ();
|
|
void pushBandscopeSettings ();
|
|
void pushSigGenSettings ();
|
|
void initChunkSweepDoc (uint32_t startIndex);
|
|
|
|
/*
|
|
* Functions outside of "TinySA_wifi:
|
|
*/
|
|
|
|
int GetPointsAsXML ( void textHandler (char *s) );
|
|
// void set_sweep_frequency ( int type, int32_t frequency );
|
|
// void SetRBW ( int );
|
|
// void SetAttenuation ( int a );
|
|
// void RequestSetPowerLevel ( float o );
|
|
// void SetPowerLevel ( double o );
|
|
// void SetPowerReference (int freq );
|
|
// void SetLoDrive ( uint8_t level );
|
|
// bool SetIFFrequency ( int32_t f );
|
|
// void SetPreAmpGain ( int g );
|
|
void WriteSettings ();
|
|
// void SetSpur ( int v );
|
|
|
|
/*
|
|
* variables and objects outside of TinySA_wifi
|
|
*/
|
|
|
|
extern settings_t setting;
|
|
|
|
extern uint8_t myData[SCREEN_WIDTH+1];
|
|
extern uint8_t myStorage[SCREEN_WIDTH+1];
|
|
extern uint8_t myActual[SCREEN_WIDTH+1];
|
|
extern uint8_t myGain[SCREEN_WIDTH+1]; // M0WID addition to record preamp gain
|
|
extern uint32_t myFreq[SCREEN_WIDTH+1]; // M0WID addition to store frequency for XML file
|
|
|
|
|
|
extern WebSocketsServer webSocket; // Initiated in TinySA.ino
|
|
extern TFT_eSPI tft; // TFT Screen object
|
|
extern bandpassFilter_t bandpassFilters[11];
|
|
extern float bandwidth;
|
|
extern uint32_t sweepPoints; // Number of points in the sweep. Can be more than DISPLAY_POINTS if RBW is set less than video resolution
|
|
|
|
#endif
|