2005-01-28 14:06:02

by Ka Kin Cheung

[permalink] [raw]
Subject: [Bluez-users] rfcomm question 1

Hi Marcel!
I'm doing a project using bluetooth. But I have something to ask.
Now, I make the connection between Linux PC and Sony Ericsson T610 by typing "rfcomm connect 0 <adress>", and it was success. Then, I wish to make the connection in this way: let T610 be the client and PC be the server. When T610 searched the PC, I wish to connect them by selecting the PC in the mobile. But when I entered the PIN, the mobile always showed "PIN not match". Why is that? And how can I do so that the connection can be created by mobile phone?
Thank you very much.
Michael




---------------------------------
?s?~?@???Ĥ@?? : ?????ͽt?H


2005-01-31 14:38:16

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 1

Hi Michael,

> The version of my hcidump is 1.16. Is it related?
> And how can I correct it as you said the setting is
> fine but the hcidump is strange?

don't worry so much about it. Check with hciconfig that auth and encrypt
are not set and that you put your PIN in /etc/bluetooth/pin and then
restart hcid. Make sure that only one copy of hcid is running.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-01-31 14:30:18

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 1

Hi Marcel,
The version of my hcidump is 1.16. Is it related?
And how can I correct it as you said the setting is
fine but the hcidump is strange?
Thanks!
Michael

--- Marcel Holtmann <[email protected]> ???e?G
> Hi Michael,
>
> > Here is the content of
> /etc/bluetooth/hcid.conf
> > #
> > # HCI daemon configuration file.
> > #
> > # $Id: hcid.conf,v 1.7 2004/12/13 14:16:03
> holtmann
> > Exp $
> > #
> >
> > # HCId options
> > options {
> > # Automatically initialize new devices
> > autoinit yes;
> >
> > # Security Manager mode
> > # none - Security manager disabled
> > # auto - Use local PIN for incoming
> > connections
> > # user - Always ask user for a PIN
> > #
> > security auto;
> >
> > # Pairing mode
> > # none - Pairing disabled
> > # multi - Allow pairing with already
> paired
> > devices
> > # once - Pair once and deny successive
> > attempts
> > pairing multi;
> >
> > # PIN helper
> > pin_helper /usr/bin/bluepin;
> >
> > # D-Bus PIN helper
> > #dbus_pin_helper;
> > }
> >
> > # Default settings for HCI devices
> > device {
> > # Local device name
> > # %d - device id
> > # %h - host name
> > #name "BlueZ (%d)";
> > name "cm218-253-8-120.hkcable.com.hk:%d"
> > # Local device class
> > class 0x3e0100;
> >
> > # Default packet type
> > #pkt_type DH1,DM1,HV1;
> >
> > # Inquiry and Page scan
> > iscan enable; pscan enable;
> >
> > # Default link mode
> > # none - no specific policy
> > # accept - always accept incoming
> > connections
> > # master - become master on incoming
> > connections,
> > # deny role switch on outgoing
> > connections
> > lm accept;
> >
> > # Default link policy
> > # none - no specific policy
> > # rswitch - allow role switch
> > # hold - allow hold mode
> > # sniff - allow sniff mode
> > # park - allow park mode
> > lp rswitch,hold,sniff,park;
> >
> > # Authentication and Encryption (Security
> Mode
> > 3)
> > #auth enable;
> > #encrypt enable;
> > }
> > How can I modify the Security Mode?
>
> this setting is fine. It is in security mode 1/2,
> but your hcidump was a
> little bit strange, because it looked like security
> mode 3 and normally
> mobile phones are not in that mode.
>
> > Also, how can I change the PIN of my Linux PC?
>
> For incoming connection the PIN is in
> /etc/bluetooth/pin and you need to
> restart hcid after you changed it.
>
> Regards
>
> Marcel
>
>
>
>
>
-------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW --
> Interactive Reporting
> Tool for open source databases. Create drag-&-drop
> reports. Save time
> by over 75%! Publish reports on the web. Export to
> DOC, XLS, RTF, etc.
> Download a FREE copy at
> http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
>
https://lists.sourceforge.net/lists/listinfo/bluez-users
>

_______________________________________________________________________
?s?~?@???Ĥ@?? : ?????ͽt?H
http://personals.yahoo.com.hk


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-01-31 14:22:20

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 1

Hi Michael,

> Here is the content of /etc/bluetooth/hcid.conf
> #
> # HCI daemon configuration file.
> #
> # $Id: hcid.conf,v 1.7 2004/12/13 14:16:03 holtmann
> Exp $
> #
>
> # HCId options
> options {
> # Automatically initialize new devices
> autoinit yes;
>
> # Security Manager mode
> # none - Security manager disabled
> # auto - Use local PIN for incoming
> connections
> # user - Always ask user for a PIN
> #
> security auto;
>
> # Pairing mode
> # none - Pairing disabled
> # multi - Allow pairing with already paired
> devices
> # once - Pair once and deny successive
> attempts
> pairing multi;
>
> # PIN helper
> pin_helper /usr/bin/bluepin;
>
> # D-Bus PIN helper
> #dbus_pin_helper;
> }
>
> # Default settings for HCI devices
> device {
> # Local device name
> # %d - device id
> # %h - host name
> #name "BlueZ (%d)";
> name "cm218-253-8-120.hkcable.com.hk:%d"
> # Local device class
> class 0x3e0100;
>
> # Default packet type
> #pkt_type DH1,DM1,HV1;
>
> # Inquiry and Page scan
> iscan enable; pscan enable;
>
> # Default link mode
> # none - no specific policy
> # accept - always accept incoming
> connections
> # master - become master on incoming
> connections,
> # deny role switch on outgoing
> connections
> lm accept;
>
> # Default link policy
> # none - no specific policy
> # rswitch - allow role switch
> # hold - allow hold mode
> # sniff - allow sniff mode
> # park - allow park mode
> lp rswitch,hold,sniff,park;
>
> # Authentication and Encryption (Security Mode
> 3)
> #auth enable;
> #encrypt enable;
> }
> How can I modify the Security Mode?

this setting is fine. It is in security mode 1/2, but your hcidump was a
little bit strange, because it looked like security mode 3 and normally
mobile phones are not in that mode.

> Also, how can I change the PIN of my Linux PC?

For incoming connection the PIN is in /etc/bluetooth/pin and you need to
restart hcid after you changed it.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-01-31 13:41:52

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 1

Hi Marcel,
Here is the content of /etc/bluetooth/hcid.conf
#
# HCI daemon configuration file.
#
# $Id: hcid.conf,v 1.7 2004/12/13 14:16:03 holtmann
Exp $
#

# HCId options
options {
# Automatically initialize new devices
autoinit yes;

# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming
connections
# user - Always ask user for a PIN
#
security auto;

# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired
devices
# once - Pair once and deny successive
attempts
pairing multi;

# PIN helper
pin_helper /usr/bin/bluepin;

# D-Bus PIN helper
#dbus_pin_helper;
}

# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
#name "BlueZ (%d)";
name "cm218-253-8-120.hkcable.com.hk:%d"
# Local device class
class 0x3e0100;

# Default packet type
#pkt_type DH1,DM1,HV1;

# Inquiry and Page scan
iscan enable; pscan enable;

# Default link mode
# none - no specific policy
# accept - always accept incoming
connections
# master - become master on incoming
connections,
# deny role switch on outgoing
connections
lm accept;

# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp rswitch,hold,sniff,park;

# Authentication and Encryption (Security Mode
3)
#auth enable;
#encrypt enable;
}
How can I modify the Security Mode?
Also, how can I change the PIN of my Linux PC?
Thank you very much.
Michael

--- Marcel Holtmann <[email protected]> ???e?G
> Hi Michael,
>
> > Of course, hcid is running. Then when I typed
> > "hcidump -x", and then choose the computer in
> mobile
> > phone, after I entered the PIN, the following
> occurs:
> > [root@cm218-253-8-120 root]# hcidump -x
> > HCIDump - HCI packet analyzer ver 1.16
> > device: hci0 snap_len: 1028 filter: 0xffffffff
> > > HCI Event: Connect Request (0x04) plen 10
> > A8 D8 DD D9 0A 00 04 02 52 01
> > < HCI Command: Accept Connection Request
> (0x01|0x0009)
> > plen 7
> > A8 D8 DD D9 0A 00 01
> > > HCI Event: Command Status (0x0f) plen 4
> > 00 01 09 04
> > > HCI Event: PIN Code Request (0x16) plen 6
> > A8 D8 DD D9 0A 00
> > < HCI Command: PIN Code Request Reply
> (0x01|0x000d)
> > plen 23
> > A8 D8 DD D9 0A 00 05 42 6C 75 65 5A 00 00 00 00
> 00
> > 00 00 00
> > 00 00 00
> > > HCI Event: Command Complete (0x0e) plen 10
> > 01 0D 04 00 A8 D8 DD D9 0A 00
> > > HCI Event: Connect Complete (0x03) plen 11
> > 05 29 00 A8 D8 DD D9 0A 00 01 00
> > But the mobile shows "PIN not match". So how can I
> do?
>
> run "hcidump -X" and you might see your PIN. I guess
> it is "BlueZ" and
> why are you using security mode 3?
>
> Regards
>
> Marcel
>
>
>
>
>
-------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW --
> Interactive Reporting
> Tool for open source databases. Create drag-&-drop
> reports. Save time
> by over 75%! Publish reports on the web. Export to
> DOC, XLS, RTF, etc.
> Download a FREE copy at
> http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
>
https://lists.sourceforge.net/lists/listinfo/bluez-users
>

_______________________________________________________________________
?s?~?@???Ĥ@?? : ?????ͽt?H
http://personals.yahoo.com.hk


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-01-29 14:03:31

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 1

Hi Michael,

> Of course, hcid is running. Then when I typed
> "hcidump -x", and then choose the computer in mobile
> phone, after I entered the PIN, the following occurs:
> [root@cm218-253-8-120 root]# hcidump -x
> HCIDump - HCI packet analyzer ver 1.16
> device: hci0 snap_len: 1028 filter: 0xffffffff
> > HCI Event: Connect Request (0x04) plen 10
> A8 D8 DD D9 0A 00 04 02 52 01
> < HCI Command: Accept Connection Request (0x01|0x0009)
> plen 7
> A8 D8 DD D9 0A 00 01
> > HCI Event: Command Status (0x0f) plen 4
> 00 01 09 04
> > HCI Event: PIN Code Request (0x16) plen 6
> A8 D8 DD D9 0A 00
> < HCI Command: PIN Code Request Reply (0x01|0x000d)
> plen 23
> A8 D8 DD D9 0A 00 05 42 6C 75 65 5A 00 00 00 00 00
> 00 00 00
> 00 00 00
> > HCI Event: Command Complete (0x0e) plen 10
> 01 0D 04 00 A8 D8 DD D9 0A 00
> > HCI Event: Connect Complete (0x03) plen 11
> 05 29 00 A8 D8 DD D9 0A 00 01 00
> But the mobile shows "PIN not match". So how can I do?

run "hcidump -X" and you might see your PIN. I guess it is "BlueZ" and
why are you using security mode 3?

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-01-29 05:32:22

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 1

Hi Marcel!
Of course, hcid is running. Then when I typed
"hcidump -x", and then choose the computer in mobile
phone, after I entered the PIN, the following occurs:
[root@cm218-253-8-120 root]# hcidump -x
HCIDump - HCI packet analyzer ver 1.16
device: hci0 snap_len: 1028 filter: 0xffffffff
> HCI Event: Connect Request (0x04) plen 10
A8 D8 DD D9 0A 00 04 02 52 01
< HCI Command: Accept Connection Request (0x01|0x0009)
plen 7
A8 D8 DD D9 0A 00 01
> HCI Event: Command Status (0x0f) plen 4
00 01 09 04
> HCI Event: PIN Code Request (0x16) plen 6
A8 D8 DD D9 0A 00
< HCI Command: PIN Code Request Reply (0x01|0x000d)
plen 23
A8 D8 DD D9 0A 00 05 42 6C 75 65 5A 00 00 00 00 00
00 00 00
00 00 00
> HCI Event: Command Complete (0x0e) plen 10
01 0D 04 00 A8 D8 DD D9 0A 00
> HCI Event: Connect Complete (0x03) plen 11
05 29 00 A8 D8 DD D9 0A 00 01 00
But the mobile shows "PIN not match". So how can I do?
Michael

--- Marcel Holtmann <[email protected]> ???e?G
> Hi Michael,
>
> > I'm doing a project using bluetooth. But I have
> something to ask.
> > Now, I make the connection between Linux PC and
> Sony Ericsson T610 by
> > typing "rfcomm connect 0 <adress>", and it was
> success. Then, I wish
> > to make the connection in this way: let T610 be
> the client and PC be
> > the server. When T610 searched the PC, I wish to
> connect them by
> > selecting the PC in the mobile. But when I entered
> the PIN, the mobile
> > always showed "PIN not match". Why is that? And
> how can I do so that
> > the connection can be created by mobile phone?
>
> do you have hcid running? What does "hcidump -x" as
> root shows when you
> connect from the mobile phone?
>
> Regards
>
> Marcel
>
>
>
>
>
-------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW --
> Interactive Reporting
> Tool for open source databases. Create drag-&-drop
> reports. Save time
> by over 75%! Publish reports on the web. Export to
> DOC, XLS, RTF, etc.
> Download a FREE copy at
> http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
>
https://lists.sourceforge.net/lists/listinfo/bluez-users
>

_______________________________________________________________________
?s?~?@???Ĥ@?? : ?????ͽt?H
http://personals.yahoo.com.hk


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-01-28 17:36:15

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 1

