if len(args) != 1: usage() service_name = args[0] # Setup a connection to the local RVI node rvi = RVI(rvi_node_url) # Starting the thread that handles incoming calls is # not really necessary since register_service will do it for us. rvi.start_serve_thread() rvi.set_services_available_callback(services_available) rvi.set_services_unavailable_callback(services_unavailable) # Register our service and invoke 'service_invoked' if we # get an incoming JSON-RPC call to it from the RVI node # full_service_name = rvi.register_service(service_name, service_invoked) print "RVI General Service." print "RVI node URL: ", rvi_node_url print "Service: ", full_service_name raw_input('Press enter to quit: ') rvi.unregister_service(service_name) rvi.shutdown() sys.exit(0)
GPIO.output(GPIO_TRUNK, GPIO.LOW) GPIO.output(GPIO_PANIC, GPIO.LOW) # Setup a connection to the local RVI node rvi = RVI(rvi_node_url) # Starting the thread that handles incoming calls is # not really necessary since register_service will do it for us. rvi.start_serve_thread() rvi.set_services_available_callback(services_available) rvi.set_services_unavailable_callback(services_unavailable) # Register our service and invoke 'service_invoked' if we # get an incoming JSON-RPC call to it from the RVI node # rvi.register_service("unlock", unlock_invoked) rvi.register_service("lock", lock_invoked) #rvi.register_service("start", start_invoked) #rvi.register_service("stop", stop_invoked) #rvi.register_service("horn", horn_invoked) rvi.register_service("trunk", trunk_invoked) rvi.register_service("panic", panic_invoked) rvi.register_service("lights", lights_invoked) while True: time.sleep(36000) sys.exit(0)
usage() service_name = args[0] # Setup a connection to the local RVI node rvi = RVI(rvi_node_url) # Starting the thread that handles incoming calls is # not really necessary since register_service will do it for us. rvi.start_serve_thread() rvi.set_services_available_callback(services_available) rvi.set_services_unavailable_callback(services_unavailable) # Register our service and invoke 'service_invoked' if we # get an incoming JSON-RPC call to it from the RVI node # full_service_name = rvi.register_service(service_name, service_invoked) print "RVI General Service." print "RVI node URL: ", rvi_node_url print "Service: ", full_service_name raw_input('Press enter to quit: ') rvi.unregister_service(service_name) rvi.shutdown() sys.exit(0)
# Setup a connection to the local RVI node rvi = RVI(rvi_node_url) # Starting the thread that handles incoming calls is # not really necessary since register_service will do it for us. rvi.start_serve_thread() rvi.set_services_available_callback(services_available) rvi.set_services_unavailable_callback(services_unavailable) # Register our service and invoke 'service_invoked' if we # get an incoming JSON-RPC call to it from the RVI node # rvi.register_service("unlock", unlock_invoked) rvi.register_service("lock", lock_invoked) rvi.register_service("auto_unlock", auto_unlock_invoked) rvi.register_service("auto_lock", auto_lock_invoked) rvi.register_service("start", start_invoked) rvi.register_service("stop", stop_invoked) # rvi.register_service("horn", horn_invoked) rvi.register_service("trunk", trunk_invoked) rvi.register_service("panic", panic_invoked) rvi.register_service("lights", lights_invoked) while True: time.sleep(36000) sys.exit(0)
ws_thread.start() # ws_thread = threading.Thread(target=ws_server.serve_forever) # We may see traffic immediately from the RVI node when # we register. Let's sleep for a bit to allow the emulator service # thread to get up to speed. time.sleep(0.5) # Repeat registration until we succeeed rvi_dead = True while rvi_dead: try: full_notify_service_name = rvi_server.register_service("/sota/notify", notify ) rvi_dead = False except: print "No rvi. Wait and retry: ", full_notify_service_name time.sleep(2.0) full_start_service_name = rvi_server.register_service("/sota/start", start ) full_chunk_service_name = rvi_server.register_service("/sota/chunk", chunk ) full_finish_service_name = rvi_server.register_service("/sota/finish", finish ) print "SOTA Client" print "Vehicle RVI node URL: ", rvi_url print "Full notify service name : ", full_notify_service_name print "Full start service name : ", full_start_service_name print "Full chunk service name : ", full_chunk_service_name
usage() # Grab the URL to use [ progname, rvi_url ] = sys.argv # Setup an outbound JSON-RPC connection to the RVI Service Edge. rvi_server = RVI(rvi_url) rvi_server.start_serve_thread() # # Regsiter callbacks for incoming JSON-RPC calls delivered to # the SOTA server from the vehicle RVI node's Service Edge. # full_initiate_download_service_name = rvi_server.register_service("/sota/initiate_download", initiate_download ) full_cancel_download_service_name = rvi_server.register_service("/sota/cancel_download", cancel_download ) full_download_complete_service_name = rvi_server.register_service("/sota/download_complete", download_complete ) print "Vehicle RVI node URL: ", rvi_url print "Full initiate download service name : ", full_initiate_download_service_name print "Full download complete service name : ", full_download_complete_service_name print "Full cancel download service name : ", full_cancel_download_service_name chunk_size = 1024*64 # # Start the queue dispatcher thread # package_pusher_thr = threading.Thread(target=package_pusher)