add ranging feature in mesh control
This commit is contained in:
parent
f07b06ec60
commit
5cf839577a
7 changed files with 91 additions and 10 deletions
|
@ -348,19 +348,23 @@ class MeshUIConsumer(AsyncJsonWebsocketConsumer):
|
|||
self.msg_received_filter = {}
|
||||
|
||||
async def connect(self):
|
||||
if not self.scope["user_permisions"].mesh_control:
|
||||
if not self.scope["user_permissions"].mesh_control:
|
||||
raise DenyConnection
|
||||
await self.accept()
|
||||
|
||||
async def receive_json(self, content, **kwargs):
|
||||
if content.get("subscribe", None) == "log":
|
||||
await self.channel_layer.group_add("mesh_log", self.channel_name)
|
||||
if content.get("subscribe", None) == "msg_sent":
|
||||
await self.channel_layer.group_add("mesh_msg_sent", self.channel_name)
|
||||
self.msg_sent_filter = dict(content.get("filter", {}))
|
||||
if content.get("subscribe", None) == "msg_received":
|
||||
await self.channel_layer.group_add("mesh_msg_sent", self.channel_name)
|
||||
self.msg_received_filter = dict(content.get("filter", {}))
|
||||
# disabled because security
|
||||
#if content.get("subscribe", None) == "msg_sent":
|
||||
# await self.channel_layer.group_add("mesh_msg_sent", self.channel_name)
|
||||
# self.msg_sent_filter = dict(content.get("filter", {}))
|
||||
#if content.get("subscribe", None) == "msg_received":
|
||||
# await self.channel_layer.group_add("mesh_msg_sent", self.channel_name)
|
||||
# self.msg_received_filter = dict(content.get("filter", {}))
|
||||
if content.get("subscribe", None) == "ranging":
|
||||
await self.channel_layer.group_add("mesh_msg_received", self.channel_name)
|
||||
self.msg_received_filter = {"msg_type": MeshMessageType.LOCATE_RANGE_RESULTS.name}
|
||||
if "send_msg" in content:
|
||||
msg_to_send = self.scope["session"].pop("mesh_msg_%s" % content["send_msg"], None)
|
||||
if not msg_to_send:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue