• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Bluetooth Serial Port Profile connection app

Phenx_

Lurker
Trying to use this to open a bluetooth serial port profile from an Samsung android tablet and pair with a creditCard swiper device which will be controlled through payment software on the tablet. i have already gotten apk on the tablet installed successfully. It shows the device I want to pair with on the list but It will not let me pair and functionality seems poor.

Link: https://github.com/akexorcist/Android-BluetoothSPPLibrary

Decided to make a new thread and name it properly. Thanks for any help. I am a new app developer.
 
My adb is messed up so I'm reconfiguring. I'm pretty new to android studio so I barely understand the debugging at this point. But I checked out the bluetooth snoop log file on wireshark and It seems to be connecting. When I unpaired it from bluetooth it had problems though.
 
Ok so I got it working and successfully debugging after a few android studio debugger issues slowed me down.

I am able to pair successfully to the CC swiper device from my tablet. I have been doing this all on debug mode while stumbling my way through all the available debugging utilities from Android Studio. Once the device is connected I notice there are basically no issues that I have noticed when I run everything properly. It does seem the CC device is constantly listening and receiving commands and then sending responses to android.

My next step is to try and map out the serial data that is being sent and try and make sense of it. My main tool here so far seems to be using wireshark to read the bluetooth snooplog file. When I used logcat i didnt set any parameters and I just saw a constant stream of data on the command window going WAY too fast. I am assuming the logcat data is all the different functions and data streams that are going on in the device (let me know if that is correct or not?). I thought if I select to debug just the bluetooth app then I would be able at least make some sense of the logcat file.

Either way I will update tomorrow after some more testing and repackaging of the apk to include a couple more functions that I'm sure will be required by the CC device for the byte() reading from serial transfer.

I'm thinking something to do with this code right here (in android studio it says my send() function is not being used):
Java:
public void send(byte[] data, boolean CRLF) {
        if(mChatService.getState() == BluetoothState.STATE_CONNECTED) {
            if(CRLF) {
                byte[] data2 = new byte[data.length + 2];
                for(int i = 0 ; i < data.length ; i++)
                    data2[i] = data[i];
                data2[data2.length - 2] = 0x0A;
                data2[data2.length - 1] = 0x0D;
                mChatService.write(data2);
            } else {
                mChatService.write(data);
            }
        }
    }

Also i haven't been able to get auto-connect to work yet. Obviously I need to reanalyze everything from the documentation.

I guess my main hurdle is going to be using the debugging tools and trying to navigate Android Studio as I have less than a week experience with it atm.

-Phenx_
P.S. Thanks in advance. Any help is much appreciated :)
 
Back
Top Bottom