Hi Michael,

> I'm doing a project using bluetooth. But I have something to ask.
> Now, I make the connection between Linux PC and Sony Ericsson T610 by
> typing "rfcomm connect 0 <adress>", and it was success. Then, I wish
> to make the connection in this way: let T610 be the client and PC be
> the server. When T610 searched the PC, I wish to connect them by
> selecting the PC in the mobile. But when I entered the PIN, the mobile
> always showed "PIN not match". Why is that? And how can I do so that
> the connection can be created by mobile phone?

do you have hcid running? What does "hcidump -x" as root shows when you
connect from the mobile phone?

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-19 13:45:36

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marco!
I'm surprising that you are quite interested about
my project as you didn't do about the thing what I've
done, I think.
Regarding to your questions:
1.> what service is on rfcomm channel 0 on the mobile
phone? obex?
Sorry, I'm not sure what you are asking. But about
OBEX, after I did for "sdptool browse <address>" for
my T610, following occurs
Service Name: Dial-up Networking
Service RecHandle: 0x10000
Service Class ID List:
"Dialup Networking" (0x1103)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100

Service Name: Voice gateway
Service RecHandle: 0x10002
Service Class ID List:
"Headset Audio Gateway" (0x1112)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
Profile Descriptor List:
"Headset" (0x1108)
Version: 0x0100

Service Name: Serial Port 1
Service RecHandle: 0x10003
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4

Service Name: Serial Port 2
Service RecHandle: 0x10004
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 5

Service Name: OBEX Object Push
Service RecHandle: 0x10005
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 10
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100

Service Name: IrMC Synchronization
Service RecHandle: 0x10006
Service Class ID List:
"IrMCSync" (0x1104)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 11
"OBEX" (0x0008)
Profile Descriptor List:
"IrMCSync" (0x1104)
Version: 0x0100

Service Name: HF Voice gateway
Service RecHandle: 0x10007
Service Class ID List:
"" (0x111f)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 6
Profile Descriptor List:
"" (0x111e)
Version: 0x0100

Service Name: OBEX Basic Imaging
Service RecHandle: 0x1000b
Service Class ID List:
"" (0x111b)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 15
"OBEX" (0x0008)
Profile Descriptor List:
"" (0x111a)
Version: 0x0100

Service Name: OBEX File Transfer
Service RecHandle: 0x1000f
Service Class ID List:
"OBEX File Transfer" (0x1106)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 7
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX File Transfer" (0x1106)
Version: 0x0100

If regarding the above output, the service I wish
to use should be OBEX OIbject Push, and it is in
channel 10. Am I right?
2.>It wouldn't make sense, because the mobile phone
has no idea what
> to do after it connected, does it?
So what I have to do is, after the mobile phone
connect to PC, the menu could be sent to the mobile
phone's "accessories" menu and then run. As you are
interested in what I've done for connecting PC to T610
and then do my work, I attached a file here. It is one
of my project's program where the phone is connected
from PC. You can see how it works with T610 (if you
have T610. Or if not, any Sony Ericsson T series phone
may be ok.) But there are notes here:
1.There are lines that are MySQL API. So, I'll send
also the SQL files and then you have to create
AVDevice database.
2.The IR part is using IRTrans transceiver (maybe you
have heard about it). But you can ignore any error
message caused by IRTrans as it doesn't affect the
operation about bluetooth.
Thank you very much for your kindness and
interest.
Michael

--- Marco Trudel <[email protected]> ???e?G
> Hello Michael
>
> finally I understand what you're trying to do. that
> explains a lot!
> I would have been confused too if somone told me
> about socket programming
> while doing what you do.
> I suggest to add a description of what you do when
> posting to a mailinglist
> the next time. That might save a lot of time :-)
>
> > Yes, of course, and the connection layer is
> rfcomm. I typed "rfcomm
> > connect 0 <address>" to connect to T610, and it
> was success.
>
> what service is on rfcomm channel 0 on the mobile
> phone? obex?
>
>
> Ok. So now you try
> 1. to connect with your mobile phone to the pc
> 2. send the menu from the pc to the mobile phone
> 3. do what already worked before...
>
> As far as I know - please correct me if someone
> knows better - a mobile
> phone doesn't provide a feature to connect to remote
> devices (at least mine
> doesn't). It wouldn't make sense, because the mobile
> phone has no idea what
> to do after it connected, does it?
> I wonder how your tutor made this. If he tells you,
> could you send this to
> the list? I'm really interested...
>
> Actually I think you now have to write/download a
> program for your mobile
> phone that connects to an obex (if you're working
> with obex) service (on
> your pc) - or ask your tutor how he did it...
> Then you can send the menu from to pc to the mobile
> phone and everything
> should be fine.
> And here now comes the sdp thing that your tutor
> mentioned. Your mobile
> phone will do a service scan on your pc (paging),
> then it should find a
> obex service that it knows it's able to connect to.
>
> Can I have your program that sent the menu from the
> pc to the mobile phone?
> I never worked with something like this but I'm be
> very interested how this
> looks/works. I don't mind that I've to connect from
> the pc to the mobile
> phone...
>
> Please inform me of any success/failures (after you
> described what you do,
> i'm really interested in it - you might already have
> noticed it).
>
>
> regards
> Marco
>
>
> Ka Kin Cheung wrote:
> > Hi Marco!
> > Thanks for you reply as I afraid that you may
> not reply my mail due
> > to my ridicious act before.
> > Regarding to your questions:
> > 1.>The connection between your mobile phone and
> your pc is over
> > bluetooth >and your pc then sends the infrared
> signals to the
> > television, is this correct?
> > Yes, correct.
> > 2.>You were able to connect from your pc to the
> mobile phone. Did you use
> > >bluetooth?
> > Yes, of course, and the connection layer is
> rfcomm. I typed "rfcomm
> > connect 0 <address>" to connect to T610, and it
> was success. Now what I
> > do is to change the approach, but still it is not
> successful.
> > 3.>Which service do you connected to (from your
> mobile phone), what's
> > it's >name?
> > The service that the PC provided for T610 is
> Object push
> > 4.>Then you sent the menu for the remote control
> from your pc to your mobile
> > >phone using at commands and got the choices you
> made on the mobile
> > >phone bacck to your pc. Your pc then sent the
> answer to the television
> > >using infrared?
> > Exactly!
> >
> > >Hope I understood this more or less correctly...
> > I'm glad that you understand much about my
> project. So I hope that you
> > can point out something about how I do for sdp so
> that I can eventually
> > let the T610 to connect to PC while my main
> program is running.
> > Thanks so much.
> > Michael
> >
> >
> >
>
------------------------------------------------------------------------
> > Yahoo! ?u???C - ???m?????u?X?????u??
> <http://hk.toolbar.yahoo.com>?I
>
>
>
-------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT
> Products from real users.
> Discover which products truly live up to the hype.
> Start reading now.
>
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Bluez-users mailing list
> [email protected]
>
https://lists.sourceforge.net/lists/listinfo/bluez-users
>

_______________________________________________________________________
Yahoo! ?u???C - ???m?????u?X?????u???I
http://toolbar.yahoo.com.hk


Attachments:
bic_michael2.c (17.18 kB)
bic_michael2.c
create_AVDevice.sql (213.00 B)
create_AVDevice.sql
insert_AVDevice.sql (1.37 kB)
insert_AVDevice.sql
Download all attachments

2005-02-19 10:06:19

by Marco Trudel

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hello Michael

finally I understand what you're trying to do. that explains a lot!
I would have been confused too if somone told me about socket programming
while doing what you do.
I suggest to add a description of what you do when posting to a mailinglist
the next time. That might save a lot of time :-)

> Yes, of course, and the connection layer is rfcomm. I typed "rfcomm
> connect 0 <address>" to connect to T610, and it was success.

what service is on rfcomm channel 0 on the mobile phone? obex?


Ok. So now you try
1. to connect with your mobile phone to the pc
2. send the menu from the pc to the mobile phone
3. do what already worked before...

As far as I know - please correct me if someone knows better - a mobile
phone doesn't provide a feature to connect to remote devices (at least mine
doesn't). It wouldn't make sense, because the mobile phone has no idea what
to do after it connected, does it?
I wonder how your tutor made this. If he tells you, could you send this to
the list? I'm really interested...

Actually I think you now have to write/download a program for your mobile
phone that connects to an obex (if you're working with obex) service (on
your pc) - or ask your tutor how he did it...
Then you can send the menu from to pc to the mobile phone and everything
should be fine.
And here now comes the sdp thing that your tutor mentioned. Your mobile
phone will do a service scan on your pc (paging), then it should find a
obex service that it knows it's able to connect to.

Can I have your program that sent the menu from the pc to the mobile phone?
I never worked with something like this but I'm be very interested how this
looks/works. I don't mind that I've to connect from the pc to the mobile
phone...

Please inform me of any success/failures (after you described what you do,
i'm really interested in it - you might already have noticed it).


regards
Marco


Ka Kin Cheung wrote:
> Hi Marco!
> Thanks for you reply as I afraid that you may not reply my mail due
> to my ridicious act before.
> Regarding to your questions:
> 1.>The connection between your mobile phone and your pc is over
> bluetooth >and your pc then sends the infrared signals to the
> television, is this correct?
> Yes, correct.
> 2.>You were able to connect from your pc to the mobile phone. Did you use
> >bluetooth?
> Yes, of course, and the connection layer is rfcomm. I typed "rfcomm
> connect 0 <address>" to connect to T610, and it was success. Now what I
> do is to change the approach, but still it is not successful.
> 3.>Which service do you connected to (from your mobile phone), what's
> it's >name?
> The service that the PC provided for T610 is Object push
> 4.>Then you sent the menu for the remote control from your pc to your mobile
> >phone using at commands and got the choices you made on the mobile
> >phone bacck to your pc. Your pc then sent the answer to the television
> >using infrared?
> Exactly!
>
> >Hope I understood this more or less correctly...
> I'm glad that you understand much about my project. So I hope that you
> can point out something about how I do for sdp so that I can eventually
> let the T610 to connect to PC while my main program is running.
> Thanks so much.
> Michael
>
>
> ------------------------------------------------------------------------
> Yahoo! ?u???C - ???m?????u?X?????u?? <http://hk.toolbar.yahoo.com>?I


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-19 08:27:09

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marco!
Thanks for you reply as I afraid that you may not reply my mail due to my ridicious act before.
Regarding to your questions:
1.>The connection between your mobile phone and your pc is over bluetooth >and your pc then sends the infrared signals to the television, is this correct?
Yes, correct.
2.>You were able to connect from your pc to the mobile phone. Did you use
>bluetooth?
Yes, of course, and the connection layer is rfcomm. I typed "rfcomm connect 0 <address>" to connect to T610, and it was success. Now what I do is to change the approach, but still it is not successful.
3.>Which service do you connected to (from your mobile phone), what's it's >name?
The service that the PC provided for T610 is Object push
4.>Then you sent the menu for the remote control from your pc to your mobile
>phone using at commands and got the choices you made on the mobile >phone bacck to your pc. Your pc then sent the answer to the television >using infrared?
Exactly!

>Hope I understood this more or less correctly...
I'm glad that you understand much about my project. So I hope that you can point out something about how I do for sdp so that I can eventually let the T610 to connect to PC while my main program is running.
Thanks so much.
Michael



---------------------------------
Yahoo! ?u???C - ???m?????u?X?????u???I

2005-02-19 06:49:45

by Marco Trudel

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hello Michael

Do I understand this right:

You have to control infrared devices like a television with your mobile
phone. The connection between your mobile phone and your pc is over
bluetooth and your pc then sends the infrared signals to the television, is
this correct?
You were able to connect from your pc to the mobile phone. Did you use
bluetooth? Which service do you connected to (from your mobile phone),
what's it's name?
Then you sent the menu for the remote control from your pc to your mobile
phone using at commands and got the choices you made on the mobile phone
bacck to your pc. Your pc then sent the answer to the television using
infrared?

Hope I understood this more or less correctly...

regards
Marco


Ka Kin Cheung wrote:
> Hi Marco!
> I think it is a need to explain the whole things
> here so that you can understand.
> My purpose of my project is to use bluetooth mobile
> devices (now are T610 and iPAQ 3970, where iPAQ is
> running on Windows CE 3.0) to act as remote control on
> IR devices (now is doing for AV devices such as TV,
> CD, VCD, DVD and VCR). The OS used is Linux, and the
> main programming language is C. At first, I connected
> PC to T610, and it successed and the remote control on
> AV devices using T610 was also successful. But my
> supervisor said that the approach should be that the
> PC act as server, so that the connection from
> bluetooth mobile device to PC is needed. Then I tried
> hard to find out how the T610 can connect to PC. Now
> T610 can search my PC and then add in the "My device"
> list. But when I looked at the "Service list", the
> "Local service cannot found" statement was shown.
> Then, my tutor said that sdp (service discovery
> protocol) is needed for T610. So, my work is now
> mainly on how to do for sdp so that the T610 can
> connect to PC. If this is successful, then the next
> thing that I have to do is to connect the iPAQ
> running on Windows CE to the PC to access my main
> program that runs on Linux.
> Regarding to your questions and comments in the
> prevoius mail:
> 1.>> My expect is to see if my phone can connect to
> mobile phone,
> >I assume you mean if your phone can connect to the
> pc.
> >How do you wanna see this? What behavior do you
> excactly expect?
> Your assumption is correct, and then after I can see
> the address of T610, what I wish to see is the menu
> can be sent throught AT command to the phone and then
> try to do the remote control using T610.
> 2.>> But unfortunately, nothing to see because I can't
> find an option >>on T610 that can connect to PC even
> though I put the PC into "My >>device" list.
>
>>As I said, you need to programm this yourself (and
>
> install it on your
>
>>mobile phone)...
>
> The main point is, as the menu for my program can
> be sent to T610 using AT command and the C main
> program on the Linux PC can get my choice from T610
> and then do the corresponding things, I wish to know
> why an extra program is needed to write and then
> install on my phone? And is there any contradiction
> with sdp?
> 3. >how should I know what he needed the sdp for?
> Actually you should >explain us what he needed the sdp
> for.
> The situation is when I connect from PC to T610,
> the "accessories" i.e. the menu that I wish to use is
> sent through AT command to the phone, and then I can
> use. When I check the "service list", I see "object
> push" in the list. But then when I change the
> connection approach that from T610 to PC, no service
> can be found in the "Service list". Then my tutor said
> the sdp is needed for T610 so that the service on the
> PC can be found and then the connection from T610 to
> PC can be done.
> By the way, my tutor is Hong Kong people, and you
> may not know him.
> 4.>>>you've to write a client program for that runs on
> the mobile >>>phone. if i remember right, the T610
> hasn't support for jsr82. I >>>don't know if you're
> able to do c programming on it and have access >>>to
> the bluetooth system. i use a nokia 6230, there you
> have mdip2.0 and jsr83. so it's no problem at all...
>
>>>Thx for suggestion.
>>
>>that wasn't a suggestion. you have to do this!
>
> But the problem is, my project can only use T610 and
> iPAq at this instant, and the language used for this
> project is C. So, is there any other alternative that
> can do the thing same as that you said before?
>
> Here are the things that I concern now:
> 1. How to do for sdp so that the mobile devices can
> connect to PC (and the main point is, this can be done
> when I run my main program)
> 2. As my iPAq is running on Windows CE and the program
> used on it will be written in Visual eMbedded C++, but
> AT command is used for T610, so how can I solve this
> "contradiction" and that the choice from my iPAQ can
> be known by my main program?
> I do hope that you can understand what I face now.
> Thank you very much.
> Michael
>
> _______________________________________________________________________
> ?s?~?@???Ĥ@?? : ?????ͽt?H
> http://personals.yahoo.com.hk
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-18 07:51:45

by Janice M. Ballesteros

[permalink] [raw]
Subject: [Bluez-users] multiple instances of OPUSH server

Halu!

How do I enable support for multiple instances of an Obex server. Im using
OPD. What Im trying to do is setup two OPD servers on my computer. Two
bluetooth dongles will be used. One of the dongles listen to rfcomm channel
10 and the other to channel 3. I want one instance of OPD to listen to rfcomm
channel 10 on /dev/rfcomm0 and the other one to channel 3 on /dev/rfcomm1.

If I run one instance of opd on channel 10, it works fine but when I try to
run the 2nd opd on channel 3 i get the error message:
opd[4561]: Failed to register BtOBEX server on RFCOMM channel 10. (-1 / 98)
It seems that everytime I run opd, its default rfcomm device is /dev/rfcomm0.
Note: error 98 stands for " Address already in use "

How do I make OPD run on a specified rfcomm device (say on /dev/rfcomm1)?
I tried looking at the code of OPD but I cant seem to find how to change the
default rfcomm device. I also tried binding my bluetooth dongles to specified
rfcomm devices and channels but it still doesnt work.

Any help/insight is greatly appreciated.
Many thanks. :)

