2005-02-09 13:07:01

by # Björn Specht #

[permalink] [raw]
Subject: [Bluez-devel] btohs,btohl, ...

Hi all,

I implemented a client server over bluetooth and I was wondering if I need the Little Endian, Big Endien conversion functions btohs,btohl,htobs,htobl?

Do I need to convert every single byte? which is received or sent over my sock_stream socket?
If yes, should it look like this for the receiving case: btohs(buf[0]).... an so on for every byte?

Thanks in advance
Bj?rn


Attachments:
(No filename) (189.00 B)

2005-02-09 15:18:03

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] omtu, imtu

Hi Bjoern,

> can you also tell me what omtu and imtu are for? I know the Maximum Transfer Unit, but what exactly do these 2? I have set them to 672 and 0 like in the rctest.c file.

what about reading the L2CAP part of the Bluetooth specification. It is
all there, but in short (i)ncoming MTU and (o)utgoing MTU.

> Is 672 the maximum? It would just be nice to know the maximum data per frame, for a good header to data proportion.

The maximal value is 65535. The header/payload is not important for the
throughput. Only matching it to the baseband packet types helps.

Regards

Marcel




-------------------------------------------------------
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-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-02-09 15:07:02

by # Björn Specht #

[permalink] [raw]
Subject: Re: [Bluez-devel] omtu, imtu

Hi Marcel,

can you also tell me what omtu and imtu are for? I know the Maximum Transfe=
r Unit, but what exactly do these 2? I have set them to 672 and 0 like in t=
he rctest.c file.

Is 672 the maximum? It would just be nice to know the maximum data per fram=
e, for a good header to data proportion.

Thanks again=20
Bj=F6rn


-------------------------------------------------------
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-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-02-09 14:00:56

by # Björn Specht #

[permalink] [raw]
Subject: Re: [Bluez-devel] btohs,btohl, ...

Thanks Marcel,

You're the man!

Bj=F6rn

On Wed, 09 Feb 2005 14:57:10 +0100
Marcel Holtmann <[email protected]> wrote:

> Hi Bjoern,
>=20
> > sorry for my signing. I read that sometimes a different order is used w=
ithin a byte as well and not only between bytes.=20
>=20
> I don't know of any architecture that stores the bits of its bytes in a
> different order and where this is visible to for the user. However such
> a platform might exists.
>=20
> > Okay that makes it easier.
>=20
> You mean big endian communicates with little endian or vice versa?
>=20
> > But if this is not the case:
> > When I send a 32bit integer for example, do I have to worry about the o=
rder of the bytes when I send or receive them?=20
>=20
> If you have a byte stream (a character array) then you don't need to
> worry, because they are stored in a endianless format (bytewise). If you
> use datatypes like uint16_t and uint32_t and send them to the stream or
> copy them into an array then you should convert them to the same endian
> encoding.
>=20
> Regards
>=20
> Marcel
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> 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=3D6595&alloc_id=3D14396&op=3Dclick
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>=20


-------------------------------------------------------
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-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-02-09 13:57:10

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] btohs,btohl, ...

Hi Bjoern,

> sorry for my signing. I read that sometimes a different order is used within a byte as well and not only between bytes.

I don't know of any architecture that stores the bits of its bytes in a
different order and where this is visible to for the user. However such
a platform might exists.

> Okay that makes it easier.

You mean big endian communicates with little endian or vice versa?

> But if this is not the case:
> When I send a 32bit integer for example, do I have to worry about the order of the bytes when I send or receive them?

If you have a byte stream (a character array) then you don't need to
worry, because they are stored in a endianless format (bytewise). If you
use datatypes like uint16_t and uint32_t and send them to the stream or
copy them into an array then you should convert them to the same endian
encoding.

Regards

Marcel




-------------------------------------------------------
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-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-02-09 13:38:58

by # Björn Specht #

[permalink] [raw]
Subject: Re: [Bluez-devel] btohs,btohl, ...

Hi Marcel,

sorry for my signing. I read that sometimes a different order is used withi=
n a byte as well and not only between bytes.=20
Okay that makes it easier.
But if this is not the case:
When I send a 32bit integer for example, do I have to worry about the order=
of the bytes when I send or receive them?=20

Bj=F6rn


On Wed, 09 Feb 2005 14:19:31 +0100
Marcel Holtmann <[email protected]> wrote:

> Hi Bjoern,
>=20
> if you sign emails that go to a mailing list. Make sure that your key is
> available on a public keyserver. Yours is not.
>=20
> > I implemented a client server over bluetooth and I was wondering if I n=
eed the Little Endian, Big Endien conversion functions btohs,btohl,htobs,ht=
obl?
>=20
> if both sides are of the same endianess then not, but it is a good
> programming style to always use them.
>=20
> > Do I need to convert every single byte? which is received or sent over =
my sock_stream socket?
> > If yes, should it look like this for the receiving case: btohs(buf[0]).=
... an so on for every byte?
>=20
> For what do you wanna swap a byte and with what? There is nothing to
> swap. Think about it ;)
>=20
> Regards
>=20
> Marcel
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> 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=3D6595&alloc_id=3D14396&op=3Dclick
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>=20


-------------------------------------------------------
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-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-02-09 13:19:31

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] btohs,btohl, ...

Hi Bjoern,

if you sign emails that go to a mailing list. Make sure that your key is
available on a public keyserver. Yours is not.

> I implemented a client server over bluetooth and I was wondering if I need the Little Endian, Big Endien conversion functions btohs,btohl,htobs,htobl?

if both sides are of the same endianess then not, but it is a good
programming style to always use them.

> Do I need to convert every single byte? which is received or sent over my sock_stream socket?
> If yes, should it look like this for the receiving case: btohs(buf[0]).... an so on for every byte?

For what do you wanna swap a byte and with what? There is nothing to
swap. Think about it ;)

Regards

Marcel




-------------------------------------------------------
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-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel