当前位置: 首页>>代码示例>>Python>>正文


Python Tools.register_local方法代码示例

本文整理汇总了Python中tools.Tools.register_local方法的典型用法代码示例。如果您正苦于以下问题:Python Tools.register_local方法的具体用法?Python Tools.register_local怎么用?Python Tools.register_local使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tools.Tools的用法示例。


在下文中一共展示了Tools.register_local方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Flask

# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import register_local [as 别名]
# Initialize the Flask application
app = Flask(__name__)

## ROUTES ##
@app.route('/getdata', methods=['GET'])
def getData():
    list = tools.virtual_data_sensors()

    return list


@app.route('/getsensorslist', methods=['GET'])
def getSensorList():

    # TODO get list from z1
    return 'GetSensorsList called <-- UNIMPLEMENTED'

## MAIN
if __name__ == '__main__':

    uuid = get_mac()

    tools = Tools()
    tools.register_local(uuid)

    app.run(
        host="0.0.0.0",
        port=int(tools.local_port)
    )
开发者ID:Mecabot,项目名称:iot-appengine,代码行数:31,代码来源:main_virtual.py

示例2: get_mac

# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import register_local [as 别名]
# sys.argv[1] has to be a .cfg file containing those info:
# [general]
# auto_external: true
# external: http://exemple.com
# port: 1234
# distant_ip: http://1.iot-pirate.appspot.com
# friendly_name: deruaz_home
if __name__ == '__main__':
    # local server machine Mac address is used as an UUID
    uuid = get_mac()

    tools = Tools(uuid, sys.argv[1])

    # param 2 --> UUID of an animal
    # sensor need to have a get_json() method
    # sensor need attributs name and uuid

    # tools.add_sensor(Sensor_tag_virtual( 'virtual_1', '51fa8287-a719-4c1b-8177-7ec829f6e08e', 'BLE'))
    tools.add_sensor(Sensor_tag_virtual( 'virtual_2', '23fa8287-a719-4c1b-8177-7ec829f6e08r', 'BLE', 0, "2015-12-05 11:03:06"))

    # real sensor with TexasInstrument SensorTag
    #tools.add_sensor(Sensor_tag_virtual( 'real_1', '61112222-a319-4c1b-8177-6r7ew6qr8ew7', '6Lowpan', 0, "2015-01-03 11:03:06"))

    # tell to app Engine backend that data can be fetch from him
    tools.register_local()

    app.run(
        host="0.0.0.0",
        port=int(tools.local_port)
    )
开发者ID:Mecabot,项目名称:iot-appengine,代码行数:32,代码来源:main.py


注:本文中的tools.Tools.register_local方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。