i using esp8266 MQTT send data to B4A and B4I, but only B4I get the error message.
How to solve it?
ESP8266 code
B4A code:
B4I code:
when run B4A all going smooth no error, but in B4I i got this error:
i saw the the different is when receive the payload()
B4A = picture1
B4I = picture2
Thank you.
How to solve it?
ESP8266 code
B4X:
If MqttConnected Then
Dim robj(3) As Object
robj(0)="im_online"
robj(1)=""
robj(2)=""
mqtt.Publish2(get_device_id,Ser.ConvertArrayToBytes(robj),False)
End If
B4A code:
B4X:
Private Sub mqtt_MessageArrived (Topic As String, Payload() As Byte)
If selected_device_id=Topic Then
Dim obj() As Object=rser.ConvertBytesToArray(Payload)
Dim case_type As String=obj(0)
If case_type="im_online" Then
DateTime.DateFormat="yyyy-MM-dd HH:mm:ss"
Dim date_now As String=DateTime.Date(DateTime.Now)
sql1.ExecNonQuery2("UPDATE tbl_location SET datetime_online=? WHERE device_id=?",Array As String(date_now,Topic))
End If
End If
End Sub
B4I code:
B4X:
Private Sub mqtt_MessageArrived (Topic As String, Payload() As Byte)
If selected_device_id=Topic Then
Dim obj() As Object=rser.ConvertBytesToArray(Payload)
Dim case_type As String=obj(0)
If case_type="im_online" Then
DateTime.DateFormat="yyyy-MM-dd HH:mm:ss"
Dim date_now As String=DateTime.Date(DateTime.Now)
sql1.ExecNonQuery2("UPDATE tbl_location SET datetime_online=? WHERE device_id=?",Array As String(date_now,Topic))
End If
End If
End Sub
when run B4A all going smooth no error, but in B4I i got this error:
B4X:
Out of bounds. Index=0 Length=0
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
Smart Home Pro -[B4IArray getObjectFast:] + 224
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
Smart Home Pro +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
Smart Home Pro -[B4IShell runMethod:] + 448
Smart Home Pro -[B4IShell raiseEventImpl:method:args::] + 1648
Smart Home Pro -[B4IShellBI raiseEvent:event:params:] + 1580
Smart Home Pro +[B4IObjectWrapper raiseEvent:::] + 300
Smart Home Pro -[MQTTClient handleMessage:onTopic:retained:] + 232
Smart Home Pro -[MQTTSessionManager newMessage:data:onTopic:qos:retained:mid:] + 144
Smart Home Pro -[MQTTSession handlePublish:] + 996
Smart Home Pro -[MQTTSession decoder:newMessage:] + 2204
Smart Home Pro -[MQTTDecoder stream:handleEvent:] + 2260
CoreFoundation <redacted> + 216
CoreFoundation <redacted> + 244
CoreFoundation <redacted> + 308
CFNetwork <redacted> + 64
CFNetwork <redacted> + 156
CFNetwork <redacted> + 88
CoreFoundation <redacted> + 1316
CoreFoundation <redacted> + 24
CoreFoundation <redacted> + 88
CoreFoundation <redacted> + 176
CoreFoundation <redacted> + 1004
CoreFoundation CFRunLoopRunSpecific + 436
GraphicsServices GSEventRunModal + 104
UIKitCore UIApplicationMain + 212
Smart Home Pro main + 124
libdyld.dylib <redacted> + 4
i saw the the different is when receive the payload()
B4A = picture1
B4I = picture2
Thank you.
Attachments
Last edited: