|
|
@ -8,7 +8,7 @@ port = 48835
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with open("../user.txt", "r") as f:
|
|
|
|
with open("smp_coder/user.txt", "r") as f:
|
|
|
|
user_id = f.read().strip()
|
|
|
|
user_id = f.read().strip()
|
|
|
|
user_id = user_id.split("=")[-1]
|
|
|
|
user_id = user_id.split("=")[-1]
|
|
|
|
|
|
|
|
|
|
|
@ -27,7 +27,7 @@ def on_message(client, userdata, msg):
|
|
|
|
if msg.payload.decode() == "image produce": # 收到拍照请求
|
|
|
|
if msg.payload.decode() == "image produce": # 收到拍照请求
|
|
|
|
# 打开相机,拍照,保存图片,发送图片
|
|
|
|
# 打开相机,拍照,保存图片,发送图片
|
|
|
|
if not os.path.exists("/tmp/image.jpg"):
|
|
|
|
if not os.path.exists("/tmp/image.jpg"):
|
|
|
|
os.system("bash camera.sh")
|
|
|
|
os.system("bash smp_coder/camera.sh")
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
client.publish("response/{}".format(user_id), "image produce success!", qos=2)
|
|
|
|
client.publish("response/{}".format(user_id), "image produce success!", qos=2)
|
|
|
|