Return-Path: Message-ID: <20050203034226.82077.qmail@web60903.mail.yahoo.com> From: Ka Kin Cheung Subject: Re: [Bluez-users] rfcomm question 3 To: bluez-users@lists.sourceforge.net In-Reply-To: <1107322449.9276.13.camel@pegasus> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-384490494-1107402146=:81099" Sender: bluez-users-admin@lists.sourceforge.net Errors-To: bluez-users-admin@lists.sourceforge.net Reply-To: bluez-users@lists.sourceforge.net List-Unsubscribe: , List-Id: BlueZ users List-Post: List-Help: List-Subscribe: , List-Archive: Date: Thu, 3 Feb 2005 11:42:26 +0800 (CST) --0-384490494-1107402146=:81099 Content-Type: text/plain; charset=big5 Content-Transfer-Encoding: 8bit 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 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 Bluez-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-users --------------------------------- ?s?~?@???Ĥ@?? : ?????ͽt?H --0-384490494-1107402146=:81099 Content-Type: text/html; charset=big5 Content-Transfer-Encoding: 8bit
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 <marcel@holtmann.org> 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
des criptor 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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users



?s?~?@???Ĥ@?? : ?????ͽt?H
--0-384490494-1107402146=:81099-- ------------------------------------------------------- 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 Bluez-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-users