Browse Source

Upload files to ''

master
kasdimos 5 years ago
parent
commit
097c8e02c8
  1. 74
      SecureSendSketch.ino

74
SecureSendSketch.ino

@ -0,0 +1,74 @@
#include <SecureSend.h>
const bool enableSerial = true;
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 0, 6);
uint16_t port = 80;
uint8_t hmacKey[]={
's','u','p','e','r','s','e','c','u','r','e'
};
const int clientFirstByteCount = 1;
const int randDataLength = 100;
const int hashByteLength = 32;
int switchGatePin = 5;
int gateClosedPin = 3;
int gateOpenPin = 1;
int getGateState(){
Serial.println("Get gate state");
return 2;
}
int switchGate(){
Serial.println("Switch Gate");
return 0;
}
int switchLight(){
Serial.println("Switch Light");
return 1;
}
int failFunc(){
Serial.println("Unknown cmd");
return -1;
}
void newLoop(){}
int (*functionArray[])(void) = {
getGateState,
switchGate,
switchLight
};
const int functionsCount = 3;
SecureSend secureSend(mac, ip, port,
hmacKey, sizeof(hmacKey),
functionArray, functionsCount,
failFunc, newLoop,
enableSerial,
randDataLength,
clientFirstByteCount,
hashByteLength,
analogRead(A0)
);
void setup() {
pinMode(switchGatePin, OUTPUT);
digitalWrite(switchGatePin, LOW);
secureSend.begin();
}
void loop() {
delay(3000);
}
Loading…
Cancel
Save