コード例 #1
0
def main(args=None):
    if args is None:
        args = sys.argv[1:]

    print("This is openimu main routine.")
    imu.find_device()
    cli = OpenIMU_CLI()
    cli.command_handler()
コード例 #2
0
                    }))
            elif list(message['data'].keys())[0] == 'loadFile':
                print(message['data']['loadFile']['graph_id'])
                f = open("data/" + message['data']['loadFile']['graph_id'],
                         "r")
                self.write_message(
                    json.dumps({
                        "messageType": "requestAction",
                        "data": {
                            "loadFile": f.read()
                        }
                    }))

    def on_close(self):
        self.callback.stop()
        return False

    def check_origin(self, origin):
        return True


if __name__ == "__main__":
    # Create IMU
    imu.find_device()
    # Set up Websocket server on Port 8000
    # Port can be changed
    application = tornado.web.Application([(r'/', WSHandler)])
    http_server = tornado.httpserver.HTTPServer(application)
    http_server.listen(8000)
    tornado.ioloop.IOLoop.instance().start()
コード例 #3
0
    def connect_handler(self):
        '''connect command is used to find OpenIMU device
        '''
        imu.find_device()

        return True