Example #1
0
    def __init__(self, session, wcommon, read_only_dbs, writable_db):
        SlashedResource.__init__(self)

        # UI entry point
        self.putChild(
            '', ElementRenderingResource(_RadioIndexHtmlElement(wcommon)))

        # Exported radio control objects
        self.putChild(CAP_OBJECT_PATH_ELEMENT,
                      BlockResource(session, wcommon, _not_deletable))

        # Frequency DB
        self.putChild('dbs', shinysdr.i.db.DatabasesResource(read_only_dbs))
        self.putChild('wdb', shinysdr.i.db.DatabaseResource(writable_db))

        # Debug graph
        self.putChild(
            'flow-graph',
            FlowgraphVizResource(wcommon.reactor,
                                 session.flowgraph_for_debug()))

        # Ephemeris
        self.putChild('ephemeris', EphemerisResource())

        # Standard audio-file-over-HTTP audio stream (the ShinySDR web client uses WebSockets instead, but both have the same path modulo protocol)
        self.putChild(AUDIO_STREAM_PATH_ELEMENT, AudioStreamResource(session))
Example #2
0
 def __init__(self, reactor, root_object, note_dirty, read_only_dbs, writable_db, http_endpoint, ws_endpoint, root_cap, title, flowgraph_for_debug):
     self.__http_port = http_endpoint
     self.__ws_port = ws_endpoint
     
     wcommon = WebServiceCommon(note_dirty=note_dirty, ws_endpoint=ws_endpoint)
     
     # Roots of resource trees
     # - appRoot is everything stateful/authority-bearing
     # - serverRoot is the HTTP '/' and static resources are placed there
     serverRoot = _make_static(static_resource_path)
     if root_cap is None:
         appRoot = serverRoot
         self.__visit_path = '/'
         ws_caps = {None: root_object}
     else:
         serverRoot = _make_static(static_resource_path)
         appRoot = SlashedResource()
         serverRoot.putChild(root_cap, appRoot)
         self.__visit_path = '/' + urllib.quote(root_cap, safe='') + '/'
         ws_caps = {root_cap: root_object}
     
     self.__ws_protocol = txws.WebSocketFactory(
         FactoryWithArgs.forProtocol(OurStreamProtocol, ws_caps, note_dirty))
     
     # UI entry point
     appRoot.putChild('', _RadioIndexHtmlResource(wcommon=wcommon, title=title))
     
     # Exported radio control objects
     appRoot.putChild('radio', BlockResource(root_object, wcommon, not_deletable))
     
     # Frequency DB
     appRoot.putChild('dbs', shinysdr.i.db.DatabasesResource(read_only_dbs))
     appRoot.putChild('wdb', shinysdr.i.db.DatabaseResource(writable_db))
     
     # Debug graph
     appRoot.putChild('flow-graph', FlowgraphVizResource(reactor, flowgraph_for_debug))
     
     # Ephemeris
     appRoot.putChild('ephemeris', EphemerisResource())
     
     # Construct explicit resources for merge.
     test = _reify(serverRoot, 'test')
     jasmine = _reify(test, 'jasmine')
     for name in ['jasmine.css', 'jasmine.js', 'jasmine-html.js']:
         jasmine.putChild(name, static.File(os.path.join(
             deps_path, 'jasmine/lib/jasmine-core/', name)))
     
     client = _reify(serverRoot, 'client')
     client.putChild('require.js', static.File(os.path.join(deps_path, 'require.js')))
     client.putChild('text.js', static.File(os.path.join(deps_path, 'text.js')))
     
     _add_plugin_resources(client)
     
     self.__site = server.Site(serverRoot)
     self.__ws_port_obj = None
     self.__http_port_obj = None
Example #3
0
 def __init__(self, session, wcommon, read_only_dbs, writable_db):
     SlashedResource.__init__(self)
     
     # UI entry point
     self.putChild('', _RadioIndexHtmlResource(wcommon=wcommon))
     
     # Exported radio control objects
     self.putChild(CAP_OBJECT_PATH_ELEMENT, BlockResource(session, wcommon, _not_deletable))
     
     # Frequency DB
     self.putChild('dbs', shinysdr.i.db.DatabasesResource(read_only_dbs))
     self.putChild('wdb', shinysdr.i.db.DatabaseResource(writable_db))
     
     # Debug graph
     self.putChild('flow-graph', FlowgraphVizResource(wcommon.reactor, session.flowgraph_for_debug()))
     
     # Ephemeris
     self.putChild('ephemeris', EphemerisResource())
Example #4
0
def _put_session(container_resource, session, wcommon, reactor, title,
                 read_only_dbs, writable_db, flowgraph_for_debug):
    # UI entry point
    container_resource.putChild(
        '', _RadioIndexHtmlResource(wcommon=wcommon, title=title))

    # Exported radio control objects
    container_resource.putChild(CAP_OBJECT_PATH_ELEMENT,
                                BlockResource(session, wcommon, not_deletable))

    # Frequency DB
    container_resource.putChild('dbs',
                                shinysdr.i.db.DatabasesResource(read_only_dbs))
    container_resource.putChild('wdb',
                                shinysdr.i.db.DatabaseResource(writable_db))

    # Debug graph
    container_resource.putChild(
        'flow-graph', FlowgraphVizResource(reactor, flowgraph_for_debug))

    # Ephemeris
    container_resource.putChild('ephemeris', EphemerisResource())