D
Deleted member 103
Guest
Hello,
I try using a Bluetooth device to an IRDA device to send command, but get no response from the IRDA device.
According to the description, after you have mounted together to connect to the Bluetooth device when you send this code to the IRDA device should then answer the IRDA device with 2 bytes. Unfortunately I get no response from the IRDA device!
The connection with the Bluetooth device is one problem.
The Bluetooth device is a "IZAR OH BT".
Here is my code:
Has anyone made experience with these devices and can give me a tip?
Ciao,
Filippo
I try using a Bluetooth device to an IRDA device to send command, but get no response from the IRDA device.
According to the description, after you have mounted together to connect to the Bluetooth device when you send this code to the IRDA device should then answer the IRDA device with 2 bytes. Unfortunately I get no response from the IRDA device!
The connection with the Bluetooth device is one problem.
The Bluetooth device is a "IZAR OH BT".
Here is my code:
B4X:
'Activity module
Sub Process_Globals
Dim AStream As AsyncStreams
End Sub
Sub Globals
Dim txtInput As EditText
Dim txtLog As EditText
Dim btnSend As Button
Dim txtInput As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("2")
If AStream.IsInitialized = False Then
AStream.Initialize(Main.serial1.InputStream, Main.serial1.OutputStream, "AStream")
End If
txtLog.Width = 100%x
Dim strVerbindungsaufbau As String
'strVerbindungsaufbau=Chr(0x7F)
For i = 0 To 999
strVerbindungsaufbau= strVerbindungsaufbau & Chr(0x55)
Next
'strVerbindungsaufbau= strVerbindungsaufbau & Chr(0xE5)
'String für die Verbindungsaufbau senden
AStream.Write(strVerbindungsaufbau.GetBytes("UTF8")) '("ASCII")) '
LogMessage("Me", strVerbindungsaufbau)
End Sub
Sub AStream_NewData (Buffer() As Byte)
LogMessage("You", BytesToString(Buffer, 0, Buffer.Length,"UTF8")) ' "ASCII")) '
End Sub
Sub AStream_Error
ToastMessageShow("Connection is broken.", True)
btnSend.Enabled = False
txtInput.Enabled = False
End Sub
Sub AStream_Terminated
AStream_Error
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
AStream.Close
End If
End Sub
Sub txtInput_EnterPressed
If btnSend.Enabled = True Then btnSend_Click
End Sub
Sub btnSend_Click
'Test: Steuerkommando IRDA senden
txtInput.Text=Chr(0xFE) & Chr(0xFE) & Chr(0xFE) & "BLUE1112" & Chr(0xFF)
AStream.Write(txtInput.Text.GetBytes("UTF8")) '("ASCII")) '
txtInput.SelectAll
txtInput.RequestFocus
LogMessage("Me", txtInput.Text)
End Sub
Sub LogMessage(From As String, Msg As String)
txtLog.Text = txtLog.Text & From & ": " & Msg & CRLF
txtLog.SelectionStart = txtLog.Text.Length
End Sub
Has anyone made experience with these devices and can give me a tip?
Ciao,
Filippo
Last edited by a moderator: