google / physical-web

The Physical Web: walk up and use anything
http://physical-web.org
Apache License 2.0
6k stars 665 forks source link

Create a FatBeacon emulator for Arduino or Node? #814

Open scottjenson opened 8 years ago

scottjenson commented 8 years ago

There seems to be some interest in people playing with FatBeacon. We're about to release a 'demo' version of the PW app that will let you easily bring up a sample FatBeacon but clearly, something a bit more flexible would be helpful for people to play with.

I'm curious if anyone out there is currently toying around with Arduino or Node and would be willing to replicate the FatBeacon characteristic? Something that would just let people try a few things out. We really want to do this but won't be able to get to it for a few weeks. i was hoping this would be easy for some of you.

Thanks,

Scott

hardillb commented 8 years ago

I'll give it a go with the bleno nodejs code if you can let me know the characteristics. I've been waiting for the spec to have a go.

hayesjordan commented 8 years ago

There are two UUID's that are associated with FatBeacon. The UUID for the service is ae5946d4-e587-4ba8-b6a5-a97cca6affd3 and the UUID for the html characteristic is d1a517f0-2499-46ca-9ccc-809bc1c966fa.

Another thing worth noting here is that due to some limitations on android, the FatBeacon server transfers packets that are 5 bytes smaller than the MTU size. Therefore to read the full characteristic value, the app reads the html characteristic repeatedly until it receives a packet that is more than 5 bytes smaller than the MTU size. The FatBeacon server also needs to maintain the state of the characteristic for the connection.

The FatBeaconBroadcastService is the FatBeacon server code for the app and BluetoothSite is the FatBeacon client code.

hardillb commented 8 years ago

Thanks, I'll see what I can run up at the weekend

scottjenson commented 8 years ago

This 5 byte issue is a good example of this API being in flux. This is what we had to do in order to get it working on Android. As we move to beacon based solutions, we may (likely) remove this type of workaround.

arcturus commented 8 years ago

+1 to try out with bleno in node. \o/

jeffprestes commented 8 years ago

For me Go or Node.

On Fri, Sep 2, 2016 at 5:42 AM, Francisco Jordano notifications@github.com wrote:

+1 to try out with bleno in node. \o/

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/physical-web/issues/814#issuecomment-244317971, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgjWTmmoVnprn8qAl0q2nSdsYaCvTnhks5ql-GLgaJpZM4JzKZJ .

hardillb commented 8 years ago

First pass -> https://github.com/hardillb/FatBeacon

It's not working just yet, but the bones should be there. I'll add a README.md in a few mins but if anybody wants to try and debug it while I get some "real" work done this afternoon.

jacobrosenthal commented 8 years ago

I think a better start would be don's node-eddystone-beacon which already solved a lot of the eddystone issues on all platforms. I moved some of your stuff over here, feel free to PR them so your authorship is intact, etc. https://github.com/jacobrosenthal/node-eddystone-beacon/tree/fatbeacon

It advertises, but cant connect yet ;)

Use DEBUG=* node examples/fatBeacon/simple.js to see some debug output.. For some reason were getting 2 accepts and on osx I get a kCBMsgId82 which isnt handled by bleno. Trying to figure out whats up with that.

Any help appreciated :)

hardillb commented 8 years ago

Do we need anything above normal service advertisement? I know there is an open issue on the node-eddystone-beacon stuff about advertising a URL and services at the same time (interleaved) that is still open (I want that for some easier Eddystone + WebBluetooth stuff).

Anyway, I'll pull it and have a look

hardillb commented 8 years ago

@jacobrosenthal I've got your modified version of my code transposed to the @don's eddystone code working on my Pi. I've not tried things closer or bigger than the MTU but it's working with small payloads.

https://github.com/hardillb/node-eddystone-beacon/tree/fatbeacon/examples/fatBeacon

I'll stick in a pull request to don later today if nobody spots anything really wrong with it.

beaufortfrancois commented 8 years ago

For info, I've created a simple web app that reads FatBeacon content at https://beaufortfrancois.github.io/sandbox/physical-web/fatbeacon/ Let me know what you think.

scottjenson commented 8 years ago

Excellent, thank you! I'll try to get some eyes on it.