Commit 446b808d by hank

uicode big

parent 8339909c
import argparse import argparse
import json import json
import socket
from pythonosc import osc_message_builder from pythonosc import osc_message_builder
from pythonosc import udp_client from pythonosc import udp_client
if __name__ == "__main__": if __name__ == "__main__":
def sendUdp(data):
print(data.encode('utf-16be'), 'utf-16be')
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto(data.encode('utf-16be'), ('127.0.0.1', 7000))
s.close()
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--ip", default="192.168.43.44", parser.add_argument("--ip", default="127.0.0.1",
help="The ip of the OSC server") help="The ip of the OSC server")
parser.add_argument("--port", type=int, default=5006, parser.add_argument("--port", type=int, default=7000,
help="The port the OSC server is listening on") help="The port the OSC server is listening on")
args = parser.parse_args() args = parser.parse_args()
client = udp_client.SimpleUDPClient(args.ip, args.port) client = udp_client.SimpleUDPClient(args.ip, args.port)
str = "/首页/全国/省级/联络人/信息员"
client.send_message("/section", [0]) b = bytes(str,'utf-8').decode().encode('utf-16be')
\ No newline at end of file arr = [[0]*(4+len(b))][0]
arr[0] = 66
arr[1] = 69
arr[2] = 85
arr[3] = 67
for index in range(len(b)):
arr[index+4] = b[index]
client.send_message("/route", [bytes(arr)])
client.send_message("/首页/全国", [0, 1])
\ No newline at end of file
...@@ -3,7 +3,7 @@ import math ...@@ -3,7 +3,7 @@ import math
import json import json
from pythonosc import dispatcher from pythonosc import dispatcher
from pythonosc import osc_server from pythonosc import osc_server
import requests # import requests
import socket import socket
import os import os
print(socket.gethostname()) print(socket.gethostname())
...@@ -33,7 +33,7 @@ def ctrLamp(id, open): ...@@ -33,7 +33,7 @@ def ctrLamp(id, open):
'Content-Type': "application/json", 'Content-Type': "application/json",
'Access-Token': "OTZDOEQwREZBN0Y4RjY0NUFGRkY0NzQwMUU1NjFDNjQxNUM3MEE4QzY4N0E1QjBFQTNBM0U2QzU5OUVGNENGQw==" 'Access-Token': "OTZDOEQwREZBN0Y4RjY0NUFGRkY0NzQwMUU1NjFDNjQxNUM3MEE4QzY4N0E1QjBFQTNBM0U2QzU5OUVGNENGQw=="
} }
response = requests.request("POST", url, data=payload, headers=headers) response = ''
print(response.text) print(response.text)
...@@ -86,14 +86,14 @@ if __name__ == "__main__": ...@@ -86,14 +86,14 @@ if __name__ == "__main__":
parser.add_argument("--ip", parser.add_argument("--ip",
default='127.0.0.1', help="The ip to listen on") default='127.0.0.1', help="The ip to listen on")
parser.add_argument("--port", parser.add_argument("--port",
type=int, default=7000, help="The port to listen on") type=int, default=9000, help="The port to listen on")
args = parser.parse_args() args = parser.parse_args()
dispatcher = dispatcher.Dispatcher() dispatcher = dispatcher.Dispatcher()
# dispatcher.map("/Page", print) # dispatcher.map("/Page", print)
# dispatcher.map("/section", print) # dispatcher.map("/section", print)
dispatcher.map("/section", print) dispatcher.map("/待机", print)
print(args) print(args)
server = osc_server.ThreadingOSCUDPServer( server = osc_server.ThreadingOSCUDPServer(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment