2022-05-02 16:01:01 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
|
|
|
|
/* Debug */
|
|
|
|
|
|
|
|
// The baud rate used for the debug serial interface
|
|
|
|
constexpr uint32_t serialBaudRate = 115200;
|
|
|
|
|
|
|
|
|
|
|
|
/* Keys */
|
|
|
|
|
2023-08-07 15:17:04 +02:00
|
|
|
// The number of remote devices
|
|
|
|
constexpr int remoteDeviceCount = 1;
|
|
|
|
|
2022-05-02 16:01:01 +02:00
|
|
|
// The size of the symmetric keys used for signing and verifying messages
|
|
|
|
constexpr size_t keySize = 32;
|
|
|
|
|
|
|
|
// The symmetric key used by the remote to sign unlock messages
|
|
|
|
constexpr const uint8_t remoteKey[keySize] = {
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
};
|
|
|
|
|
|
|
|
// The symmetric key used by this device to sign response messages
|
|
|
|
constexpr const uint8_t localKey[keySize] = {
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* WiFi */
|
|
|
|
|
|
|
|
// The WiFi network to connect to
|
|
|
|
constexpr const char* wifiSSID = "MyWiFi";
|
|
|
|
|
|
|
|
// The WiFi password to connect to the above network
|
|
|
|
constexpr const char* wifiPassword = "00000000";
|
|
|
|
|
2023-04-11 14:33:58 +02:00
|
|
|
// The name of the device on the network
|
|
|
|
constexpr const char* networkName = "Sesame-Device";
|
|
|
|
|
2022-05-02 16:01:01 +02:00
|
|
|
// The interval to reconnect to WiFi if the connection is broken
|
|
|
|
constexpr uint32_t wifiReconnectInterval = 10000;
|
|
|
|
|
2023-04-11 14:33:58 +02:00
|
|
|
/* Local server */
|
|
|
|
|
|
|
|
// The port for the local server to directly receive messages over WiFi
|
|
|
|
constexpr uint16_t localPort = 80;
|
|
|
|
|
|
|
|
// The url parameter to send the message to the local server
|
|
|
|
constexpr char messageUrlParameter[] = "m";
|
|
|
|
|
2022-05-02 16:01:01 +02:00
|
|
|
|
|
|
|
/* Server */
|
|
|
|
|
|
|
|
// The remote server to connect to
|
|
|
|
constexpr const char* serverUrl = "christophhagen.de";
|
|
|
|
|
|
|
|
// The server port where the Sesame server is listening
|
|
|
|
constexpr const int serverPort = 443;
|
|
|
|
|
|
|
|
// The path on the server to connect the socket
|
|
|
|
constexpr const char* serverPath = "/sesame/listen";
|
|
|
|
|
|
|
|
// The authentication token for the device to connect to the server
|
|
|
|
constexpr const char* serverAccessKey = "0000000000000000000000000000000000000000000000000000000000000000";
|
|
|
|
|
|
|
|
|
|
|
|
/* Time */
|
|
|
|
|
|
|
|
// The url of the ntp server to get the current time
|
|
|
|
constexpr const char* ntpServerUrl = "pool.ntp.org";
|
|
|
|
|
|
|
|
// The offset (in seconds) to GMT time (i.e. the timezone)
|
|
|
|
constexpr int32_t timeOffsetToGMT = 3600;
|
|
|
|
|
|
|
|
// The daylight savings offset, if applicable
|
|
|
|
constexpr int32_t timeOffsetDaylightSavings = 3600;
|
|
|
|
|
|
|
|
|
|
|
|
/* Servo */
|
|
|
|
|
|
|
|
// Servo is Emax ES08MA II
|
|
|
|
|
|
|
|
// The time (in ms) to keep the door button pressed
|
|
|
|
constexpr uint32_t lockOpeningDuration = 1000;
|
|
|
|
|
|
|
|
// The timer to use to control the servo
|
|
|
|
constexpr int pwmTimer = 0;
|
|
|
|
|
|
|
|
// Pin wired up to the servo data line
|
|
|
|
constexpr int servoPin = 14;
|
|
|
|
|
|
|
|
// The Emax is a standard 50 Hz servo
|
|
|
|
constexpr int servoFrequency = 50;
|
|
|
|
|
|
|
|
// The microseconds to set the servo to for the pressed state
|
|
|
|
constexpr int servoPressedState = 1720;
|
|
|
|
|
|
|
|
// The microseconds to set the servo to for the released state
|
|
|
|
constexpr int servoReleasedState = 1520;
|