-jan


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-18 03:33:09

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marco!
Sorry for that. there is one thing missing.
When I ran "hcidump -t -X" and then I let my phone
to update the "local service", the output is like
this:
[root@csg457-kinlok-cyc722 root]# hcidump -t -X
HCIDump - HCI packet analyzer ver 1.16
device: hci0 snap_len: 1028 filter: 0xffffffff
1108694591.032437 > HCI Event: Connect Request (0x04)
plen 10
0000: a8 d8 dd d9 0a 00 04 02 52 01
........R.
1108694591.032900 < HCI Command: Accept Connection
Request (0x01|0x0009) plen 7
0000: a8 d8 dd d9 0a 00 01
.......
1108694591.042439 > HCI Event: Command Status (0x0f)
plen 4
0000: 00 01 09 04
....
1108694591.057439 > HCI Event: Connect Complete (0x03)
plen 11
0000: 00 29 00 a8 d8 dd d9 0a 00 01 00
.).........
1108694591.058447 < HCI Command: Write Link Policy
Settings (0x02|0x000d) plen 4
0000: 29 00 0f 00
)...
1108694591.059437 > HCI Event: Page Scan Repetition
Mode Change (0x20) plen 7
0000: a8 d8 dd d9 0a 00 01
.......
1108694591.066448 > HCI Event: Command Complete (0x0e)
plen 6
0000: 01 0d 08 00 29 00
....).
1108694591.067441 < HCI Command: Change Connection
Packet Type (0x01|0x000f) ple
n 4
0000: 29 00 18 cc
)...
1108694591.075434 > HCI Event: Command Status (0x0f)
plen 4
0000: 00 01 0f 04
....
1108694591.076430 > HCI Event: Connection Packet Type
Changed (0x1d) plen 5
0000: 00 29 00 18 00
.)...
1108694591.103432 > ACL data: handle 0x0029 flags 0x02
dlen 12
L2CAP(s): Connect req: psm 1 scid 0x0040
1108694591.104425 < ACL data: handle 0x0029 flags 0x02
dlen 16
L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040
result 0 status 0
1108694591.111432 > HCI Event: Number of Completed
Packets (0x13) plen 5
0000: 01 29 00 01 00
.)...
1108694591.114443 > ACL data: handle 0x0029 flags 0x02
dlen 16
L2CAP(s): Config req: dcid 0x0040 flags 0x0000
clen 4
MTU 251
1108694591.119481 < ACL data: handle 0x0029 flags 0x02
dlen 14
L2CAP(s): Config rsp: scid 0x0040 flags 0x0000
result 0 clen 0
1108694591.119502 < ACL data: handle 0x0029 flags 0x02
dlen 12
L2CAP(s): Config req: dcid 0x0040 flags 0x0000
clen 0
1108694591.125426 > HCI Event: Number of Completed
Packets (0x13) plen 5
0000: 01 29 00 01 00
.)...
1108694591.127424 > HCI Event: Number of Completed
Packets (0x13) plen 5
0000: 01 29 00 01 00
.)...
1108694591.130429 > ACL data: handle 0x0029 flags 0x02
dlen 14
L2CAP(s): Config rsp: scid 0x0040 flags 0x0000
result 0 clen 0
1108694591.135434 > ACL data: handle 0x0029 flags 0x02
dlen 17
1108694591.137449 > ACL data: handle 0x0029 flags 0x01
dlen 17
L2CAP(d): cid 0x0040 len 30 [psm 1]
SDP SSA Req: tid 0x0 len 0x19
pat uuid-16 0x1108 (Headset)
max 65535
aid(s) 0x0001 (SrvClassIDList) 0x0004
(ProtocolDescList) 0x0009 (BTPro
fileDescList) 0x0100 (SrvName) 0x0302 (unknown)
cont 00
1108694591.138414 < ACL data: handle 0x0029 flags 0x02
dlen 14
L2CAP(d): cid 0x0040 len 10 [psm 1]
SDP SSA Rsp: tid 0x0 len 0x5
count 2
cont 00
1108694591.144450 > HCI Event: Number of Completed
Packets (0x13) plen 5
0000: 01 29 00 01 00
.)...
1108694591.153430 > ACL data: handle 0x0029 flags 0x02
dlen 17
1108694591.155429 > ACL data: handle 0x0029 flags 0x01
dlen 17
L2CAP(d): cid 0x0040 len 30 [psm 1]
SDP SSA Req: tid 0x0 len 0x19
pat uuid-16 0x111e (Handsfree)
max 65535
aid(s) 0x0001 (SrvClassIDList) 0x0004
(ProtocolDescList) 0x0009 (BTPro
fileDescList) 0x0100 (SrvName) 0x0311 (unknown)
cont 00
1108694591.156030 < ACL data: handle 0x0029 flags 0x02
dlen 14
L2CAP(d): cid 0x0040 len 10 [psm 1]
SDP SSA Rsp: tid 0x0 len 0x5
count 2
cont 00
1108694591.164449 > HCI Event: Number of Completed
Packets (0x13) plen 5
0000: 01 29 00 01 00
.)...
1108694591.173426 > ACL data: handle 0x0029 flags 0x02
dlen 17
1108694591.176423 > ACL data: handle 0x0029 flags 0x01
dlen 14
L2CAP(d): cid 0x0040 len 27 [psm 1]
SDP SSA Req: tid 0x0 len 0x16
pat uuid-16 0x1107 (IRMCSyncCmd)
max 65535
aid(s) 0x0001 (SrvClassIDList) 0x0004
(ProtocolDescList) 0x0009 (BTPro
fileDescList) 0x0100 (SrvName)
cont 00
1108694591.176892 < ACL data: handle 0x0029 flags 0x02
dlen 14
L2CAP(d): cid 0x0040 len 10 [psm 1]
SDP SSA Rsp: tid 0x0 len 0x5
count 2
cont 00
1108694591.184438 > HCI Event: Number of Completed
Packets (0x13) plen 5
0000: 01 29 00 01 00
.)...
1108694591.193441 > ACL data: handle 0x0029 flags 0x02
dlen 17
1108694591.195438 > ACL data: handle 0x0029 flags 0x01
dlen 17
L2CAP(d): cid 0x0040 len 30 [psm 1]
SDP SSA Req: tid 0x0 len 0x19
pat uuid-16 0x1105 (OBEXObjPush)
max 65535
aid(s) 0x0001 (SrvClassIDList) 0x0004
(ProtocolDescList) 0x0009 (BTPro
fileDescList) 0x0100 (SrvName) 0x0303
(SuppFormatsList)
cont 00
1108694591.196315 < ACL data: handle 0x0029 flags 0x02
dlen 14
L2CAP(d): cid 0x0040 len 10 [psm 1]
SDP SSA Rsp: tid 0x0 len 0x5
count 2
cont 00
1108694591.203415 > HCI Event: Number of Completed
Packets (0x13) plen 5
0000: 01 29 00 01 00
.)...
1108694591.212423 > ACL data: handle 0x0029 flags 0x02
dlen 17
1108694591.214446 > ACL data: handle 0x0029 flags 0x01
dlen 14
L2CAP(d): cid 0x0040 len 27 [psm 1]
SDP SSA Req: tid 0x0 len 0x16
pat uuid-16 0x1106 (OBEXObjTrnsf)
max 65535
aid(s) 0x0001 (SrvClassIDList) 0x0004
(ProtocolDescList) 0x0009 (BTPro
fileDescList) 0x0100 (SrvName)
cont 00
1108694591.215070 < ACL data: handle 0x0029 flags 0x02
dlen 14
L2CAP(d): cid 0x0040 len 10 [psm 1]
SDP SSA Rsp: tid 0x0 len 0x5
count 2
cont 00
1108694591.222411 > HCI Event: Number of Completed
Packets (0x13) plen 5
0000: 01 29 00 01 00
.)...
1108694591.231413 > ACL data: handle 0x0029 flags 0x02
dlen 12
L2CAP(s): Disconn req: dcid 0x0040 scid 0x0040
1108694591.231500 < ACL data: handle 0x0029 flags 0x02
dlen 12
L2CAP(s): Disconn rsp: dcid 0x0040 scid 0x0040
1108694591.239408 > HCI Event: Number of Completed
Packets (0x13) plen 5
0000: 01 29 00 01 00
.)...
1108694591.329386 > HCI Event: Disconn Complete (0x05)
plen 4
0000: 00 29 00 13
.)..
What does it mean? And is there any error? If so,
how can I do?
Thanks a lot!
Michael

_______________________________________________________________________
?s?~?@???Ĥ@?? : ?????ͽt?H
http://personals.yahoo.com.hk


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-18 03:28:30

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marco!
I think it is a need to explain the whole things
here so that you can understand.
My purpose of my project is to use bluetooth mobile
devices (now are T610 and iPAQ 3970, where iPAQ is
running on Windows CE 3.0) to act as remote control on
IR devices (now is doing for AV devices such as TV,
CD, VCD, DVD and VCR). The OS used is Linux, and the
main programming language is C. At first, I connected
PC to T610, and it successed and the remote control on
AV devices using T610 was also successful. But my
supervisor said that the approach should be that the
PC act as server, so that the connection from
bluetooth mobile device to PC is needed. Then I tried
hard to find out how the T610 can connect to PC. Now
T610 can search my PC and then add in the "My device"
list. But when I looked at the "Service list", the
"Local service cannot found" statement was shown.
Then, my tutor said that sdp (service discovery
protocol) is needed for T610. So, my work is now
mainly on how to do for sdp so that the T610 can
connect to PC. If this is successful, then the next
thing that I have to do is to connect the iPAQ
running on Windows CE to the PC to access my main
program that runs on Linux.
Regarding to your questions and comments in the
prevoius mail:
1.>> My expect is to see if my phone can connect to
mobile phone,
>I assume you mean if your phone can connect to the
pc.
>How do you wanna see this? What behavior do you
excactly expect?
Your assumption is correct, and then after I can see
the address of T610, what I wish to see is the menu
can be sent throught AT command to the phone and then
try to do the remote control using T610.
2.>> But unfortunately, nothing to see because I can't
find an option >>on T610 that can connect to PC even
though I put the PC into "My >>device" list.
>As I said, you need to programm this yourself (and
install it on your
>mobile phone)...
The main point is, as the menu for my program can
be sent to T610 using AT command and the C main
program on the Linux PC can get my choice from T610
and then do the corresponding things, I wish to know
why an extra program is needed to write and then
install on my phone? And is there any contradiction
with sdp?
3. >how should I know what he needed the sdp for?
Actually you should >explain us what he needed the sdp
for.
The situation is when I connect from PC to T610,
the "accessories" i.e. the menu that I wish to use is
sent through AT command to the phone, and then I can
use. When I check the "service list", I see "object
push" in the list. But then when I change the
connection approach that from T610 to PC, no service
can be found in the "Service list". Then my tutor said
the sdp is needed for T610 so that the service on the
PC can be found and then the connection from T610 to
PC can be done.
By the way, my tutor is Hong Kong people, and you
may not know him.
4.>>>you've to write a client program for that runs on
the mobile >>>phone. if i remember right, the T610
hasn't support for jsr82. I >>>don't know if you're
able to do c programming on it and have access >>>to
the bluetooth system. i use a nokia 6230, there you
have mdip2.0 and jsr83. so it's no problem at all...
>>Thx for suggestion.
>that wasn't a suggestion. you have to do this!
But the problem is, my project can only use T610 and
iPAq at this instant, and the language used for this
project is C. So, is there any other alternative that
can do the thing same as that you said before?

