矩阵实验室坏图书馆

matrix-io-malos的Python项目详细描述


一个简单的基于"python"的驱动程序,用于与"matrix-malos服务"通信。



如"license"文件中所述。

代码块::console




>运行cli客户端
====


库包括一个简单的命令行客户端,可以立即从
malos服务读取数据。

…代码块::控制台

$malosclient-h 192.168.0.100湿度

生成器,因此在代码中可以执行以下操作:

…代码块::python

import asyncio
import sys

from matrix\io.malos.driver import imu\port,uv_port
从matrix_io.proto.malos.v1导入驱动程序_pb2
从matrix_io.proto.malos.v1导入sense_pb2


打印(sense_pb2.imu().fromstring(msg))
等待异步睡眠(1.0)



async def uv_数据(uv_驱动程序):
async for msg in uv_驱动程序。get_data():
打印(sense_pb2.uv().fromstring(msg))
等待异步睡眠(1.0)




定义状态处理程序(驱动程序):

type_mapping={
driver_pb2.status.message_type_not_defined:"未定义",
driver_pb2.status.started:"已启动",
driver_pb2.status.stopped:"已停止",
driver_pb2.status.config_received:"config received",
driver_pb2.status.command_executed:"command executed",
driver_pb2.status.status_critical:"critical",
driver_pb2.status.status_error:"error",
驱动程序pb2.status.status警告:"警告"
驱动程序pb2.status.status信息:"信息"
驱动程序pb2.status.status调试:"调试"
}



如果msg.uuid:
打印("uuid:{}"。格式(msg.uuid))
如果msg.message:
打印("message:{}"。格式(msg.message))


等待异步睡眠(1.0)


=driver_pb2.driverconfig()

uv_端口)

循环。创建任务(uv_driver.start_keep_alive())

loop.create_task(status_handler(uv_driver))

尝试:
loop.run_forever()
除了键盘中断:
print('关闭。再见,再见!,file=sys.stderr)
最后:
loop.stop()
asyncio.gather(*asyncio.task.all_tasks()).cancel()


loop.run_直到完成(loop.shutdown_asyncgens())
loop.close()

谁可以回答有关此库的问题?=
=





>-heitor席尔瓦和lt;heitor.silva@admobilize.com>;
-maciej ruckkgaber和lt;maciek.ruckgaaber@admobilize.com>;





>


==============






=============







/>…目录树::
:仅标题:


changelog

…_ 0mq:http://zeromq.org/
。_ python:https://www.python.org/
。_ virtualenv:https://virtualenv.pypa.io/en/stable/
。_ matrix io-protos-0.0.25:https://pypi.org/project/matrix io proto
。_ PYPI:https://pypi.org/
…_ matrix-malos服务:https://matrix io.github.io/matrix documentation/matrix core/getting started/understanding core/




欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
反射Java反射:高负载下的NoSuchMethodException   java RxJava:one request>list of Integer>sequence of requests for each int>result to list   java为什么循环之前索引会增加   JavaSpring远程处理和RESTfulURL   java Hibernate搜索仅对我的实体的一部分进行索引   使用DPAD快速滚动时,java RecyclerView onCreateViewHolder调用过多   java将JSON解析到一个表中   java导航抽屉标题textview nullpointerexception   基于接口的Java链接队列   java Guice运行时依赖项参数重新注入   java展平/压缩ZSH中的深度嵌套目录   JavaSpring:Http406此请求标识的资源只能   java如何制作Android启动器图标   Java代码在windows上显示不正确(包含希腊语句子)   使用yourkit进行内存分析所用的java时间   java为什么可以序列化属性而不能序列化对象本身?