Android Question BT bytes send and get response

vincentehsu

Member
Licensed User
Longtime User
so,I can get the bt device response data in below section?
B4X:
Sub AStream_NewData (Buffer() As Byte)
    'LogMessage("You", BytesToString(Buffer, 0, Buffer.Length, "UTF8"))
   
    txtLog.Text =BytesToString(Buffer, 0, Buffer.Length, "UTF8")
End Sub
 
Upvote 0

vincentehsu

Member
Licensed User
Longtime User
Dear Sir:

I can't get any response from my BT device via
B4X:
Sub AStream_NewData (Buffer() As Byte)
   
Dim i As Int
    For i= 0 To Buffer.Length-1
        Log(Buffer(i))
    Next
End Sub
 
Upvote 0

raphaelcno

Active Member
Licensed User
Longtime User
Does the BT device receive bytes from your Android device when you use the Write command in your B4A app?
 
Upvote 0

vincentehsu

Member
Licensed User
Longtime User
I have an Xcode project.i wanna write an android version via b4a.I used the same command in my Xcode project and it's worked fine
 
Upvote 0

vincentehsu

Member
Licensed User
Longtime User
It's maybe still not so clear,let me upload my source code and explain that.
I have an Xcode project.i wanna write an android version via b4a.I used the same command as below in my Xcode project and it's worked fine
B4X:
(void)getDeviceSN{
    NSLog(@"getSN");
    self.status=MPAGetSN;
    Byte cmd0[0x04] = {0x00,0x02,0xF2, 0xF2};
    [self send:cmd0 andLength: sizeof(cmd0)];
}

in my b4a project ,I used the same command but i can't get any response from bt device
B4X:
Sub btnSend_Click
    Dim TriggerPayment() As Byte = Array As Byte(0x00,0x02,0xf2, 0xf2)
    AStream.Write(TriggerPayment)
End Sub

attachment is my b4a project,could anybody tell me what event can i get the response from bt device
 

Attachments

  • Bluetooth.zip
    422 KB · Views: 161
Upvote 0
Top