admin func

Dependencies:   mbed

Revision:
0:1a3c13c65fef
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 20 07:46:58 2018 +0000
@@ -0,0 +1,83 @@
+#include "mbed.h"
+#include <string>
+
+DigitalOut myled(LED1);
+Serial pc(USBTX, USBRX);
+
+/////TABELLER/////
+char password[6] = {'a','d','m','i','n','\n'};//Passord for tilgang til systemet
+char request_spesific_status[32] = {'#','r','e','q','_','s','t','a','_','s','o','n','e','X','_','d','o','o','r','Y','\n'};//Request spesific status command
+char request_status_all[32] = {'#','r','e','q','_','s','t','a','_','a','l','l','\n'};//Reguest status for all command
+char reset_spesific[32] = {'#','r','e','e','t','_','s','o','n','e','X','_','d','o','o','r','Y','\n'};//Reset spesific zone/door
+char reset_all[32] = {'#','r','e','s','e','t','_','a','l','l','\n'};//Reset entire system
+char keyinput[32];//Sammenlignings tabell for passord
+char buffer[128];//buffer tabell for tastetrykk
+
+
+/////FUNKSJONSDEKLARASJONER/////
+void admin_access();
+void req_spesific_status();
+void req_status_all();
+void reset_spesific_();
+void reset_all_();
+
+int main()
+{
+    while(1) {            }
+}// main avsluttet
+
+
+//FUNKSJONER
+void admin_access()
+{
+    pc.printf("Write admin access password:\n");
+    while(1){
+    pc.scanf(buffer);
+    
+    for(int i = 0; i < 32; i++) {
+    keyinput[i] = buffer[i];
+        if(keyinput == password) {
+            pc.printf("Admin access granted\n");//info
+            pc.printf("Following commands are available\n");// liste over funksjoner tilgjenglig.
+            pc.printf("#req_sta_sone(1-4)_door(1-2)\n");// funksjon 1 - request spesific status
+            pc.printf("#req_sta_all\n");// funksjon 1 - request status all
+            pc.printf("#reset_sone(1-4)_door(1-2)\n");// funksjon 3 - request spesific log     
+            pc.printf("#reset_all\n");// funksjon 4 - request log all
+        
+        if(keyinput == request_spesific_status){
+            void req_spesific_status();
+            
+        if(keyinput == request_status_all){
+            void req_status_all();
+            
+        if(keyinput == reset_spesific){
+            void reset_spesific_();
+            
+        if(keyinput == reset_all){
+            void reset_all_();
+                    
+}//if admin access granted END
+
+void req_spesific_status((sonenr, doornr));
+{
+    
+    
+}
+
+void req_status_all();
+{
+    
+}
+
+void reset_spesific_((sonenr, doornr);
+{
+    
+}
+
+void reset_all_();
+{
+    
+}
+
+
+