Here are the things that I concern now:
1. How to do for sdp so that the mobile devices can
connect to PC (and the main point is, this can be done
when I run my main program)
2. As my iPAq is running on Windows CE and the program
used on it will be written in Visual eMbedded C++, but
AT command is used for T610, so how can I solve this
"contradiction" and that the choice from my iPAQ can
be known by my main program?
I do hope that you can understand what I face now.
Thank you very much.
Michael

_______________________________________________________________________
?s?~?@???Ĥ@?? : ?????ͽt?H
http://personals.yahoo.com.hk


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-17 17:04:06

by Marco Trudel

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Ka Kin Cheung wrote:
> Hi Marco!
>
> >question: what do you expect? my pc usually starts a britney spears
> mp3 >and
> >makes a couple of somersaults...
> >no, serious: what do you expect??? nothing will happen after that because
> >the pc waits for a client connection.
> My expect is to see if my phone can connect to mobile phone,

I assume you mean if your phone can connect to the pc.
How do you wanna see this? What behavior do you excactly expect?

> address can
> be seen by putting the address on the screen. (Of course, it will be
> done by myself).

I don't know what you mean with this...
I assume you mean to printf() the address after a client connected...

> But unfortunately, nothing to see because I can't find
> an option on T610 that can connect to PC even though I put the PC into
> "My device" list.

As I said, you need to programm this yourself (and install it on your
mobile phone)...

> I've borrowed books for socket programming, don't worry about this.

good. then read it before you continue.
programm a little server and a little client that just exchange a little
message. If you've understood that, you should understand what you try to
do with bluez (because your pc is the server, your mobile phone the client).

> But
> I don't understand why sdp programming is not needed, instead of the
> word said by my tutor.

Can you please explain what you're doing?
I don't know who your tutor is, what he made or what he makes... So, how
should I know what he needed the sdp for?
Actually you should explain us what he needed the sdp for. You're supposed
to understand what you're doing and what you need (do you?)...

> >you've to write a client program for that runs on the mobile phone.
> >if i remember right, the T610 hasn't support for jsr82. I don't know if
> >you're able to do c programming on it and have access to the bluetooth
> >system.
> >i use a nokia 6230, there you have mdip2.0 and jsr83. so it's no
> problem at
> >all...
> Thx for suggestion.

that wasn't a suggestion. you have to do this!


regards
Marco


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-17 14:43:31

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marco!

>question: what do you expect? my pc usually starts a britney spears mp3 >and
>makes a couple of somersaults...
>no, serious: what do you expect??? nothing will happen after that because
>the pc waits for a client connection.
My expect is to see if my phone can connect to mobile phone, address can be seen by putting the address on the screen. (Of course, it will be done by myself). But unfortunately, nothing to see because I can't find an option on T610 that can connect to PC even though I put the PC into "My device" list.

I've borrowed books for socket programming, don't worry about this. But I don't understand why sdp programming is not needed, instead of the word said by my tutor.

>you've to write a client program for that runs on the mobile phone.
>if i remember right, the T610 hasn't support for jsr82. I don't know if
>you're able to do c programming on it and have access to the bluetooth >system.
>i use a nokia 6230, there you have mdip2.0 and jsr83. so it's no problem at
>all...
Thx for suggestion.
Michael




---------------------------------
?s?~?@???Ĥ@?? : ?????ͽt?H

2005-02-17 14:10:41

