Bluetooth Module connection

walterf25

Expert
Licensed User
Longtime User
Hello everyone, i'm working on a project which consists in communicating with an RN-41 bluetooth module with SPP protocol, i remember being able to connect to it before with my HTC Hero device, i now have a Motorola Photon 4G and i'm trying to connect to the module but everytime i try to do it i get a message that says "Connection Refused", i've never seen this error before, maybe someone here has seen this issue and has been able to figure out why?

below is the log i get when this happens, by the way i'm using the bluetooth example provided by Erel, I really hope is not an issue with the phone, although i'm able to see the module's mac address from my phone and even pair with it but can not connect to it, help anyone!

BuildUpdate widgetId=19
Orientation landscape=false
fetching: widget=19
type1
fetched: widget=19 returned= _id=1, widgetId=19, isAnalogStyle=false, bkClor=2
updateWidget Created settings _id=1, widgetId=19, isAnalogStyle=false, bkClor=2
clockSettings= _id=1, widgetId=19, isAnalogStyle=false, bkClor=2:4:2
buildUpdate
24hrs time format AddVerticalDigitalClock in else
Add Calender spanX: 4 spanY: 2 isLandscape: false
FULL_HDPI_FONTS_LAND_4X2
Scale=1.5
CreateMonthView
fetching: widget=19


type1
fetched: widget=19 returned= _id=1, widgetId=19, isAnalogStyle=false, bkClor=2
NetlinkEvent::FindParam(): Parameter 'UDEV_LOG' not found


event_filter: Received signal org.bluez.Adapter:DeviceCreated from /org/bluez/4182/hci0
ignoring non-kernel netlink multicast message
Filtering udevd generated netlink event
event_filter: Received signal org.bluez.Adapter:propertyChanged from /org/bluez/4182/hci0


event_filter: Received signal org.bluez.Device:propertyChanged from /org/bluez/4182/hci0/dev_00_06_66_43_A0_9F
agent_event_filter: Received method org.bluez.Agent:OutOfBandAvailable


event_filter: Received signal org.bluez.Device:propertyChanged from /org/bluez/4182/hci0/dev_00_06_66_43_A0_9F


Entering ACL Connected state with: -1
00:06:66:43:A0:9F bond state 10 -> 12 (0)
BluetoothSettingHandler Received android.bluetooth.device.action.BOND_STATE_CHANGED


BluetoothSettingHandler Uuids for device FireFly-A09F is NULL
BluetoothSettingHandler Profile string =
java.io.IOException: Connection refused


at android.bluetooth.BluetoothSocket.connectNative(Native Method)
at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:204)
at anywheresoftware.b4a.objects.Serial$1.run(Serial.java:152)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:444)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)
connected: false
java.io.IOException: Connection refused

thanks,
Walter
 

walterf25

Expert
Licensed User
Longtime User
Bluetooth

Ok, i just tried the old version of bluetooth example and when i try to connect to my RN-41 bluetooth module i get a java.io.exception Service Discovery Failed error, and then when i initialize the connection process with the RN-41 module it connects just fine even though i first receive the above mentioned error, what is going on, i don't really understand what the difference is, i can now send data from a hyperterminal to the phone through the RN-41 module, but i can't send any data back from the phone to the RN-41 module, why is that?

hope anyone can help me figure this out! :sign0085:

thanks,
Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Bluetooth module

Hi Erel thanks for the suggestion, i have already tried that and it still gives me the same issue what is the difference between the serial.connect and serial.connect3?

Thanks,
Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Bluetooth module

Hi Erel thanks for that link, and yes i did pair the devices first, it works with the old example if i initiate the connection with the RN-41 module.
 
Upvote 0
Top