[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bluetooth-dev] Re: Connection Problems...still not working!!!

Hi Sami,

Ok, my setup is as follows:

On an Windows PC I have an Ericsson Chat program running on top of the Ericssons BT protocol stack. On another PC I have my application running, waiting in inquiry and page scan mode. In that chat program you can make an inquiry, and discover my bt device. Afterwards I can do an connection, and finaly so some Service Discovery Protocol discovery. This will make the chat program try to open an L2CAP connection, which run on an ACL link (sending ACL packets). Thats the way I know that I am able to receive ACL data.

How do I extract the 12 bit connection handler?
I do not know how the contents of the 2 bytes that you receive from the HCI layer is, so I realy cannot help you there. 
I did my own HCI layer, so I do know how to the datalayout is. 
So lets say that you get two bytes from the HCI layer. The first byte is the first one received from the module, and the second one is the second one received from the module.

Firste byte is the least significant byte of the connection handler (bit 0-7).
Second byte's most significant nibble, is the connection handlers most significant nibble (bit 8-11).
Second bytes least significant nibble, is Broadcast_Flag  and Packet_Boundary_Flag.

So in C I would do (something) like this (remember to typecast to unsigned short / unsigned char the appropiate places....)

unsigned short ConnectionHandler;
unsigned char FirstByte, SecondByte;

// When decoding
ConnectionHandler =  ((SecondByte & 0xF0 ) << 4 ) | FirstByte;

// When encoding
FirstByte = ConnectionHandler & 0x00FF;
SecondByte = ((ConnectionHandler & 0x0F00 ) >> 4 ) | ((Broadcast_Flag  & 0x3 ) << 0x2) | ( Packet_Boundary_Flag & 0x3);

When I think about it now, I realize that I probably done this wrong. But at the moment I cannot test it, perhaps thursday. 
Does it make sense??? Do you understand what I mean with my encoding/deconding example?


----- Original Message ----- 
From: Sami Kibria <skibria@xxxxxxx.ca>
To: Michael Holm <michael.holm@xxxxxxx.dk>
Cc: <bluetooth-dev@xxxxxxx.com>
Sent: Wednesday, May 16, 2001 10:02 PM
Subject: Re: Vs: [bluetooth-dev] Re: Connection Problems...still not working!!!

> hi michael...how are you doing?  well that was one quick
> response...thanks!
> okay let me tell you what i am doing?
> well (according to v1.1), i first do an
> HCI_CREATE_CONNECTION(bd_addr, packet_type, page_scan_repetition_mode,
> page_scan_mode, clock_offset, allow_role_switch), and i receive a
> COMMAND_STATUS event packet back with status = 0x00, so its all good
> then on the host b side it receives an HCI_CONNECTION_REQUEST event
> packet, so i do an HCI_ACCEPT_CONNECTION_REQUEST immediately from the host
> b side, and host b receives a COMMAND_STATUS event packet with a status =
> 0x00, so its all good again...then according to the specification we
> should, on both the host a, and host b side receive a CONNECTION_COMPLETE
> event, and i do, with status = 0x00, so with all this data i should be
> able to send data now via the connection handler returned in the
> CONNECTION_COMPETE event...but instead it just hangs when i send the
> data...
> why???? i really don't know why right now, but my assumption right now is
> that something is wrong with my connection handler...what do you think?
> how did you get the 12 bits from the 2 bytes of the connection handler,
> and you said you can receive ACL packets, how would you know if you can't
> send anything????
> i am still confused and frustrated here!!!!
> :)
> --------------------------------------------------------------------
> Sami Kibria
> Researcher
> TRLabs - Winnipeg, Manitoba. CANADA
> email: skibria@xxxxxxx.ca
> --------------------------------------------------------------------
>    __   _
>   / /  (_)__  __ ____  __
>  / /__/ / _ \/ // /\ \/ /  . . .  t h e   c h o i c e   o f   a
> /____/_/_//_/\_,_/ /_/\_\              G N U   g e n e r a t i o n
> --------------------------------------------------------------------

To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com