I have a broker written in B4j that receives data packets from a remote Arduino device.
Once the data packet is received, I then query a MySQL database table for device configuration settings and create a String to Tx.
I must now send this String to the Arduino.
How do I reply to the remote Arduino device?
On receipt of the UDP packet, I receive the following logs:
RDC:
I must send the string "myConfigTX" to the remote Arduino device
Once the data packet is received, I then query a MySQL database table for device configuration settings and create a String to Tx.
I must now send this String to the Arduino.
How do I reply to the remote Arduino device?
On receipt of the UDP packet, I receive the following logs:
B4X:
ListenForClients started...
Server Initialized: 10.0.17.2-5000
Server Listening for connections...
Data Received...
Server Listening for connections...
Got: CONFIGIS002
Len Received: 11
Got Config
Config ID: IS002
Got This: CONFIGIS002
Config TX: 00,176,25,20000,30,24
RDC:
B4X:
Sub getConfig(myDeviceID As String)
'sql.get_configs=SELECT tracking, wakecount, maxvibs, vibinterval, trackcount, checkvib FROM devices WHERE deviceid=?
Dim myTracking As String
Dim myWakeCount As String
Dim myMaxVibs As String
Dim myVibInterval As String
Dim myTrackCount As String
Dim myCheckVib As String
Dim myConfigTX As String
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("get_configs", Array(myDeviceID))
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
For Each row() As Object In res.Rows
myTracking = row(res.Columns.Get("tracking"))
myWakeCount = row(res.Columns.Get("wakecount"))
myMaxVibs = row(res.Columns.Get("maxvibs"))
myVibInterval = row(res.Columns.Get("vibinterval"))
myTrackCount = row(res.Columns.Get("trackcount"))
myCheckVib = row(res.Columns.Get("checkvib"))
myConfigTX = myTracking & "," & myWakeCount &"," & myMaxVibs & "," & myVibInterval & "," & myTrackCount & "," & myCheckVib
Log("Config TX: " & myConfigTX)
Next
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
End Sub
I must send the string "myConfigTX" to the remote Arduino device