update
This commit is contained in:
@@ -533,8 +533,10 @@ end
|
|||||||
an outgoing message
|
an outgoing message
|
||||||
|
|
||||||
# Keyword Arguments
|
# Keyword Arguments
|
||||||
- `timeout::Integer`
|
- `timeout::Integer=60`
|
||||||
time to wait for a response before error
|
time in seconds to wait for a response before error
|
||||||
|
- `maxattempt::Integer=1`
|
||||||
|
maximum number of attempts to send and receive message
|
||||||
|
|
||||||
# Return
|
# Return
|
||||||
- `result::NamedTuple`
|
- `result::NamedTuple`
|
||||||
@@ -562,9 +564,6 @@ julia> outgoingMsg = Dict(
|
|||||||
julia> success, error, response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
|
julia> success, error, response = GeneralUtils.sendReceiveMqttMsg(outgoingMsg)
|
||||||
```
|
```
|
||||||
|
|
||||||
# TODO
|
|
||||||
- [] update docs
|
|
||||||
|
|
||||||
# Signature
|
# Signature
|
||||||
"""
|
"""
|
||||||
function sendReceiveMqttMsg(outgoingMsg::Dict{Symbol, T};
|
function sendReceiveMqttMsg(outgoingMsg::Dict{Symbol, T};
|
||||||
@@ -595,7 +594,6 @@ function sendReceiveMqttMsg(outgoingMsg::Dict{Symbol, T};
|
|||||||
|
|
||||||
return response
|
return response
|
||||||
end
|
end
|
||||||
|
|
||||||
function sendReceiveMqttMsg(mqttInstance::mqttClientInstance_v2, receivechannel::Symbol,
|
function sendReceiveMqttMsg(mqttInstance::mqttClientInstance_v2, receivechannel::Symbol,
|
||||||
outgoingMsg::Dict{Symbol, T}; timeout::Integer=60, maxattempt::Integer=1
|
outgoingMsg::Dict{Symbol, T}; timeout::Integer=60, maxattempt::Integer=1
|
||||||
)::NamedTuple where {T<:Any}
|
)::NamedTuple where {T<:Any}
|
||||||
@@ -645,12 +643,20 @@ end
|
|||||||
""" Send a message to specified MQTT topic then wait for reply.
|
""" Send a message to specified MQTT topic then wait for reply.
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
- `outgoingMsg::Dict`
|
- `workDict::Dict`
|
||||||
an outgoing message
|
A dictionary containing workspace data
|
||||||
|
- `incomingMsg::Dict`
|
||||||
|
The incoming message to process
|
||||||
|
|
||||||
|
# Keyword Arguments
|
||||||
|
- `data`
|
||||||
|
Optional data to be transferred. Default is nothing.
|
||||||
|
|
||||||
# Return
|
# Return
|
||||||
- `result::NamedTuple`
|
- `result::Dict`
|
||||||
( success= true, error= nothing )
|
A dictionary containing either:
|
||||||
|
- Metadata about the data transfer session if initiating a new transfer
|
||||||
|
- The requested data part if responding to a data part request
|
||||||
|
|
||||||
# Example
|
# Example
|
||||||
```jldoctest
|
```jldoctest
|
||||||
@@ -670,9 +676,7 @@ end
|
|||||||
julia> success, error = GeneralUtils.sendMqttMsg(outgoingMsg)
|
julia> success, error = GeneralUtils.sendMqttMsg(outgoingMsg)
|
||||||
```
|
```
|
||||||
# TODO
|
# TODO
|
||||||
- [x] implement crude version of this function
|
- [x] transfer multiple msg with the same mqtt connection. The transfer loop should be
|
||||||
- [] update docs
|
|
||||||
- [] transfer multiple msg with the same mqtt connection. The transfer loop should be
|
|
||||||
implemented by passing mqttInstance into sendReceiveMqttMsg() so that
|
implemented by passing mqttInstance into sendReceiveMqttMsg() so that
|
||||||
1-connection is used to send all data
|
1-connection is used to send all data
|
||||||
- [] partsize should be calculate from the fact that MQTT max size is 4MB (256MB theorectically)
|
- [] partsize should be calculate from the fact that MQTT max size is 4MB (256MB theorectically)
|
||||||
@@ -789,7 +793,6 @@ function dataTransferOverMQTT_sender(workDict::Dict, incomingMsg::Dict; data=not
|
|||||||
|
|
||||||
return d
|
return d
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
""" Send a message to specified MQTT topic then wait for reply.
|
""" Send a message to specified MQTT topic then wait for reply.
|
||||||
|
|||||||
Reference in New Issue
Block a user