-
Notifications
You must be signed in to change notification settings - Fork 0
/
Working.txt
72 lines (59 loc) · 1.76 KB
/
Working.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Arduino Part Working Mechanism
------------------------------
The device is turned on, wait for 5 second
Initialize SMS library
Then execute the following in an infinite loop
if there's a new SMS
try parsing it with Parser
if he succeed, extract password and match it
with auth-helper
if that succeed, figure out what kind of message it is
if it's a status request message:
Populate parser variables and generate an sms
give it to sms library
if it's a status update message:
Set hardware values from parsed values
send back the new status just like we did with status request
if it's a change phone no message
simply update the phone number
send new status to new number
if it's a change password message
simply update the password
send new status back
Security Mechanism
------------------
The device needs a password to authenticate
If the password is forgotten, a button inside the device will reset
it to a default value.
Parser
------
UPDATE: all \n are to be replaced by <space>
Recieve General Format:
-----------------
|$PASSWD CMD\n |
|CMD BODY |
-----------------
Send back General Format:
(after executing change ph.no/passwd)
-----------------
|$STATUS_CODE |
|Human readable |
|description |
-----------------
New status msg send to phone:
---------------------
|$STATUS_CODE DESC\n|
|ON Dev no.s\n |
|OFF Dev no.s\n |
|TEMP Temp_in_C C\n |
|WATERLVL Prcnt%\n |
--------------------
Estimated Chars:
1+3+1 = 5
2+3+2(sp)+16+1 = 22
5+2+3 = 10
13 = 13
Total = 50
Remaining chars for
STATUS_CODE: (possible values)
Status Updated