' Automatic event of AStream when receiving data
Sub AStream_NewData(Buffer() As Byte)
' The received message is stored in global variable accessible from Activity modules
MsgReceived = BytesToString(Buffer, 0, Buffer.Length, "ISO-8859-1")
MsgReceivedHex = Conv.HexFromBytes(Buffer)
' Activate Sub NewMsgFromServiceAStream in the active Activity module
If IsPaused(ChatActivity) = False Then CallSub(ChatActivity, "NewMsgFromServiceAStream")
If IsPaused(Page3) = False Then CallSub(Page3, "NewMsgFromServiceAStream")
End Sub
' Automatic event of AStream
Sub AStream_Error
'ToastMessageShow("Connection is broken.", True)
ToastMessageShow("Bluetooth-forbindelse er brutt.", True)
' Deactivate buttons in the active Activity module
If IsPaused(ChatActivity) = False Then CallSub(ChatActivity, "DeactivateButtons")
If IsPaused(Page3) = False Then CallSub(Page3, "DeactivateButtons")
End Sub
Sub AStream_Terminated
AStream_Error
End Sub