by Marco Trudel

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Ka Kin Cheung wrote:
> Hi Marco!
> I've put some functions you posted before into my main program. As I
> wish to write the program to act as server, I wrote like this:
> int main (int argc, char **argv)
> {
> //variable declaration...
> addr.rc_family = AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, BDADDR_ANY);
> addr.rc_channel = 4;
> alen = sizeof(addr);
> //mysql initialization....
> while (1)
> {
> // request a socket from the operating system
> if((sock = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0)
> {
> printf("socket(...) failed");
> exit(1);
> }
> // bind the socket to the system
> if(bind(sock, (struct sockaddr *)&addr, alen) < 0)
> {
> printf("bind(...) failed\n");
> exit(2);
> }
> // set the socket into listen mode. handle 10 (QUEUE) connections.
> if(listen(sock, 10) < 0)
> {
> printf("listen(...) failed\n");
> exit(3);
> }
> while(client = accept(sock, (struct sockaddr *)&addr, &alen))
> {
> char remoteAddr[18];
> ba2str(&addr.rc_bdaddr, remoteAddr);
> printf("connection from %s:\n", remoteAddr);
> // send a "hello from server" to client
> char out[] = "hello from server";
> send(client, out, strlen(out), 0);
> printf("> %s\n", out);
> // read the answer
> char buffer[101]; // buffer size 100, 1 for '\0'
> int noReadChars = recv(client, buffer, sizeof(buffer)-1, 0);
> buffer[noReadChars] = '\0'; // here the received answer ends
> printf("< %s\n", buffer);
> while (1)
> {
> .......
>
> After I ran it, the sock, bind and listen functions were all passed. But
> after that, I couldn't see any result about it.

question: what do you expect? my pc usually starts a britney spears mp3 and
makes a couple of somersaults...
no, serious: what do you expect??? nothing will happen after that because
the pc waits for a client connection.

please - really - read a couple of tutorials about socket programming and
try to understand what the codes does that you write.
as already was said: this list is not here to explain you how socket
programming works...

> Then I wish to fiind out
> how to connect SE T610 to bluez in my PC, but I couldn't find the
> method.

you've to write a client program for that runs on the mobile phone.
if i remember right, the T610 hasn't support for jsr82. I don't know if
you're able to do c programming on it and have access to the bluetooth system.
i use a nokia 6230, there you have mdip2.0 and jsr83. so it's no problem at
all...

regards
Marco


> And the strange thing is that the phone could search my PC and
> then added it on the "My device" list, I was wondering why couldn't the
> phone initialize the connection to PC. I'm very surprising that Jay
> Summet said that T610 cannot connect to bluez in Linux PC. So I wish Jay
> also to explain why, and does it mean that there is no method that T610
> can really initialize the connection to PC?
> By the way, after I looked at the specification of the bluetooth system,
> I could not find any way to write sdp program. So, can you and other
> mail users suggest a method for me to do? I really thank you very much
> for your kindness.
> Michael
>
> */Marco Trudel <[email protected]>/* wrote:
>
> Ka Kin Cheung wrote:
> > Hi all!
> > I'm still doing my project. Now I face a problem
> > that the T610 still cannot connect to PC. Then my
> > tutor said that I have to write a sdp program to let
> > the phone to connect to PC.
>
> this has nothing to do with it. i think you tutor is wrong...
> if your pc is listening on a rfcomm channel, then you can connect with a
> url like btspp://0123456789AB:4
> the first part is the protocol, the second the mac address, the last one
> the channel number.
> have you tried/understood my last post to you:
> http://sourceforge.net/mailarchive/message.php?msg_id=10756581
>
> you need a sdp-entry only if the mobile phone wants to do a service
> search
> (paging) what's not needed. a inquiry could get you the mac address
> and you
> then can connect to the listening port in your program.
>
> if it still doesn' t work, please send a description of what you
> exactly do
> and what the exact results are. please use hcidump as well...
>
> regards
> Marco
>
>
> > I wish to know that is
> > there any guideline or even the source code for sdp
> > programming? It is urgent as my tutor said he used two
> > months to do it before.
> > Thank you very much for your kindness.
> > Michael
> >
> >
> >
> _______________________________________________________________________
> > ?s?~?@???Ĥ@?? : ?????ͽt?H
> > http://personals.yahoo.com.hk
> >
> >
> > -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT Products from real
> users.
> > Discover which products truly live up to the hype. Start reading now.
> > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > _______________________________________________
> > Bluez-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/bluez-users
> >
> >
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>
> ------------------------------------------------------------------------
> ?s?~?@???Ĥ@?? : ?????ͽt?H <http://hk.personals.yahoo.com>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-17 13:54:55

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marco!
I've put some functions you posted before into my main program. As I wish to write the program to act as server, I wrote like this:
int main (int argc, char **argv)
{
//variable declaration...
addr.rc_family = AF_BLUETOOTH;
bacpy(&addr.rc_bdaddr, BDADDR_ANY);
addr.rc_channel = 4;
alen = sizeof(addr);
//mysql initialization....
while (1)
{
// request a socket from the operating system
if((sock = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0)
{
printf("socket(...) failed");
exit(1);
}
// bind the socket to the system
if(bind(sock, (struct sockaddr *)&addr, alen) < 0)
{
printf("bind(...) failed\n");
exit(2);
}
// set the socket into listen mode. handle 10 (QUEUE) connections.
if(listen(sock, 10) < 0)
{
printf("listen(...) failed\n");
exit(3);
}
while(client = accept(sock, (struct sockaddr *)&addr, &alen))
{
char remoteAddr[18];
ba2str(&addr.rc_bdaddr, remoteAddr);
printf("connection from %s:\n", remoteAddr);
// send a "hello from server" to client
char out[] = "hello from server";
send(client, out, strlen(out), 0);
printf("> %s\n", out);
// read the answer
char buffer[101]; // buffer size 100, 1 for '\0'
int noReadChars = recv(client, buffer, sizeof(buffer)-1, 0);
buffer[noReadChars] = '\0'; // here the received answer ends
printf("< %s\n", buffer);
while (1)
{
.......

After I ran it, the sock, bind and listen functions were all passed. But after that, I couldn't see any result about it. Then I wish to fiind out how to connect SE T610 to bluez in my PC, but I couldn't find the method. And the strange thing is that the phone could search my PC and then added it on the "My device" list, I was wondering why couldn't the phone initialize the connection to PC. I'm very surprising that Jay Summet said that T610 cannot connect to bluez in Linux PC. So I wish Jay also to explain why, and does it mean that there is no method that T610 can really initialize the connection to PC?
By the way, after I looked at the specification of the bluetooth system, I could not find any way to write sdp program. So, can you and other mail users suggest a method for me to do? I really thank you very much for your kindness.
Michael

Marco Trudel <[email protected]> wrote:
Ka Kin Cheung wrote:
> Hi all!
> I'm still doing my project. Now I face a problem
> that the T610 still cannot connect to PC. Then my
> tutor said that I have to write a sdp program to let
> the phone to connect to PC.

this has nothing to do with it. i think you tutor is wrong...
if your pc is listening on a rfcomm channel, then you can connect with a
url like btspp://0123456789AB:4
the first part is the protocol, the second the mac address, the last one
the channel number.
have you tried/understood my last post to you:
http://sourceforge.net/mailarchive/message.php?msg_id=10756581

you need a sdp-entry only if the mobile phone wants to do a service search
(paging) what's not needed. a inquiry could get you the mac address and you
then can connect to the listening port in your program.

if it still doesn't work, please send a description of what you exactly do
and what the exact results are. please use hcidump as well...

regards
Marco


> I wish to know that is
> there any guideline or even the source code for sdp
> programming? It is urgent as my tutor said he used two
> months to do it before.
> Thank you very much for your kindness.
> Michael
>
>
> _______________________________________________________________________
> ?s?~?@???Ĥ@?? : ?????ͽt?H
> http://personals.yahoo.com.hk
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users



---------------------------------
?s?~?@???Ĥ@?? : ?????ͽt?H

2005-02-17 13:14:37

by Marco Trudel

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Please check out the post from Jay Summet as well:
http://sourceforge.net/mailarchive/forum.php?thread_id=6573020&forum_id=1883

it might help...

regards
Marco


Ka Kin Cheung wrote:
> Hi all!
> I'm still doing my project. Now I face a problem
> that the T610 still cannot connect to PC. Then my
> tutor said that I have to write a sdp program to let
> the phone to connect to PC. I wish to know that is
> there any guideline or even the source code for sdp
> programming? It is urgent as my tutor said he used two
> months to do it before.
> Thank you very much for your kindness.
> Michael
>
>
> _______________________________________________________________________
> ?s?~?@???Ĥ@?? : ?????ͽt?H
> http://personals.yahoo.com.hk
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-17 13:08:44

by Marco Trudel

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Ka Kin Cheung wrote:
> Hi all!
> I'm still doing my project. Now I face a problem
> that the T610 still cannot connect to PC. Then my
> tutor said that I have to write a sdp program to let
> the phone to connect to PC.

this has nothing to do with it. i think you tutor is wrong...
if your pc is listening on a rfcomm channel, then you can connect with a
url like btspp://0123456789AB:4
the first part is the protocol, the second the mac address, the last one
the channel number.
have you tried/understood my last post to you:
http://sourceforge.net/mailarchive/message.php?msg_id=10756581

you need a sdp-entry only if the mobile phone wants to do a service search
(paging) what's not needed. a inquiry could get you the mac address and you
then can connect to the listening port in your program.

if it still doesn't work, please send a description of what you exactly do
and what the exact results are. please use hcidump as well...

regards
Marco


> I wish to know that is
> there any guideline or even the source code for sdp
> programming? It is urgent as my tutor said he used two
> months to do it before.
> Thank you very much for your kindness.
> Michael
>
>
> _______________________________________________________________________
> ?s?~?@???Ĥ@?? : ?????ͽt?H
> http://personals.yahoo.com.hk
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-17 09:08:12

by mike lee

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Dear Cheung

Please take a look on bluez-util/tools/sdptool.c. It should help a lot.

best regard
Mike,Lee


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-17 06:28:00

by Alain Volmat

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Michael,

> I wish to know that is there any guideline or even the
> source code for sdp programming?

looking at the source of sdptool might help.

Sincerely,

Alain


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-17 05:37:15

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi all!
I'm still doing my project. Now I face a problem
that the T610 still cannot connect to PC. Then my
tutor said that I have to write a sdp program to let
the phone to connect to PC. I wish to know that is
there any guideline or even the source code for sdp
programming? It is urgent as my tutor said he used two
months to do it before.
Thank you very much for your kindness.
Michael


_______________________________________________________________________
?s?~?@???Ĥ@?? : ?????ͽt?H
http://personals.yahoo.com.hk


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-05 18:08:31

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marco,

> thanks a lot for your comments and hints on my code.

you are welcome.

> unfortunately we only had 1 module about c/c++ programming in the
> university and I'm programming java for over 3 years.
> Luckily, in comunication-technology, we've a subtopic about c
> socket-programming in two weeks, this will be very helpfull.
>
> Actually my project is in c++. Because of that I started already with the
> c++ usage of comments and variable declarations. For c I usually use the
> --ansii flag to ensure gcc backward compatibility.

Actually all my suggestions are based on my work inside the Linux
kernel. If you are at that point you see code a little bit different,
because you must deal with different things. People underestimate the
coding style and I think it is one of the important things to keep this
clean and to help and allow newbies to understand the code. And this is
another important thing, because if you don't understand the code you
end up copying stuff from one project to another. This does not increase
code quality and I have seen enough projects where something works, but
nobody knows why.

> I'll definitely check out the rctest.c example

The test programs still need some cleanups, because there are too many
global variables in that code.

> Regarding your price/hour: Do you know how many money you would earn if you
> got paid for your email support in this list? Amazing! :-)

I don't know, but actually that is not so important. A project will only
make progress if the mailing list is activly maintained. If people don't
care about the problems of others, the project is already dead.

However feel free to make a donation if you like ;)

http://www.bluez.org/sponsors.html

> It's always a pleasure if someone answers emails in mailinglists that fast
> and precise as you do (The last one i've "met" spending so much time for a
> mailinglist was Mattia Barbon in the wxPerl list.).

Thanks

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-05 17:39:04

by Marco Trudel

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hello Marcel

thanks a lot for your comments and hints on my code.

unfortunately we only had 1 module about c/c++ programming in the
university and I'm programming java for over 3 years.
Luckily, in comunication-technology, we've a subtopic about c
socket-programming in two weeks, this will be very helpfull.

Actually my project is in c++. Because of that I started already with the
c++ usage of comments and variable declarations. For c I usually use the
--ansii flag to ensure gcc backward compatibility.

I'll definitely check out the rctest.c example


Regarding your price/hour: Do you know how many money you would earn if you
got paid for your email support in this list? Amazing! :-)
It's always a pleasure if someone answers emails in mailinglists that fast
and precise as you do (The last one i've "met" spending so much time for a
mailinglist was Mattia Barbon in the wxPerl list.).

regards
Marco


Marcel Holtmann wrote:
> Hi Marco,
>
>
>>Thanks a lot. I hoped someone more c experienced will take a quick look at
>>my code. It's the result of a example I found (the mistake comes from
>>there) and a socket programming howto I read.
>>
>>I now changed it to
>>addr.rc_channel = 4;
>>
>>Actually I do not need to #define it for the whole file.
>
>
> the code is fine so far. However the best example is still in rctest.c
> besides that it uses fork() and this is sometimes hard to understand by
> beginners. I cleaned the rctest.c stuff lately and removed some cruft
> things.
>
> In your code I would only criticize the coding style and the naming of
> the variables.
>
> Coding style:
> - Use /* */ for comments
> - if(bind...) ==> if (bind...) {
> - (struct sockaddr *)&addr ==> (struct sockaddr *) &addr
>
> Variable names:
> - sock ==> sk
> - client ==> nsk (stands for new socket)
> - noReadChars ==> len or num (this is not C++ or Java)
>
> When you do accept() you should do the "alen = sizeof(addr);" again,
> because the value of alen could be overwritten. And a memset() of the
> addr variable before filling it with values is a good idea. It can
> happens that the size between the kernel and the userspace differs and
> so you make sure that it is filled with zeros.
>
> And don't declare new variables inside the code. Do it at the top of a
> function or a the top of a block. Old compilers like GCC 2.95 don't like
> this and remember this is not Java.
>
> Regards
>
> Marcel
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-05 14:14:52

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marco,

> Thanks a lot. I hoped someone more c experienced will take a quick look at
> my code. It's the result of a example I found (the mistake comes from
> there) and a socket programming howto I read.
>
> I now changed it to
> addr.rc_channel = 4;
>
> Actually I do not need to #define it for the whole file.

the code is fine so far. However the best example is still in rctest.c
besides that it uses fork() and this is sometimes hard to understand by
beginners. I cleaned the rctest.c stuff lately and removed some cruft
things.

In your code I would only criticize the coding style and the naming of
the variables.

Coding style:
- Use /* */ for comments
- if(bind...) ==> if (bind...) {
- (struct sockaddr *)&addr ==> (struct sockaddr *) &addr

Variable names:
- sock ==> sk
- client ==> nsk (stands for new socket)
- noReadChars ==> len or num (this is not C++ or Java)

When you do accept() you should do the "alen = sizeof(addr);" again,
because the value of alen could be overwritten. And a memset() of the
addr variable before filling it with values is a good idea. It can
happens that the size between the kernel and the userspace differs and
so you make sure that it is filled with zeros.

And don't declare new variables inside the code. Do it at the top of a
function or a the top of a block. Old compilers like GCC 2.95 don't like
this and remember this is not Java.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-05 14:00:59

by Marco Trudel

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hello Marcel

Thanks a lot. I hoped someone more c experienced will take a quick look at
my code. It's the result of a example I found (the mistake comes from
there) and a socket programming howto I read.

I now changed it to
addr.rc_channel = 4;

Actually I do not need to #define it for the whole file.

regards
Marco


Marcel Holtmann wrote:
> Hi Marco,
>
>
>>Maybe this helps:
>>
>>---- start code snippet ----
>>// handle the includes yourself
>>
>>#define CHANNEL 4
>>#define QUEUE 10
>>
>>int main()
>>{
>> int sock, client;
>> socklen_t alen;
>> struct sockaddr_rc addr;
>>
>> addr.rc_family = AF_BLUETOOTH;
>> bacpy(&addr.rc_bdaddr, BDADDR_ANY);
>> addr.rc_channel = htobs(CHANNEL);
>
>
> thanks for the example, but the htobs(CHANNEL) is wrong. rc_channel is
> only uint8_t and when you do byteswap on a big endian machine this will
> end up in channel 0.
>
> Regards
>
> Marcel
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-05 13:51:31

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marco,

> Maybe this helps:
>
> ---- start code snippet ----
> // handle the includes yourself
>
> #define CHANNEL 4
> #define QUEUE 10
>
> int main()
> {
> int sock, client;
> socklen_t alen;
> struct sockaddr_rc addr;
>
> addr.rc_family = AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, BDADDR_ANY);
> addr.rc_channel = htobs(CHANNEL);

thanks for the example, but the htobs(CHANNEL) is wrong. rc_channel is
only uint8_t and when you do byteswap on a big endian machine this will
end up in channel 0.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-05 13:17:49

by Marco Trudel

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hello Michael

Maybe this helps:

---- start code snippet ----
// handle the includes yourself

#define CHANNEL 4
#define QUEUE 10

int main()
{
int sock, client;
socklen_t alen;
struct sockaddr_rc addr;

addr.rc_family = AF_BLUETOOTH;
bacpy(&addr.rc_bdaddr, BDADDR_ANY);
addr.rc_channel = htobs(CHANNEL);
alen = sizeof(addr);

// request a socket from the operating system
if((sock = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0)
{
printf("socket(...) failed");
exit(1);
}

// bind the socket to the system
if(bind(sock, (struct sockaddr *)&addr, alen) < 0)
{
printf("bind(...) failed\n");
exit(2);
}

// set the socket into listen mode. handle 10 (QUEUE) connections.
if(listen(sock, QUEUE) < 0)
{
printf("listen(...) failed\n");
exit(3);
}

// wait for the next connection or serve the next in the queue
while(client = accept(sock, (struct sockaddr *)&addr, &alen))
{
char remoteAddr[18];
ba2str(&addr.rc_bdaddr, remoteAddr);
printf("connection from %s:\n", remoteAddr);

// send a "hello from server" to client
char out[] = "hello from server";
send(client, out, strlen(out), 0);
printf("> %s\n", out);

// read the answer
char buffer[101]; // buffer size 100, 1 for '\0'
int noReadChars = recv(client, buffer, sizeof(buffer)-1, 0);
buffer[noReadChars] = '\0'; // here the received answer ends
printf("< %s\n", buffer);

// now close the connection
close(client);
}

close(sock);
return 0;
}
---- code snippet end ----

If you start this sample the machine listens on rfcomm channel 4 for
incoming connections. you can now connect with a mobile phone.

If you now search for "c socket programming" on google, you'll be able to
fully understand this code snippet and be able to change it to do what you
want.


regards
Marco


Ka Kin Cheung wrote:
> Hi all users!
> Sorry, but I have to say that I have knowledge about C, but I don't
> have so much knowledge about socket programming. And I would like to
> point out that what I find hard is just to let my main program to listen
> to what bluetooth mobile device wishes to connect to PC, and then let
> the program run even though no bluetooth device is connecting with the
> PC i.e. let PC to be server. Anyway, thank you very much for all of your
> advices. Sorry for any misunderstanding.
> By the way, C is the main programming language of my project, so it
> is not possible for me to use one language more. But I thank Marco for
> advice.
> And I wish to ask question here. I've heard that rfcom_bind can do
> something similar those things do in rctest.c, but until now, I can't
> find any detail about rfcomm_bind, even in this mail-list or in web. So,
> if anyone knows, please kindly inform me here and I'll use it once I
> understand what it does. Sorry for impolite reply but I am eager to
> learn more about this. Thank you very much!
> Michael
> *//*
>
> Hello Ka Kin Cheung
>
> It looks like you haven't that much c or socket programming
> knowledge. So
> if you try to learn c, socket programming, compiling, bluetooth
> programming
> and all relatet topics in one step, that's pretty hard.
>
> What about Java? JSR 82?
> It's fully documentated and you find a lot of samples if you ask
> google...
>
> Take a look at this:
> http://sourceforge.net/projects/avetanabt/
> (It is available for windows as well.)
>
> And a good general programming rule (specially for c/c++):
> Do not use gcc if you haven't already understand what your code's
> supposed
> to do.
>
>
> regards
> Marco
>
>
> Ka Kin Cheung wrote:
> > Hi all,
> > I've added -lbluetooth in the command, and it successes. But when I
> > run the program, the program terminates and doesn't wait for any
> mobile
> > terminal involving into the program. What is the problem about my
> > program? And need I really link the header files in
> bluez-libs/include?
> > If so, should I include like this "bluez-libs-2.14/include/xx.h"?
> But
> > the /usr/include contains the files. So I wish to know why if it
> is so.
> > Here is the syntax of my program.
> > int main (int argc, char **argv)
> > {
> > ...
> > int no_connection;
> > ...
> > printf("\E[H\E[J");
> > printf ("Bluetooth infrared converter\n\n");
> > printf ("Doing initializations !\n");
> > no_connection=0;
> > do_listen(recv_mode);
> > ...
> > while (1)
> > {
> > no_connection++;
> > printf("Now %d mobile terminal(s) is(are) using this program\n");
> > sprintf (command, "at+cscs=i\"8859-1\"\r");
> > ret_code = put_command (command, answer, sizeof (answer), 5, 0);
> > sprintf (command, "AT*EAM=\"Bt-IrConverter\"\r");
> > ret_code = put_command (command, answer, sizeof (answer), 5, 0);
> > submenu_selected = 0;
> > while (!submenu_selected)
> > {
> > ....
> > Thanks very much.
> > Michael
> >
> > */Alain Volmat /* wrote:
> >
> > Hi Michael,
> >
> > ba2str is a function provided by bluez-libs. Linking your
> > program against the bluez-lib might solve your problem.
> >
> > add -lbluetooth to your command line.
> >
> > Alain
> >
> > * Ka Kin Cheung [Thu, 3 Feb 2005 at 18:50 +0800]
> >
> > > Hi all users!
> > > I first give a thank to Alain Volmat that points
> > > out my fault and confusion about rctest.c. Then I put
> > > the parts do_listen and recv_mode in my main porgram.
> > > But when I compile, strange things occur.....
> > > As my program is MySQL C API, I have to compile
> > > with "gcc -c -I/usr/include/mysql XX.c", and it is no
> > > problem. But when I type "gcc -o XX XX.o
> & gt; > -L/usr/lib/mysql -lmysqlclient", following occurs:
> > > bic_midterm.o(.text+0x1c0a): In function `do_listen':
> > > : undefined reference to `ba2str'
> > > collect2: ld returned 1 exit status
> > > I checked with rctest.c, but there is not a function
> > > for ba2str. On the other hand, tv2fl can be accepted
> > > as there is a function in rctest.c. Here are the
> > > include files in my main program.
> > > #ifdef HAVE_CONFIG_H
> > > #include
> > > #endif
> > >
> > >
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > >
> > >
> > > #include
> > > include
> > > #include
> > > ; #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > >
> > > #include
> > >
> > >
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > > #include
> > >
> > >
> > > #include
> > > Let's see if there is any function that is missing. If
> > > there is no function missing, where can I find the
> > > ba2str function? I believe that if ba2str function can
> > > be found declared, the program can be run. Thank you
> > > very much for your kindness.
> > > Michael
> > >
> > >
> >
> _______________________________________________________________________
> > > ?s?~?@???Ĥ@?? : ?????ͽt?H
> > > http://personals.yahoo.com.hk
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by: IntelliVIEW -- Interactive
> > Reporting
> > > Tool for open source databases. Create drag-&-drop reports.
> Save time
> > > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF,
> > etc.
> > > Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> > > _______________________________________________
> > > Bluez-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/bluez-users
> > >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: IntelliVIEW -- Interactive
> Reporting
> > Tool for open source databases. Create drag-&-drop reports. Save time
> > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF,
> etc.
> > Download a FREE c opy at http://www.intelliview.com/go/osdn_nl
> > _______________________________________________
> > Bluez-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/bluez-users
> >
> >
> >
> ------------------------------------------------------------------------
> > ?s?~?@???Ĥ@?? : ?????ͽt?H
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>
> ------------------------------------------------------------------------
> ?s?~?@???Ĥ@?? : ?????ͽt?H <http://hk.personals.yahoo.com>


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-05 12:48:28

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi all users!
Sorry, but I have to say that I have knowledge about C, but I don't have so much knowledge about socket programming. And I would like to point out that what I find hard is just to let my main program to listen to what bluetooth mobile device wishes to connect to PC, and then let the program run even though no bluetooth device is connecting with the PC i.e. let PC to be server. Anyway, thank you very much for all of your advices. Sorry for any misunderstanding.
By the way, C is the main programming language of my project, so it is not possible for me to use one language more. But I thank Marco for advice.
And I wish to ask question here. I've heard that rfcom_bind can do something similar those things do in rctest.c, but until now, I can't find any detail about rfcomm_bind, even in this mail-list or in web. So, if anyone knows, please kindly inform me here and I'll use it once I understand what it does. Sorry for impolite reply but I am eager to learn more about this. Thank you very much!
Michael

Hello Ka Kin Cheung

It looks like you haven't that much c or socket programming knowledge. So
if you try to learn c, socket programming, compiling, bluetooth programming
and all relatet topics in one step, that's pretty hard.

What about Java? JSR 82?
It's fully documentated and you find a lot of samples if you ask google...

Take a look at this:
http://sourceforge.net/projects/avetanabt/
(It is available for windows as well.)

And a good general programming rule (specially for c/c++):
Do not use gcc if you haven't already understand what your code's supposed
to do.


regards
Marco


Ka Kin Cheung wrote:
> Hi all,
> I've added -lbluetooth in the command, and it successes. But when I
> run the program, the program terminates and doesn't wait for any mobile
> terminal involving into the program. What is the problem about my
> program? And need I really link the header files in bluez-libs/include?
> If so, should I include like this "bluez-libs-2.14/include/xx.h"? But
> the /usr/include contains the files. So I wish to know why if it is so.
> Here is the syntax of my program.
> int main (int argc, char **argv)
> {
> ...
> int no_connection;
> ...
> printf("\E[H\E[J");
> printf ("Bluetooth infrared converter\n\n");
> printf ("Doing initializations !\n");
> no_connection=0;
> do_listen(recv_mode);
> ...
> while (1)
> {
> no_connection++;
> printf("Now %d mobile terminal(s) is(are) using this program\n");
> sprintf (command, "at+cscs=i\"8859-1\"\r");
> ret_code = put_command (command, answer, sizeof (answer), 5, 0);
> sprintf (command, "AT*EAM=\"Bt-IrConverter\"\r");
> ret_code = put_command (command, answer, sizeof (answer), 5, 0);
> submenu_selected = 0;
> while (!submenu_selected)
> {
> ....
> Thanks very much.
> Michael
>
> */Alain Volmat /* wrote:
>
> Hi Michael,
>
> ba2str is a function provided by bluez-libs. Linking your
> program against the bluez-lib might solve your problem.
>
> add -lbluetooth to your command line.
>
> Alain
>
> * Ka Kin Cheung [Thu, 3 Feb 2005 at 18:50 +0800]
>
> > Hi all users!
> > I first give a thank to Alain Volmat that points
> > out my fault and confusion about rctest.c. Then I put
> > the parts do_listen and recv_mode in my main porgram.
> > But when I compile, strange things occur.....
> > As my program is MySQL C API, I have to compile
> > with "gcc -c -I/usr/include/mysql XX.c", and it is no
> > problem. But when I type "gcc -o XX XX.o
> > -L/usr/lib/mysql -lmysqlclient", following occurs:
> > bic_midterm.o(.text+0x1c0a): In function `do_listen':
> > : undefined reference to `ba2str'
> > collect2: ld returned 1 exit status
> > I checked with rctest.c, but there is not a function
> > for ba2str. On the other hand, tv2fl can be accepted
> > as there is a function in rctest.c. Here are the
> > include files in my main program.
> > #ifdef HAVE_CONFIG_H
> > #include
> > #endif
> >
> >
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> >
> >
> > #include
> > include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> >
> > #include
> >
> >
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> >
> >
> > #include
> > Let's see if there is any function that is missing. If
> > there is no function missing, where can I find the
> > ba2str function? I believe that if ba2str function can
> > be found declared, the program can be run. Thank you
> > very much for your kindness.
> > Michael
> >
> >
> _______________________________________________________________________
> > ?s?~?@???Ĥ@?? : ?????ͽt?H
> > http://personals.yahoo.com.hk
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: IntelliVIEW -- Interactive
> Reporting
> > Tool for open source databases. Create drag-&-drop reports. Save time
> > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF,
> etc.
> > Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> > _______________________________________________
> > Bluez-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/bluez-users
> >
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>
> ------------------------------------------------------------------------
> ?s?~?@???Ĥ@?? : ?????ͽt?H


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users



---------------------------------
?s?~?@???Ĥ@?? : ?????ͽt?H

2005-02-04 16:56:30

by Marco Trudel

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hello Ka Kin Cheung

It looks like you haven't that much c or socket programming knowledge. So
if you try to learn c, socket programming, compiling, bluetooth programming
and all relatet topics in one step, that's pretty hard.

What about Java? JSR 82?
It's fully documentated and you find a lot of samples if you ask google...

Take a look at this:
http://sourceforge.net/projects/avetanabt/
(It is available for windows as well.)

And a good general programming rule (specially for c/c++):
Do not use gcc if you haven't already understand what your code's supposed
to do.


regards
Marco


Ka Kin Cheung wrote:
> Hi all,
> I've added -lbluetooth in the command, and it successes. But when I
> run the program, the program terminates and doesn't wait for any mobile
> terminal involving into the program. What is the problem about my
> program? And need I really link the header files in bluez-libs/include?
> If so, should I include like this "bluez-libs-2.14/include/xx.h"? But
> the /usr/include contains the files. So I wish to know why if it is so.
> Here is the syntax of my program.
> int main (int argc, char **argv)
> {
> ...
> int no_connection;
> ...
> printf("\E[H\E[J");
> printf ("Bluetooth infrared converter\n\n");
> printf ("Doing initializations !\n");
> no_connection=0;
> do_listen(recv_mode);
> ...
> while (1)
> {
> no_connection++;
> printf("Now %d mobile terminal(s) is(are) using this program\n");
> sprintf (command, "at+cscs=i\"8859-1\"\r");
> ret_code = put_command (command, answer, sizeof (answer), 5, 0);
> sprintf (command, "AT*EAM=\"Bt-IrConverter\"\r");
> ret_code = put_command (command, answer, sizeof (answer), 5, 0);
> submenu_selected = 0;
> while (!submenu_selected)
> {
> ....
> Thanks very much.
> Michael
>
> */Alain Volmat <[email protected]>/* wrote:
>
> Hi Michael,
>
> ba2str is a function provided by bluez-libs. Linking your
> program against the bluez-lib might solve your problem.
>
> add -lbluetooth to your command line.
>
> Alain
>
> * Ka Kin Cheung [Thu, 3 Feb 2005 at 18:50 +0800]
>
> > Hi all users!
> > I first give a thank to Alain Volmat that points
> > out my fault and confusion about rctest.c. Then I put
> > the parts do_listen and recv_mode in my main porgram.
> > But when I compile, strange things occur.....
> > As my program is MySQL C API, I have to compile
> > with "gcc -c -I/usr/include/mysql XX.c", and it is no
> > problem. But when I type "gcc -o XX XX.o
> > -L/usr/lib/mysql -lmysqlclient", following occurs:
> > bic_midterm.o(.text+0x1c0a): In function `do_listen':
> > : undefined reference to `ba2str'
> > collect2: ld returned 1 exit status
> > I checked with rctest.c, but there is not a function
> > for ba2str. On the other hand, tv2fl can be accepted
> > as there is a function in rctest.c. Here are the
> > include files in my main program.
> > #ifdef HAVE_CONFIG_H
> > #include
> > #endif
> >
> >
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> >
> >
> > #include
> > include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> >
> > #include
> >
> >
> > #include
> > #include
> > #include
> > #include
> > #include
> > #include
> >
> >
> > #include
> > Let's see if there is any function that is missing. If
> > there is no function missing, where can I find the
> > ba2str function? I believe that if ba2str function can
> > be found declared, the program can be run. Thank you
> > very much for your kindness.
> > Michael
> >
> >
> _______________________________________________________________________
> > ?s?~?@???Ĥ@?? : ?????ͽt?H
> > http://personals.yahoo.com.hk
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: IntelliVIEW -- Interactive
> Reporting
> > Tool for open source databases. Create drag-&-drop reports. Save time
> > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF,
> etc.
> > Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> > _______________________________________________
> > Bluez-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/bluez-users
> >
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>
> ------------------------------------------------------------------------
> ?s?~?@???Ĥ@?? : ?????ͽt?H <http://hk.personals.yahoo.com>


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-03 14:54:41

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi,

> Now I put all parts of rctest.c in my main program
> to test, and then I found the error message " Can't
> set RFCOMM link mode: Protocol not available (92)",
> and this happens in do_listen part. My T610 has
> included my PC in the menu of "My device". So, what
> have I do so that the RFCOMM link can be set?

you have two possibilities. First you can install a Linux kernel where
RFCOMM link mode is supported. This is a 2.6.10-mh3 or a 2.6.11-rc3.
Second you don't use any link mode features. Means that no master, auth,
encrypt or secure variable should be set to 1.

I really would feel better if you try to understand what the code in
rctest.c means and actually does, instead of only copy it and then try
to use it.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-03 14:26:19

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marcel,
I'm sorry for doing such stupid thing.
Now I put all parts of rctest.c in my main program
to test, and then I found the error message " Can't
set RFCOMM link mode: Protocol not available (92)",
and this happens in do_listen part. My T610 has
included my PC in the menu of "My device". So, what
have I do so that the RFCOMM link can be set? Thanks.
Michael

_______________________________________________________________________
?s?~?@???Ĥ@?? : ?????ͽt?H
http://personals.yahoo.com.hk


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-03 13:20:04

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Michael,

> I've added -lbluetooth in the command, and it successes. But when
> I run the program, the program terminates and doesn't wait for any
> mobile terminal involving into the program. What is the problem about
> my program?

if you copied only the code without actually understanding what it does,
then you also copied the output of the error messages to the syslog and
an exit(1) if something fails. Check for error messages in your log
files on the system.

> And need I really link the header files in bluez-libs/include? If so,
> should I include like this "bluez-libs-2.14/include/xx.h"? But
> the /usr/include contains the files. So I wish to know why if it is
> so.

I think you should buy yourself a C programming book first, because this
mailing list is not for teaching how to do C or socket programming or
how to use the gcc. And btw you link object code or libraries, but you
include header files.

And as a side note. Don't send code with such a stupid indentation. We
use a tab with the size of 8 spaces. You should also stop sending HTML
encoded emails. This is a mailing list and the prefered format is a
7-bit ASCII encoding.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-03 13:01:47

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi all,
I've added -lbluetooth in the command, and it successes. But when I run the program, the program terminates and doesn't wait for any mobile terminal involving into the program. What is the problem about my program? And need I really link the header files in bluez-libs/include? If so, should I include like this "bluez-libs-2.14/include/xx.h"? But the /usr/include contains the files. So I wish to know why if it is so.
Here is the syntax of my program.
int main (int argc, char **argv)
{
...
int no_connection;
...
printf("\E[H\E[J");
printf ("Bluetooth infrared converter\n\n");
printf ("Doing initializations !\n");
no_connection=0;
do_listen(recv_mode);
...
while (1)
{
no_connection++;
printf("Now %d mobile terminal(s) is(are) using this program\n");
sprintf (command, "at+cscs=i\"8859-1\"\r");
ret_code = put_command (command, answer, sizeof (answer), 5, 0);
sprintf (command, "AT*EAM=\"Bt-IrConverter\"\r");
ret_code = put_command (command, answer, sizeof (answer), 5, 0);
submenu_selected = 0;
while (!submenu_selected)
{
....
Thanks very much.
Michael

Alain Volmat <[email protected]> wrote:
Hi Michael,

ba2str is a function provided by bluez-libs. Linking your
program against the bluez-lib might solve your problem.

add -lbluetooth to your command line.

Alain

* Ka Kin Cheung [Thu, 3 Feb 2005 at 18:50 +0800]

> Hi all users!
> I first give a thank to Alain Volmat that points
> out my fault and confusion about rctest.c. Then I put
> the parts do_listen and recv_mode in my main porgram.
> But when I compile, strange things occur.....
> As my program is MySQL C API, I have to compile
> with "gcc -c -I/usr/include/mysql XX.c", and it is no
> problem. But when I type "gcc -o XX XX.o
> -L/usr/lib/mysql -lmysqlclient", following occurs:
> bic_midterm.o(.text+0x1c0a): In function `do_listen':
> : undefined reference to `ba2str'
> collect2: ld returned 1 exit status
> I checked with rctest.c, but there is not a function
> for ba2str. On the other hand, tv2fl can be accepted
> as there is a function in rctest.c. Here are the
> include files in my main program.
> #ifdef HAVE_CONFIG_H
> #include
> #endif
>
>
> #include
> #include
> #include
> #include
> #include
> #include
> #include
> #include
> #include
> #include
> #include
> #include
> #include
> #include
> #include
>
>
> #include
> include
> #include
> #include
> #include
> #include
> #include
> #include
> #include
> #include
>
> #include
>
>
> #include
> #include
> #include
> #include
> #include
> #include
>
>
> #include
> Let's see if there is any function that is missing. If
> there is no function missing, where can I find the
> ba2str function? I believe that if ba2str function can
> be found declared, the program can be run. Thank you
> very much for your kindness.
> Michael
>
> _______________________________________________________________________
> ?s?~?@???Ĥ@?? : ?????ͽt?H
> http://personals.yahoo.com.hk
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users



---------------------------------
?s?~?@???Ĥ@?? : ?????ͽt?H

2005-02-03 10:59:01

by Alain Volmat

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Michael,

ba2str is a function provided by bluez-libs. Linking your
program against the bluez-lib might solve your problem.

add -lbluetooth to your command line.

Alain

* Ka Kin Cheung [Thu, 3 Feb 2005 at 18:50 +0800]
<quote>
> Hi all users!
> I first give a thank to Alain Volmat that points
> out my fault and confusion about rctest.c. Then I put
> the parts do_listen and recv_mode in my main porgram.
> But when I compile, strange things occur.....
> As my program is MySQL C API, I have to compile
> with "gcc -c -I/usr/include/mysql XX.c", and it is no
> problem. But when I type "gcc -o XX XX.o
> -L/usr/lib/mysql -lmysqlclient", following occurs:
> bic_midterm.o(.text+0x1c0a): In function `do_listen':
> : undefined reference to `ba2str'
> collect2: ld returned 1 exit status
> I checked with rctest.c, but there is not a function
> for ba2str. On the other hand, tv2fl can be accepted
> as there is a function in rctest.c. Here are the
> include files in my main program.=20
> #ifdef HAVE_CONFIG_H
> #include <config.h>
> #endif
> =20
> =20
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <fcntl.h>
> #include <sys/ioctl.h>
> #include <sys/wait.h>
> #include <sys/types.h>
> #include <sys/time.h>
> #include <sys/socket.h>
> #include <string.h>
> #include <termios.h>
> #include <syslog.h>
> #include <errno.h>
> #include <ctype.h>
> #include <signal.h>
> =20
> =20
> #include <modeminit.h>
> include <modeminit.c>
> #include <logging.c>
> #include <logging.h>
> #include <extras.h>
> #include <extras.c>
> #include <locking.c>
> #include <locking.h>
> #include <alarm.h>
> #include <alarm.c>
>=20
> #include <sys/file.h>
> =20
> =20
> #include <bluetooth/bluetooth.h>
> #include <bluetooth/hci.h>
> #include <bluetooth/hci_lib.h>
> #include <bluetooth/rfcomm.h>
> #include <bluetooth/sdp.h>
> #include <bluetooth/sdp_lib.h>
> =20
> =20
> #include <mysql/mysql.h>
> Let's see if there is any function that is missing. If
> there is no function missing, where can I find the
> ba2str function? I believe that if ba2str function can
> be found declared, the program can be run. Thank you
> very much for your kindness.
> Michael
>=20
> _______________________________________________________________________
> =E6=96=B0=E5=B9=B4=E9=A1=98=E6=9C=9B=E7=AC=AC=E4=B8=80=E4=BD=8D : =E6=89=
=BE=E5=88=B0=E5=8F=8B=E7=B7=A3=E4=BA=BA
> http://personals.yahoo.com.hk
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>=20
</quote>


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-01 14:39:05

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marcel!
I've looked at your power point about Bluetooth programming for Linux in Wireless Technologies Congress 2003, but I found that the programs in slides 19, 21 and 22 are seemed not to be closely related to change a TTY based program to a socket based program. (P.S. In order to let you know what I'm saying, I attach the power point here.) Please explain to me, but I just need to know if slides 19 and 21 are related to the topic I wish to know. Thank you very much.
Michael

Marcel Holtmann <[email protected]> wrote:
Hi Michael,

> I thank Marcel here for help on initializing
> connection from mobile to PC. Now, before I can do
> that, I initialize the rfcomm connection from PC to
> mobile, and then run my project program. The syntax is
> as follows:
> snprintf (tmp, sizeof (tmp), "t68_remote_v2 (%s)",
> modemname);
> tmp[sizeof (tmp) - 1] = 0;
> openlogfile (tmp, logfile, LOG_DAEMON, loglevel);
> set_alarmhandler (alarmhandler, alarmlevel,
> modemname);
> openmodem ();
> setmodemparams ();
> But now, when I initialize the connection from mobile
> to PC, once I run the program, "/dev/rfcomm0: No such
> device" is shown. So, I wish to know how can I modify
> the program by changing some syntax from that I post
> here? Or is there any program that I can include in my
> main program? Thank you very much.

if you wanna connect from a mobile phone to a machine running BlueZ you
need to write an application that listens on a RFCOMM channel. This is
about socket programming and you convert this socket later in to a TTY
with a /dev/rfcommX device node, but actually unless you have some
legacy application like pppd this should not be needed. What you need is
to do direct socket programming. It is as easy as using a TTY and I
posted detailed information about how to change a TTY based program into
a socket based program years ago. Check the mailing list archive.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users





---------------------------------
?s?~?@???Ĥ@?? : ?????ͽt?H


Attachments:
wtc2003_slides.pdf (265.91 kB)
wtc2003_slides.pdf

2005-02-03 10:50:34

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi all users!
I first give a thank to Alain Volmat that points
out my fault and confusion about rctest.c. Then I put
the parts do_listen and recv_mode in my main porgram.
But when I compile, strange things occur.....
As my program is MySQL C API, I have to compile
with "gcc -c -I/usr/include/mysql XX.c", and it is no
problem. But when I type "gcc -o XX XX.o
-L/usr/lib/mysql -lmysqlclient", following occurs:
bic_midterm.o(.text+0x1c0a): In function `do_listen':
: undefined reference to `ba2str'
collect2: ld returned 1 exit status
I checked with rctest.c, but there is not a function
for ba2str. On the other hand, tv2fl can be accepted
as there is a function in rctest.c. Here are the
include files in my main program.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <string.h>
#include <termios.h>
#include <syslog.h>
#include <errno.h>
#include <ctype.h>
#include <signal.h>


#include <modeminit.h>
include <modeminit.c>
#include <logging.c>
#include <logging.h>
#include <extras.h>
#include <extras.c>
#include <locking.c>
#include <locking.h>
#include <alarm.h>
#include <alarm.c>

#include <sys/file.h>


#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <bluetooth/rfcomm.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>


#include <mysql/mysql.h>
Let's see if there is any function that is missing. If
there is no function missing, where can I find the
ba2str function? I believe that if ba2str function can
be found declared, the program can be run. Thank you
very much for your kindness.
Michael

_______________________________________________________________________
?s?~?@???Ĥ@?? : ?????ͽt?H
http://personals.yahoo.com.hk


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-03 05:22:37

by Alain Volmat

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Michael,

> a)Just include "rctest.c" by creating "rctest.h" in bluez-utils-2.14/test directory, and put the function prototypes related to listening on a RFCOMM channel and include the header files bluetooth.h and rfcomm.h in my main program

Are you kidding ?

> b)put the functions related to listening on a RFCOMM channel in my main program, and include the header files bluetooth.h and rfcomm.h in the beginning.

Seems much better than the first idea. basically only do_listen and recv_mode
should be important in your case.

> So, which approach is more appropriate?

The second one.

> And for each approach, what variables need I to declare in the beginning of my main program?

Are you kidding ? (once more) .. this is not a bluetooth/socket API question
anymore but just C programming you are asking about. Are we here for that ?

> 2.My wish is to let the program to accept all mobiles that wish to connect to PC. Then how can I write the syntax so that if one mobile wish to connect to PC, the PC can accept it?

Take a look at the function do_listen ... the bind call.

loc_addr.rc_family = AF_BLUETOOTH;
loc_addr.rc_bdaddr = BDADDR_ANY;
loc_addr.rc_channel = channel;
if( bind(s, (struct sockaddr *) &loc_addr, sizeof(loc_addr)) < 0 ) {

should let you get connection from any device ....

> And how can I do to count and check the number of mobile terminals connecting with PC?
> 3.What online reference is good for me to get familiar with the matter that I asked in the previous two questions?

Some googleing with keyword like "socket programming" should be a good start.

Regards,

Alain


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-03 03:42:26

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marcel!
I'm sorry for that I made an unclear question before so that I'm confusing of how to do. Let me ask again here.
1.After seeing your reply, I'm deciding to change the rfcomm connection approach as from mobile terminal to computer in two ways:
a)Just include "rctest.c" by creating "rctest.h" in bluez-utils-2.14/test directory, and put the function prototypes related to listening on a RFCOMM channel and include the header files bluetooth.h and rfcomm.h in my main program
b)put the functions related to listening on a RFCOMM channel in my main program, and include the header files bluetooth.h and rfcomm.h in the beginning.
So, which approach is more appropriate? And for each approach, what variables need I to declare in the beginning of my main program?
2.My wish is to let the program to accept all mobiles that wish to connect to PC. Then how can I write the syntax so that if one mobile wish to connect to PC, the PC can accept it? And how can I do to count and check the number of mobile terminals connecting with PC?
3.What online reference is good for me to get familiar with the matter that I asked in the previous two questions?
Hope that my question and your answer can make me more clearer about what I've to do. Thank you very much for your kindness.

Marcel Holtmann <[email protected]> wrote:
Hi Michael,

> Acutally, this project is just related to
> bluetooth. I've seen your reply, and then got through
> rctest.c. I found that the part of receiving mobile
> exists. Then I wish to know need I include the
> rctest.c file in my main program with which header
> files include in it? Or need I put the part in my
> program? And about the part you said that is the
> socket program, I wish to know is it ok if I just put
> it in my main program with which header files include
> in it? And as I need to accept all mobile, not the one
> that the address has been set in the program, to
> connect with PC and then access the program, how can I
> do to make sure that my wish is possible? Thank you
> very much.

you need to include the listen part, because this one gives you a socket
descriptor for the incoming connection in the end. From this descriptor
you can read() and write(). If you wanna accept only specific devices
then use getpeername() to get its address after they connected to you.
You can then decide what to do. If you don't like that device simple
close the connection.

The rctest.c is an example of how to do it. Don't include things that
you don't understand. For using RFCOMM it is enough to include the
bluetooth.h and rfcomm.h header files.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users



---------------------------------
?s?~?@???Ĥ@?? : ?????ͽt?H

2005-02-02 05:34:09

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Michael,

> Acutally, this project is just related to
> bluetooth. I've seen your reply, and then got through
> rctest.c. I found that the part of receiving mobile
> exists. Then I wish to know need I include the
> rctest.c file in my main program with which header
> files include in it? Or need I put the part in my
> program? And about the part you said that is the
> socket program, I wish to know is it ok if I just put
> it in my main program with which header files include
> in it? And as I need to accept all mobile, not the one
> that the address has been set in the program, to
> connect with PC and then access the program, how can I
> do to make sure that my wish is possible? Thank you
> very much.

you need to include the listen part, because this one gives you a socket
descriptor for the incoming connection in the end. From this descriptor
you can read() and write(). If you wanna accept only specific devices
then use getpeername() to get its address after they connected to you.
You can then decide what to do. If you don't like that device simple
close the connection.

The rctest.c is an example of how to do it. Don't include things that
you don't understand. For using RFCOMM it is enough to include the
bluetooth.h and rfcomm.h header files.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-02 04:54:15

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marcel!
Acutally, this project is just related to
bluetooth. I've seen your reply, and then got through
rctest.c. I found that the part of receiving mobile
exists. Then I wish to know need I include the
rctest.c file in my main program with which header
files include in it? Or need I put the part in my
program? And about the part you said that is the
socket program, I wish to know is it ok if I just put
it in my main program with which header files include
in it? And as I need to accept all mobile, not the one
that the address has been set in the program, to
connect with PC and then access the program, how can I
do to make sure that my wish is possible? Thank you
very much.
P.S. Alian, the third program is just about HCI, and
it seems not to be related to my project. Thanks for
pointing out about this.

Michael

--- Marcel Holtmann <[email protected]> ???e?G
> Hi Michael,
>
> > I've found one powerpoint you made about
> Bluetooth programming on
> > Linux in Wireless Technologies Congress 2003. But
> I don't know for
> > those three programs you put, which one is
> describing about the PC
> > listening the mobile in RFCOMM channel. Let me put
> here.
> > For Handling of Bluetooth device addresses
> > #include <bluetooth/bluetooth.h>
> > void main(int argc, char *argv[])
> > {
> > bdaddr_t bdaddr;
> > char *str, addr[18];
> > str2ba("00:a5:b4:c3:d2:e1", &bdaddr);
> > ba2str(&bdaddr, addr);
> > str = batostr(&bdaddr);
> > printf("%s %s\n", addr, str);
> > free(str);
> > bacpy(&bdaddr, BDADDR_ANY);
> > }
> >
> > For definition of the socket data types
> > static int rfcomm_connect(bdaddr_t *src, bdaddr_t
> *dst, uint8_t
> > channel)
> > {
> > struct sockaddr_rc addr;
> > int sk;
> > if ((sk = socket(PF_BLUETOOTH, SOCK_STREAM,
> BTPROTO_RFCOMM)) < 0)
> > return -1;
> > addr.rc_family = AF_BLUETOOTH;
> > bacpy(&addr.rc_bdaddr, src);
> > addr.rc_channel = 0;
> > if (bind(sk, (struct sockaddr *) &addr,
> sizeof(addr)) < 0) {
> > close(sk);
> > return -1;
> > }
> > addr.rc_family = AF_BLUETOOTH;
> > bacpy(&addr.rc_bdaddr, dst);
> > addr.rc_channel = channel;
> > if (connect(sk, (struct sockaddr *) &addr,
> sizeof(addr)) < 0) {
> > close(sk);
> > return -1;
> > }
> > So I wish to know which one is about socket based
> programming?
>
> the second is about socket programming, because it
> has the command
> socket() in it ;)
>
> The rctest.c program is a prefect example on how to
> create a listening
> RFCOMM server and parts of the rfcomm program may
> also help. If you
> don't how to do socket programming, then buy a book
> about it or read
> some of the howtos on the net about TCP/IP socket
> progamming. Actually
> using the sockets in Bluetooth is a lot more easier.
>
> Regards
>
> Marcel
>
>
>
>
>
-------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW --
> Interactive Reporting
> Tool for open source databases. Create drag-&-drop
> reports. Save time
> by over 75%! Publish reports on the web. Export to
> DOC, XLS, RTF, etc.
> Download a FREE copy at
> http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
>
https://lists.sourceforge.net/lists/listinfo/bluez-users
>

_______________________________________________________________________
?s?~?@???Ĥ@?? : ?????ͽt?H
http://personals.yahoo.com.hk


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-02 03:16:59

by Alain Volmat

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Michael,

> So I wish to know which one is about socket based programming?
The one using socket :D
By saying so, you can already remove the first one. It is only for
handling Bluetooth address, as the comment says.

The second function is about connection, not listening.
I haven't found the 3rd function you mention about, or maybe I just
misread your email ... reading source code without indentation is not
that simple.

Basically RFCOMM socket programming is just very standard socket programm=
ing.
in very short, to start listening,
socket
bind (specifying RFCOMM port)
setsockopt (for MTU ... I guess)
listen
accept
..

Alain







* Ka Kin Cheung [Wed, 2 Feb 2005 at 10:49 +0800]
<quote>
> Hi Marcel,
> I've found one powerpoint you made about Bluetooth programming on L=
inux in Wireless Technologies Congress 2003. But I don't know for those t=
hree programs you put, which one is describing about the PC listening the=
mobile in RFCOMM channel. Let me put here.
> For Handling of Bluetooth device addresses
> #include <bluetooth/bluetooth.h>
> void main(int argc, char *argv[])
> {
> bdaddr_t bdaddr;
> char *str, addr[18];
> str2ba("00:a5:b4:c3:d2:e1", &bdaddr);
> ba2str(&bdaddr, addr);
> str =3D batostr(&bdaddr);
> printf("%s %s\n", addr, str);
> free(str);
> bacpy(&bdaddr, BDADDR_ANY);
> }
>=20
> For definition of the socket data types
> static int rfcomm_connect(bdaddr_t *src, bdaddr_t *dst, uint8_t channel=
)
> {
> struct sockaddr_rc addr;
> int sk;
> if ((sk =3D socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0)
> return -1;
> addr.rc_family =3D AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, src);
> addr.rc_channel =3D 0;
> if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
> close(sk);
> return -1;
> }
> addr.rc_family =3D AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, dst);
> addr.rc_channel =3D channel;
> if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
> close(sk);
> return -1;
> }
> So I wish to know which one is about socket based programming? Thanks a=
lot!
> Michael
>=20
> Marcel Holtmann <[email protected]> wrote:
> Hi Michael,
>=20
> > I thank Marcel here for help on initializing
> > connection from mobile to PC. Now, before I can do
> > that, I initialize the rfcomm connection from PC to
> > mobile, and then run my project program. The syntax is
> > as follows:
> > snprintf (tmp, sizeof (tmp), "t68_remote_v2 (%s)",
> > modemname);
> > tmp[sizeof (tmp) - 1] =3D 0;
> > openlogfile (tmp, logfile, LOG_DAEMON, loglevel);
> > set_alarmhandler (alarmhandler, alarmlevel,
> > modemname);
> > openmodem ();
> > setmodemparams ();
> > But now, when I initialize the connection from mobile
> > to PC, once I run the program, "/dev/rfcomm0: No such
> > device" is shown. So, I wish to know how can I modify
> > the program by changing some syntax from that I post
> > here? Or is there any program that I can include in my
> > main program? Thank you very much.
>=20
> if you wanna connect from a mobile phone to a machine running BlueZ you
> need to write an application that listens on a RFCOMM channel. This is
> about socket programming and you convert this socket later in to a TTY
> with a /dev/rfcommX device node, but actually unless you have some
> legacy application like pppd this should not be needed. What you need i=
s
> to do direct socket programming. It is as easy as using a TTY and I
> posted detailed information about how to change a TTY based program int=
o
> a socket based program years ago. Check the mailing list archive.
>=20
> Regards
>=20
> Marcel
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>=20
>=20
>=20
> ---------------------------------
> =E6=96=B0=E5=B9=B4=E9=A1=98=E6=9C=9B=E7=AC=AC=E4=B8=80=E4=BD=8D : =E6=89=
=BE=E5=88=B0=E5=8F=8B=E7=B7=A3=E4=BA=BA=20
</quote>


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-02 03:10:21

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Michael,

> I've found one powerpoint you made about Bluetooth programming on
> Linux in Wireless Technologies Congress 2003. But I don't know for
> those three programs you put, which one is describing about the PC
> listening the mobile in RFCOMM channel. Let me put here.
> For Handling of Bluetooth device addresses
> #include <bluetooth/bluetooth.h>
> void main(int argc, char *argv[])
> {
> bdaddr_t bdaddr;
> char *str, addr[18];
> str2ba("00:a5:b4:c3:d2:e1", &bdaddr);
> ba2str(&bdaddr, addr);
> str = batostr(&bdaddr);
> printf("%s %s\n", addr, str);
> free(str);
> bacpy(&bdaddr, BDADDR_ANY);
> }
>
> For definition of the socket data types
> static int rfcomm_connect(bdaddr_t *src, bdaddr_t *dst, uint8_t
> channel)
> {
> struct sockaddr_rc addr;
> int sk;
> if ((sk = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0)
> return -1;
> addr.rc_family = AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, src);
> addr.rc_channel = 0;
> if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
> close(sk);
> return -1;
> }
> addr.rc_family = AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, dst);
> addr.rc_channel = channel;
> if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
> close(sk);
> return -1;
> }
> So I wish to know which one is about socket based programming?

the second is about socket programming, because it has the command
socket() in it ;)

The rctest.c program is a prefect example on how to create a listening
RFCOMM server and parts of the rfcomm program may also help. If you
don't how to do socket programming, then buy a book about it or read
some of the howtos on the net about TCP/IP socket progamming. Actually
using the sockets in Bluetooth is a lot more easier.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-02 02:49:03

by Ka Kin Cheung

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Marcel,
I've found one powerpoint you made about Bluetooth programming on Linux in Wireless Technologies Congress 2003. But I don't know for those three programs you put, which one is describing about the PC listening the mobile in RFCOMM channel. Let me put here.
For Handling of Bluetooth device addresses
#include <bluetooth/bluetooth.h>
void main(int argc, char *argv[])
{
bdaddr_t bdaddr;
char *str, addr[18];
str2ba("00:a5:b4:c3:d2:e1", &bdaddr);
ba2str(&bdaddr, addr);
str = batostr(&bdaddr);
printf("%s %s\n", addr, str);
free(str);
bacpy(&bdaddr, BDADDR_ANY);
}

For definition of the socket data types
static int rfcomm_connect(bdaddr_t *src, bdaddr_t *dst, uint8_t channel)
{
struct sockaddr_rc addr;
int sk;
if ((sk = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0)
return -1;
addr.rc_family = AF_BLUETOOTH;
bacpy(&addr.rc_bdaddr, src);
addr.rc_channel = 0;
if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
close(sk);
return -1;
}
addr.rc_family = AF_BLUETOOTH;
bacpy(&addr.rc_bdaddr, dst);
addr.rc_channel = channel;
if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
close(sk);
return -1;
}
So I wish to know which one is about socket based programming? Thanks a lot!
Michael

Marcel Holtmann <[email protected]> wrote:
Hi Michael,

> I thank Marcel here for help on initializing
> connection from mobile to PC. Now, before I can do
> that, I initialize the rfcomm connection from PC to
> mobile, and then run my project program. The syntax is
> as follows:
> snprintf (tmp, sizeof (tmp), "t68_remote_v2 (%s)",
> modemname);
> tmp[sizeof (tmp) - 1] = 0;
> openlogfile (tmp, logfile, LOG_DAEMON, loglevel);
> set_alarmhandler (alarmhandler, alarmlevel,
> modemname);
> openmodem ();
> setmodemparams ();
> But now, when I initialize the connection from mobile
> to PC, once I run the program, "/dev/rfcomm0: No such
> device" is shown. So, I wish to know how can I modify
> the program by changing some syntax from that I post
> here? Or is there any program that I can include in my
> main program? Thank you very much.

if you wanna connect from a mobile phone to a machine running BlueZ you
need to write an application that listens on a RFCOMM channel. This is
about socket programming and you convert this socket later in to a TTY
with a /dev/rfcommX device node, but actually unless you have some
legacy application like pppd this should not be needed. What you need is
to do direct socket programming. It is as easy as using a TTY and I
posted detailed information about how to change a TTY based program into
a socket based program years ago. Check the mailing list archive.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users



---------------------------------
?s?~?@???Ĥ@?? : ?????ͽt?H

2005-02-01 08:14:36

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] rfcomm question 3

Hi Michael,

> I thank Marcel here for help on initializing
> connection from mobile to PC. Now, before I can do
> that, I initialize the rfcomm connection from PC to
> mobile, and then run my project program. The syntax is
> as follows:
> snprintf (tmp, sizeof (tmp), "t68_remote_v2 (%s)",
> modemname);
> tmp[sizeof (tmp) - 1] = 0;
> openlogfile (tmp, logfile, LOG_DAEMON, loglevel);
> set_alarmhandler (alarmhandler, alarmlevel,
> modemname);
> openmodem ();
> setmodemparams ();
> But now, when I initialize the connection from mobile
> to PC, once I run the program, "/dev/rfcomm0: No such
> device" is shown. So, I wish to know how can I modify
> the program by changing some syntax from that I post
> here? Or is there any program that I can include in my
> main program? Thank you very much.

if you wanna connect from a mobile phone to a machine running BlueZ you
need to write an application that listens on a RFCOMM channel. This is
about socket programming and you convert this socket later in to a TTY
with a /dev/rfcommX device node, but actually unless you have some
legacy application like pppd this should not be needed. What you need is
to do direct socket programming. It is as easy as using a TTY and I
posted detailed information about how to change a TTY based program into
a socket based program years ago. Check the mailing list archive.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-01 06:25:10

by Ka Kin Cheung

[permalink] [raw]
Subject: [Bluez-users] rfcomm question 3

Hi all users!
I thank Marcel here for help on initializing
connection from mobile to PC. Now, before I can do
that, I initialize the rfcomm connection from PC to
mobile, and then run my project program. The syntax is
as follows:
snprintf (tmp, sizeof (tmp), "t68_remote_v2 (%s)",
modemname);
tmp[sizeof (tmp) - 1] = 0;
openlogfile (tmp, logfile, LOG_DAEMON, loglevel);
set_alarmhandler (alarmhandler, alarmlevel,
modemname);
openmodem ();
setmodemparams ();
But now, when I initialize the connection from mobile
to PC, once I run the program, "/dev/rfcomm0: No such
device" is shown. So, I wish to know how can I modify
the program by changing some syntax from that I post
here? Or is there any program that I can include in my
main program? Thank you very much.
Michael

_______________________________________________________________________
?s?~?@???Ĥ@?? : ?????ͽt?H
http://personals.yahoo.com.hk


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users