jrosti / lumikki

Automatically exported from code.google.com/p/lumikki
0 stars 0 forks source link

fix status signals #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

This is the next integration step to do. All devices should response to status 
query. Three possibilies exist: 200 (ready), 503 (not-ready), 220 (measuring).

Messages to be sent/posted:
IR: html-post json {'status':'0'}
TTM: <prefix>_status
CAM: message = "status?"

responce:
{'status': 'X', 'statusText': 'Y'}

Status signals are as follows (this has to be defined once, globally):

statusResponses = { "000":"Cannot connect to anything"
       , "010":"Server sent unknown status"
       , "020":"Server response did not contain status"
       , "100":"Disabled from server."
       , "110":"Target machine did not respond"
       , "120":"Server received malformed command."
       , 403:"122"
       , 0:"210"    #"Ready to measure"
       , 1:"200"    #"Target available, values not set"
       , 200:"210"  #"Ready to measure"
       , "220":"Measuring"
       , "230":"System is busy, please try again in a while."
}

Every device should return at least:
ready                             -> status: 200
not ready (service unavailable)   -> status: 503
measurement running               -> status: 220

Original issue reported on code.google.com by jhkoi...@gmail.com on 17 Mar 2011 at 5:43

GoogleCodeExporter commented 9 years ago
I'm working on this. Currently the codes are formed to represent the codes of 
lumikki.js

Quote:
errmap = { "000":"Cannot connect to anything"
       , "010":"Server sent unknown status"
       , "020":"Server response did not contain status"
       , "100":"Disabled from server."
       , "110":"Target machine did not respond"
       , "120":"Server received malformed command."
       , "122":"Connection refused."
       , "200":"Target available, values not set"
       , "210":"Ready to measure"
       , "220":"Measuring"
       , "230":"System is busy, please try again in a while." 
     };

These codes map the number that the status.cgi returns to a message that is 
shown beside the status code.

The logic of these codes is that 0**-codes are server errors, 1**-codes are 
connection errors between lumikki and machine and 2**-codes are machine's 
internal codes.

Currently there are three different error code mappings in the code.

First: lumikki mapping -> this should remain
Second: HTTP-response mapping -> I'll write a library that will map these codes 
into lumikki codes
Third: Machine response mapping -> machines should respond with a corresponding 
lumikki response so that it can be sent back as it is

Can the code 503 for 'not ready' be changed into something, for example, 230 if 
current 'wait'-response would be changed to 230->240?

Original comment by st.tuomisto on 22 Mar 2011 at 7:57

GoogleCodeExporter commented 9 years ago

Original comment by st.tuomisto on 22 Mar 2011 at 7:57

GoogleCodeExporter commented 9 years ago
Added a StatusCodeAPI

http://code.google.com/p/lumikki/wiki/StatusCodeAPI

Added status functions to ttm.py, ir.py and camera.py. Legacy versions are also 
in place and currently used.

TODO in code:
-creation of status functions on the devices 
-bug testing the new status functions

TODO in API:
-some definition for the returned value of command calls. Currently: status code
-some definition for the different states of the device.
-should the status be reflected to the usability of functions, or should they 
just return errors as currently?

Original comment by st.tuomisto on 22 Mar 2011 at 12:50

GoogleCodeExporter commented 9 years ago
As the camera and AE status queries do not exist, added a 130-not implemented 
status code to the status api. This is now the returned code.

TODO: camera should have at least a "server is online"-style status query. Same 
kind as with ttm.

Original comment by st.tuomisto on 31 Mar 2011 at 7:16

GoogleCodeExporter commented 9 years ago
Signals work for camera and ttm

Original comment by jhkoi...@gmail.com on 31 Mar 2011 at 6:44