Fixed spec
@@ -1,5 +1,5 @@
|
||||
|
||||
OUT = ir-state.png ir-learn.png ir-send.png packer.png wifi-morse-setup.png
|
||||
OUT = ir-state.png ir-learn.png ir-send.png packer.png setup.png
|
||||
|
||||
all: $(OUT)
|
||||
|
||||
|
@@ -1,35 +1,17 @@
|
||||
msc {
|
||||
# entities
|
||||
User, App, IRKit, Server;
|
||||
User, IRKit, Server;
|
||||
|
||||
# space
|
||||
|||;
|
||||
|
||||
IRKit note Server [label = "Successfully connected"];
|
||||
|
||||
IRKit note IRKit [label = "Started listening on port 80"];
|
||||
|
||||
|||;
|
||||
|
||||
User -> App [label = "User opens Learn View"];
|
||||
|
||||
App => IRKit [label = "GET /irsignals (longpoll)"];
|
||||
|
||||
App note IRKit [label = "Retain connection"];
|
||||
IRKit note IRKit [label = "Enable IR receiver"];
|
||||
|
||||
|||;
|
||||
|
||||
User -> IRKit [label = "Send IR signal"];
|
||||
|
||||
App << IRKit [label = "IR signal in HTTP Response"];
|
||||
|
||||
App -> IRKit [label = "GET /irsignals (longpoll)"];
|
||||
|
||||
IRKit note IRKit [label = "HTTP Request Timeout"];
|
||||
|
||||
App -> IRKit [label = "GET /irsignals (longpoll)"];
|
||||
|
||||
User -> App [label = "User dismisses Learn View"];
|
||||
|
||||
App note IRKit [label = "Disconnect"];
|
||||
IRKit -> Server [label = "POST /1/p"];
|
||||
}
|
||||
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -1,40 +1,32 @@
|
||||
msc {
|
||||
# entities
|
||||
User, App, IRKit, Server, TV;
|
||||
User, IRKit, Server, TV;
|
||||
|
||||
# space
|
||||
|||;
|
||||
|
||||
IRKit note Server [label = "Successfully connected"];
|
||||
|
||||
IRKit note IRKit [label = "Started listening on port 80"];
|
||||
IRKit note IRKit [label = "Start listening on port 80"];
|
||||
|
||||
IRKit -> Server [label = "GET /irsignals (longpoll)"];
|
||||
IRKit => Server [label = "GET /1/m (longpoll)"];
|
||||
|
||||
|||;
|
||||
|
||||
User -> App [label = "User launches App using IRKit SDK"];
|
||||
User note IRKit [label = "IF User and IRKit are in the same Wifi"];
|
||||
|
||||
App => Server [label = "GET /devices"];
|
||||
App << Server [label = "List of devices' local IP addresses"];
|
||||
User => IRKit [label = "POST /messages"];
|
||||
IRKit -> TV [label = "Send IR signal"];
|
||||
User << IRKit [label = "200 OK"];
|
||||
|
||||
User -> App [label = "User wants to send IR signal"];
|
||||
|||;
|
||||
|
||||
App note IRKit [label = "IF App and IRKit are in the same Wifi(BSSID)"];
|
||||
User note IRKit [label = "IF User and IRKit are not in the same Wifi"];
|
||||
|
||||
App => IRKit [label = "POST /irsignals (access within local Wifi)"];
|
||||
User => Server [label = "POST /1/messages"];
|
||||
User << Server [label = "200 OK"];
|
||||
|
||||
IRKit << Server [label = "Response to \"GET /1/m\" longpoll: 200 OK, IR signal in body"];
|
||||
IRKit -> TV [label = "IR signal"];
|
||||
App << IRKit [label = "200 OK"];
|
||||
|
||||
App note IRKit [label = "IF App and IRKit are not in the same Wifi"];
|
||||
|
||||
App => Server [label = "POST /devices/xxxxx/irsignals"];
|
||||
|
||||
IRKit << Server [label = "Response to \"GET /irsignals\" longpoll: 200 OK, IR signal in body"];
|
||||
|
||||
IRKit => Server [label = "GET /irsignals (continuously)"];
|
||||
|
||||
IRKit -> TV [label = "IR signal"];
|
||||
|
||||
App << Server [label = "200 OK"];
|
||||
IRKit => Server [label = "GET /1/m (longpoll)"];
|
||||
}
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 7.4 KiB |
@@ -5,20 +5,16 @@ digraph ir_state {
|
||||
|
||||
node [shape=ellipse, fontsize=12, fixedsize=true, width=1.5, height=0.8];
|
||||
|
||||
DISCONNECTED [ label = "DISCONNECTED (0)" ];
|
||||
START -> DISCONNECTED [ label = "Power Up", weight = 100 ];
|
||||
DISABLED [ label = "DISABLED (255)" ];
|
||||
START -> DISABLED [ label = "Power Up", weight = 100 ];
|
||||
|
||||
CONNECTED [ label = "CONNECTED (1)" ];
|
||||
IDLE [ label = "IDLE (2)" ];
|
||||
DISCONNECTED -> CONNECTED [ label = "Successfully connected" ];
|
||||
DISCONNECTED -> DISCONNECTED [ label = "Connect failed" ];
|
||||
DISCONNECTED -> IDLE [ label = "Connect failed XX times" ];
|
||||
DISABLED -> IDLE [ label = "Successfully connected to Internet and setup HTTP Server" ];
|
||||
DISABLED -> DISABLED [ label = "Connect failed" ];
|
||||
|
||||
READY [ label = "READY (3)" ];
|
||||
CONNECTED -> READY [ label = "Successfully reported to server" ];
|
||||
|
||||
subgraph cluster_ir {
|
||||
label = "IR -> BLE";
|
||||
subgraph cluster_learn {
|
||||
label = "Learn IR";
|
||||
color=lightgray;
|
||||
rank=source;
|
||||
|
||||
@@ -27,29 +23,29 @@ digraph ir_state {
|
||||
RECVED_IDLE [ label = "RECVED_IDLE (3)" ];
|
||||
READING [ label = "READING (4)" ];
|
||||
|
||||
RECVING -> RECVED [ label = "Overflowed" ];
|
||||
RECVING -> RECVED [ label = "Trailer detected" ];
|
||||
RECVING -> RECVED [ label = "IR receive buffer overflowed" ];
|
||||
RECVING -> RECVED [ label = "IR trailer detected" ];
|
||||
|
||||
RECVED -> RECVED_IDLE [ label = "Notified BLE central using\n\"IR Unread Status\" characteristic" ];
|
||||
RECVED_IDLE -> READING [ label = "BLE central starts reading" ];
|
||||
RECVED -> RECVED_IDLE [ label = "Sent IR data to server on Internet" ];
|
||||
RECVED_IDLE -> READING [ label = "HTTP client reads data from IRKit" ];
|
||||
|
||||
}
|
||||
subgraph cluster_ble {
|
||||
label = "BLE -> IR";
|
||||
subgraph cluster_send {
|
||||
label = "Send IR";
|
||||
color=lightgray;
|
||||
rank=source;
|
||||
|
||||
WRITING [ label = "WRITING (10)" ];
|
||||
XMITTING [ label = "XMITTING (11)" ];
|
||||
|
||||
WRITING -> XMITTING [ label = "IR_xmit called" ];
|
||||
WRITING -> XMITTING [ label = "Finished receiving IR data" ];
|
||||
}
|
||||
|
||||
IDLE -> IDLE [ label = "Overflow continues" ];
|
||||
IDLE -> RECVING [ label = "Falling edge", weight = 10 ];
|
||||
IDLE -> WRITING [ label = "BLE central writing\nIR data into peripheral", weight = 10 ];
|
||||
IDLE -> RECVING [ label = "IR receiver detected falling edge", weight = 10 ];
|
||||
IDLE -> WRITING [ label = "Started receiving IR data", weight = 10 ];
|
||||
|
||||
RECVED_IDLE -> IDLE [ label = "Falling edge\n(starts RECVING)" ];
|
||||
READING -> IDLE [ label = "Reading finished or any error" ];
|
||||
RECVED_IDLE -> IDLE [ label = "IR receiver detected falling edge" ];
|
||||
READING -> IDLE [ label = "Reading finished" ];
|
||||
XMITTING -> IDLE [ label = "All data sent" ];
|
||||
}
|
||||
|
Before Width: | Height: | Size: 155 KiB After Width: | Height: | Size: 138 KiB |
58
spec/diagrams/setup.msc
Normal file
@@ -0,0 +1,58 @@
|
||||
msc {
|
||||
# entities
|
||||
User, Phone, App, IRKit, Server;
|
||||
|
||||
# space
|
||||
|||;
|
||||
|
||||
IRKit note IRKit [label = "Powered Off"];
|
||||
|
||||
User -> IRKit [label = "Power On"];
|
||||
IRKit note IRKit [label = "Not connected to home Wi-Fi access point"];
|
||||
IRKit note IRKit [label = "Start IRKit's own access point and start HTTP server"];
|
||||
Phone note Phone [label = "Connected to home Wi-Fi access point"];
|
||||
|
||||
|||;
|
||||
|
||||
User -> Phone [label = "Launch App"];
|
||||
Phone -> App [label = "Launches"];
|
||||
|
||||
|||;
|
||||
|
||||
App => Server [label = "POST /1/clients"];
|
||||
App << Server [label = "clientkey"];
|
||||
|
||||
App => Server [label = "POST /1/devices (body: clientkey=#{clientkey})"];
|
||||
App << Server [label = "receives devicekey, deviceid"];
|
||||
|
||||
|||;
|
||||
|
||||
User -> App [label = "Input home Wi-Fi's SSID and password"];
|
||||
User -> Phone [label = "Connect to IRKit's own access point"];
|
||||
User -> Phone [label = "Relaunch App"];
|
||||
Phone -> App [label = "Launches"];
|
||||
|
||||
App => IRKit [label = "POST /wifi (body: #{home Wi-Fi's security, SSID, password, devicekey, REGDOMAIN})"];
|
||||
App << IRKit [label = "200 OK"];
|
||||
|
||||
IRKit note IRKit [label = "Connect to home Wi-Fi"];
|
||||
|
||||
IRKit => Server [label = "POST /door (body: devicekey=#{devicekey}&&hostname=#{hostname})"];
|
||||
IRKit << Server [label = "Door Response (status code: 200)"];
|
||||
|
||||
IRKit note IRKit [label = "Setup successfully finished"];
|
||||
|
||||
|||;
|
||||
|
||||
User -> Phone [label = "Connect to home Wi-Fi access point"];
|
||||
User -> Phone [label = "Relaunch App"];
|
||||
Phone -> App [label = "Launches"];
|
||||
|
||||
App => Server [label = "POST /1/door (body: clientkey=#{clientkey}&deviceid=#{deviceid}) (longpoll)"];
|
||||
|
||||
App << Server [label = "200 OK, receives IRKit's hostname"];
|
||||
|
||||
|||;
|
||||
|
||||
App note App [label = "Setup successfully finished"];
|
||||
}
|
BIN
spec/diagrams/setup.png
Normal file
After Width: | Height: | Size: 17 KiB |
@@ -1,49 +0,0 @@
|
||||
msc {
|
||||
# entities
|
||||
User, App, IRKit, Server;
|
||||
|
||||
# space
|
||||
|||;
|
||||
|
||||
IRKit note IRKit [label = "Powered Off"];
|
||||
|
||||
User -> IRKit [label = "Power On"];
|
||||
IRKit note IRKit [label = "No Wifi Credentials, Waiting for Morse Sound"];
|
||||
|
||||
User -> App [label = "Launch App"];
|
||||
App => Server [label = "GET /keys"];
|
||||
App << Server [label = "Keys Response (status code: 200\nbody: [\"#{key1}\",\"#{key2}\"])"];
|
||||
|
||||
App => Server [label = "POST /door (body: key=#{key1}) (Long Poll)"];
|
||||
App << Server [label = "Door Response (status code: 401)\nKeys have expired, get keys again"];
|
||||
|
||||
App => Server [label = "GET /keys"];
|
||||
App << Server [label = "Keys Response (snip)"];
|
||||
|
||||
App => Server [label = "POST /door (body: key=#{key1}) (Long Poll)"];
|
||||
App << Server [label = "Door Response (status code: 408)\nRequest Time-out, try again"];
|
||||
|
||||
App => Server [label = "POST /door (body: key=#{key1}) (Long Poll)"];
|
||||
|
||||
User -> App [label = "Input Wifi SSID and Password"];
|
||||
App -> IRKit [label = "Morse Sound\n(Wifi Security Level, SSID, Password, Key2, CRC8)"];
|
||||
|
||||
IRKit note IRKit [label = "Decodes Morse Sound and Connect to Wifi"];
|
||||
IRKit => Server [label = "POST /door (body: key=#{key2}) (Long Poll)"];
|
||||
IRKit << Server [label = "Door Response (status code: 200)"];
|
||||
|
||||
App << Server [label = "Door Response (status code: 200)"];
|
||||
|
||||
IRKit => Server [label = "GET /messages?key=#{key2}&newer_than=#{newest_message_id} (Long Poll)"];
|
||||
|
||||
App -> Server [label = "POST /messages (body: key=#{key1}&message=#{JSON stringified message})"];
|
||||
App << Server [label = "Message Response (status code: 200)"];
|
||||
|
||||
IRKit << Server [label = "Messages Response (status code: 200\nbody: {\"id\":#{message_id},#{JSON stringified message}})"];
|
||||
|
||||
App -> IRKit [label = "POST /messages (body: message=#{JSON stringified message})"];
|
||||
App << IRKit [label = "Message Response (status code: 200)"];
|
||||
|
||||
App -> IRKit [label = "GET /messages"];
|
||||
App << IRKit [label = "Message Response (status code: 200\nbody: #{JSON stringified message})"];
|
||||
}
|
Before Width: | Height: | Size: 20 KiB |