Help Bluetooth Programing
Hi all
I have been reading and working on Bluetooth programming for my
project. Some points I am a bit blur about. Could you just give your
suggestion?
I try to state my problem as clear as possible.
What I have:
Two bluetooth chips with programmable microprocessors. One is referred
as Master, the other is referred as Slave. They each has a 48 bit
address and IS KNOWN TO EACH OTHER.
What I want:
When they are both powered on, Master will be able to detect that
specific slave within a certain range say, 1m.(Hardward issue) Once the
Slave is out of a range Master will sound alarm.
What I did:
I write C program under BlueZ to let Master keep on inquiry nearby
device using the function: hci_inquiry(...). I set the max number of
detectable device to one (max_rsp = 1). And everytime if Master
detected nothing within time, sounds alarm. When a device is detected,
I can get the detected device's 48 bit address. So Master make a
comparison with the special Slave's address. If it is the Slave unit it
wants to detect, Master will clear this inquiry, go to the next
inquiry. (Use a while loop) Otherwise, if it is not, Master sound the
alarm.
So now the problem is:
1. I know how to do the Master side program. But What should I do for
slave side? What code should I write? What I need for Slave is just let
it to be Discoverable/Detectable once it is powered on.
2. Should I do the whole thing in socket manner?
Looking forward to your reply.
Thanks.
YY
|