sensorController
” Sensor controller module: for retrieving, storing and online running sensors
- class sensorController.Application
Bases:
ApplicationTornado Application class for Sensor Control
- class sensorController.SensorControllerSocketHandler(val1, val2)
Bases:
WebSocketHandlerTornado Sensor Controller Socker Handler
- check_origin(origin)
Override to enable support for allowing alternate origins.
The
originargument is the value of theOriginHTTP header, the url responsible for initiating this request. This method is not called for clients that do not send this header; such requests are always allowed (because all browsers that implement WebSockets support this header, and non-browser clients do not have the same cross-site security concerns).Should return
Trueto accept the request orFalseto reject it. By default, rejects all requests with an origin on a host other than this one.This is a security protection against cross site scripting attacks on browsers, since WebSockets are allowed to bypass the usual same-origin policies and don’t use CORS headers.
Warning
This is an important security measure; don’t disable it without understanding the security implications. In particular, if your authentication is cookie-based, you must either restrict the origins allowed by
check_origin()or implement your own XSRF-like protection for websocket connections. See these articles for more.To accept all cross-origin traffic (which was the default prior to Tornado 4.0), simply override this method to always return
True:def check_origin(self, origin): return True
To allow connections from any subdomain of your site, you might do something like:
def check_origin(self, origin): parsed_origin = urllib.parse.urlparse(origin) return parsed_origin.netloc.endswith(".mydomain.com")
Added in version 4.0.
- ignore_rad(team)
this will set the rad changes to be ignored as the rad status was set to zero by user
- on_close()
Invoked when the WebSocket is closed.
If the connection was closed cleanly and a status code or reason phrase was supplied, these values will be available as the attributes
self.close_codeandself.close_reason.Changed in version 4.0: Added
close_codeandclose_reasonattributes.
- on_message(message)
Handle incoming messages on the WebSocket
This method must be overridden.
Changed in version 4.5:
on_messagecan be a coroutine.
- open()
Invoked when a new WebSocket is opened.
The arguments to open are extracted from the tornado.web.URLSpec regular expression, just like the arguments to tornado.web.RequestHandler.get.
open may be a coroutine. on_message will not be called until open has returned.
Changed in version 5.1:
openmay be a coroutine.
- start_pcl_notify()
- start_pcl_runners(team, rcs)
- start_rad_notify()
fetches radars from the DB and delivers to the client
- start_rad_runners(team, rcs)
- stop_pcl_notify()
stops pcl notifications
- stop_pcl_runners()
- stop_rad_notify()
stops rad db change notifications
- stop_rad_runners(team)
- sensorController.create_target_replay_track(target, waypoint_dct)
Creates target replay track
- sensorController.insert_air_target_tracks(request_received)
Inserts Air Target Tracks
- sensorController.main()
Main function
- sensorController.update_target_track(tgt_lat, tgt_lon, tgt_alt, tgt_ms_after_midnight, vlc, sampling_time, wayp_lat, wayp_lon, wayp_alt, tgt_vx, tgt_vy, tgt_vz, intended_heading)
Updates a given targets track vlc in [m/s] and sampling_time in [s]