On 18.01.2011, at 11:47, Hans wrote:
> Hi,
>
> I would like to use the PTT Remote Control (SHP612) switch as a kind
> of Bluetooth GPIO signal. According to its manufacturer it supports a
> serial bluetooth profile.
> http://www.seecode.com/sub/DownLoad.asp?table=manual&Filenum=1&idx=6
>
> I would like to integrate this i one of the Apple example XCode
> projects, because displaying info on iPhone screen is already shown
> there.
well, that was OpenGL-EL :)
>
> Is btstack capable of receiving serial data from SPH612?
yes, see RFCOMM in the wiki.
> Also
> important: would it be necessary to bring the Bluetooth device in
> pairing mode each time the app is started, or can pairing be stored
> persistently in the app?
no, yes, but since a while (don't know exactly) the BTstack daemon stores the link keys generated by the pairing process itself.
Best
matthias
>
> Hans
>
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To post to this group, send email to btsta...@googlegroups.com.
> To unsubscribe from this group, send email to btstack-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/btstack-dev?hl=en.
>
On 23.01.2011, at 21:46, Hans wrote:
> I managed to build BTstackCocoa using XCode version 3.2.5 and run it
> on iOS 4.0.1 device in debug mode. The iPhone lists the bluetooth
> device as SHP-612 as well as my MacBook. I guess I am halfway there,
> because I have the BTstack running and I have a GUI.
>
> The SHP-612 being listed in BTstackCocoa means: pairing is not yet
> done, I guess?
Why? A device discovery shows all devices that are, well, in discovery mode.
>
> Any pointers on how to create a Wireshark trace (probably on the
> iPhone) are welcome.
On the iPhone (iPod/iPad), BTstack logs to /tmp/hci_dump.pklg.
On the Mac, Apple's PacketLogger is cool.
Best
Matthias
>
>
> On 21 Jan., 21:54, Matthias Ringwald <matthias.ringw...@gmail.com>
> wrote:
>>> Also
>>> important: would it be necessary to bring the Bluetooth device in
>>> pairing mode each time the app is started, or can pairing be stored
>>> persistently in the app?
>>
>> no, yes, but since a while (don't know exactly) the BTstack daemon stores the link keys generated by the pairing process itself.
>
> Do I need to configure the pairing process in some way in BTstack
> code, e.g. PIN?
>
No. BTstack deamon provides access to the Bluetooth module. If there is a pairing process, your app will get an event packet that ask for the PIN which you have to answer. (see code in some of the examples).
> Because I have no idea what the packet will look like that the PTT
> device will send upon button press, I thought it would be a good idea
> to create a Wireshark trace, at least interactive wireshark tracing
> will show the relationship between button press and a certain packet.
> This way I would know where to insert my code in BTstack to use the
> PTT signal.
Looking at packet logs is a good idea. However, as I've said, the BTstack lib provides access to the BTdaemon. BTdaemon won't do anything with your data, it allows to have an app that receives/sends data.
>
> Unfortunately it seems Wireshark Bluetooth tracing is not possbile on
> OSX using libPcap. Am I right? Can it be done on Windows, or do I need
> a Linux machine for tracing?
I managed to do an USB trace on Windows, but that's a pain to read. Linux & Mac are fine using hcidump and PacketLogger respectively.
>
> One thing is not clear to me yet: which files from the BTstack svn do
> I need to copy into my XCode project?
basically none. The CocoaTouch interface isn't mature yet, so you're free to compile them into your project, otherwise you link against libBTstack.dylib and include the exposed headers in BTstack/include/
> I know I need rfcomm.c and can
> try to pull files step-by-step, but would be easier to understand the
> structure of the repository.
Ah right. Until RFCOMM is part of the BTdaemon (don't ask for when), you can also copy/compile rfcomm.c into your app
best
matthias
>
> Best, Hans
to skip authentification, you can change
bt_send_cmd(&hci_write_authentication_enable, 1);
to
bt_send_cmd(&hci_write_authentication_enable, 0);
in rfcomm.c
best
Matthias
> Hi Matthias,
>
> BTW: I disabled mknod and open(FIFO_NAME...) because that failed. But
> as I receive packets anyway I don't bother. Should I?
That's ok. The FIFO was added due to popular demand, but wasn't there in the beginning and I don't think RFCOMM should be used via a FIFO (better integrate it with your actual app)
Best
matthias
On 31.01.2011, at 11:32, Hans wrote:
> Regarding FIFO: If its not necessary, what is the purpose?
The FIFO is nice for quick first check to see if a connection can be established. I've added it because people asked for it and even supplied a patch.
..
> When using RFCOMM protocol to receive
> data from the PTT device, is there a TCP-like transport control that
> retransmits data to make sure no PTT event gets lost?
RFCOMM runs over connection-oriented L2CAP channels, which are reliable according to the Bluetooth specification. It's the task of the Link Manager in the Bluetooth module to either provide a reliable connection or just drop it.
Best
Matthias
yupp. Mac OS does a proper service discovery, which doesn't required authentication usually. You can try to read from that virtual serial port and motivate OS X to really do the pairing, or fail.
And the PIN is usually hard-coded and in the manual. Try "0000", "1234" and ... "5555" <- TomTom iPhone Car Kit
Best
Matthias
Sorry, I lost track of your project and the pieces. Let me recacp:
So you have this "Bluetooth PTT" and want to use it on the iPhone with BTstack, right?
The service discovery from the Mac shows that it only supports one or multiple RFCOMM connections.
The connection with rfcomm.c fails without a PIN but you don't know the right one.
Not sure what your options are. If you can pair it with the Mac and actually communicate over RFCOMM, it should also work with BTstack.
I have no clue how your options 2) and 3) are related to that device. (2- a mouse? HID? 3 - ArduinoBT is a basic AVR with a serial-to-RFCOMM chip but it will need a PIN, too)
Best
Matthias
ok. thanks for the details.
given the constraints, I'd suggest going the "use Bluetooth mouse" route. If you run example/test.c and set the Bluetooth address of your mouse, it will connect and deliver HID reports. HID reports can be very complex, but for a mouse button, there will be a single bit that toggles. That's really easy to use in that case - Writing a full blown HID description parser which can work with any HID device and properly detect what's it supposed to to with the input is a different one. One that I'll be facing soon btw...
best
Matthias
You are using the mac to try to connect - is it asking for a PIN or is
it telling you to enter on on the remote device?
What does the device do? Does it have buttons? Receive audio? Send
audio? Has a display? I'm a little confused as to which end you want
to use or emulate.
You might need one of these when they become available:
http://ossmann.blogspot.com/2011/01/ubertooth-video-and-news.html
He has a kickstarter project, so for $100 you can be an early adopter.
you cannot get the Bluetooth PIN even with a an expensive Bluetooth sniffer. It is never sent over the air. Bluetooth security isn't perfect, but it is not THAT broken. :)
I don't know the details, but the PIN + some random data which is exchanged is used to create the link key.
see diffie-hellman key exchange for similar approaches.
Best
matthias
> --
> You received this me
any mouse but the previous Apple Mighty Mouse work with BTstack Mouse and after sending them the "use boot procotol" package, they send back in a standardized format.
for powersave, you could issue a sniff command (again, one single command) for that connection
best
matthias
I don't want to be negative here, but in the debug output I read that "0000" is sent to the Bluetooth module and the module answers that it successfully received that PIN. This does not imply that both devices are paired as this would result in a link key notification.
as for the brute forcing before, if we assume that the PIN is just 4 digits and hard-coded, you could write a little tool that just tries all combinations with any environment you like. pyBluez or lightblue (both python) might be an easy one.
Best
Matthias
congratulations on breaking the PIN - which tells us that a 4 digit number was never secure. but that's good in your case.
On 05.02.2011, at 00:38, Hans wrote:
> How do I combine the BTstack run loop with the GUI of the iPhone
> example code from Apple? I need the GUI mainly for output.
all you have to do (besides making the compiler & Xcode happy) is to call run_loop_init(RUN_LOOP_COCOA). And you don't need to call run_loop_execute() when running in a normal iOS app (as BTstack integrates with the provided CoreFoundation run loop after selecting RUN_LOOP_COCOA).
Also, take a look at CocoaTouch/ ... The BTstackManager class provides a basic Obj-C interface (which can be improved a lot, I know) and already handles activation and run loop setup, see TestBTstackManager.m.
Best
Matthias
On 20.02.2011, at 18:18, Hans wrote:
> ..
> Now I am in trouble because it is expected that I get it running on
> iPad. I installed WiiMote because that installs the BTstack dynamic
> link library, right? According to the debugger it seems to me that I
> can use identical source code on iPad. As on iPhone Bluetooth seems to
> be more reliable when WiFi is off.
yes. same package from Cydia on all supported platforms: iPhone, iPad, iPod, AppleTV 2
>
> The problem I experience is that the PTT device does not accept the
> PIN that works on iPhone. I tried pairing on OSX and on Android with
> the same negative result. This makes we wonder. Could it be that the
> PTT device does not allow pairing with two devices at the same time?
> Does kind of unpairing exist? Or probably the second pairing requires
> another PIN?
no idea. I don't think it needs a different PIN.
> BTW, how likely is it that the PTT device allows RFCOMM channel open
> of iPhone and iPad at the same time?
Tehcnically its possible, a mac can do that, BTstack should support that, too. However, it's quite possible that multiple connections might are not supported.
> Would that be possible with an
> ordinary Bluetooth mouse?
Nope.
> And more: I also need to port my app to iPod in the next step. Is that
> going to cause issues regarding BTstack?
Nope.
Best
Matthias
after the Mardi Grass Costume, another use of BTstack in art. I certainly didn't expect that. :)
What did your app actually do? In the forum post you say "a counter". Can you tell a bit more? And is this related to the PTT thing you re-used?
Best
Matthias