This commit is contained in:
2024-09-13 15:07:19 +07:00
commit c8684dea31
28 changed files with 9143 additions and 0 deletions

67
test/runtest.jl Normal file
View File

@@ -0,0 +1,67 @@
using Revise
using GeneralUtils
# text = "TODAY thought: what to do plan: wake up and going out action: 1. wake up 2. eat 3. sleep"
# sample_keywords = ["thought", "plan", "action"]
# resultdict = GeneralUtils.textToDict(text, sample_keywords; rightmarker=":", symbolkey=true)
# println(resultdict)
storedata = Channel(8)
keepalive = Channel(8)
function onMsgCallback_1(topic, payload)
jobj = JSON3.read(String(payload))
incomingMqttMsg = copy(jobj) # convert json object into julia dictionary recursively
topic = split(topic, "/")
if "keepalive" _topic
put!(keepaliveChannel, incomingMqttMsg)
elseif "testingprompt" topic
# @show incomingMqttMsg
put!(storedata, incomingMqttMsg)
else
@show "undefined condition"
end
end
mqttInstance = GeneralUtils.mqttClientInstance(
"mqtt.yiem.cc",
1883,
["/testingprompt"],
storedata,
keepalive,
onMsgCallback_1
)
_ = GeneralUtils.checkMqttConnection!(mqttInstance)
println("555")