Reply
Thread Tools
Posts: 7 | Thanked: 1 time | Joined on Mar 2006
#1
hi,
i'm writing a simple cmd-line application based on serial bt communication to a bt reader.

I'm using perl cause i have to call this script from opera browser (but same problem using this perl script with cmd-line).

Thanks to your help, no problem connecting to
/dev/rfcomm0:
# after setting up with "rfcomm connect... " and after opening connection
open ($fd, "+< /dev/rfcomm0") or die "cannot open serial port";

and no problem writing on it:
print $fd chr(0x03). chr(0x00). chr(0x01). chr(0x01). chr (0x03 ^ 0x00 ^ 0x01 ^ 0x01);
as written into device serial port communication manual, with this print, device beeps a special tone.

but...
on every request i send with a "print" my device have to do something and send me a response.

i can't read this response...

can you help me? other languages are welcome too.

thank you in advance,
mbertazz
 

The Following User Says Thank You to mbertazz For This Useful Post:
Posts: 474 | Thanked: 30 times | Joined on Jan 2006
#2
What problem are you encountering, exactly?

Does the application hang and return no data on read?
Do you get a permission error when attempting to read?
You seem to have the right file mode...and it's not a buffering issue...
 
Posts: 7 | Thanked: 1 time | Joined on Mar 2006
#3
another test:

connected to device using /dev/rfcomm0
use the script to test connection sending a msg from 770 to device: OK
use this:
cat /dev/rfcomm0
now, i'm connected (i hear same beeps as with the previous script), but i don't see any data printed on stdout when i press generate a event on the device (if i do this with a bt gps i see nmea data)
 
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#4
Some devices can have only one way communication, this is possible with BT rfcomm specs. Both GPS and BT keyboards usually only send but cannot receive. Maybe you need to connect to another rfcomm port to receive? Depends on specific device of course.
 
Posts: 7 | Thanked: 1 time | Joined on Mar 2006
#5
maybe, but how to solve this problem?
this is sdptool output ("sdptool records [BTADDRESS]" cause nothing is shown with "browse"):
Service Name: Spp
ServiceRecHandle: 0X10000
Service Class ID List:
"Service Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1

any ideas?


thanks a lot,
mbertazz
 
Reply


 
Forum Jump


All times are GMT. The time now is 09:44.