User Tools

Site Tools


rem0te

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rem0te [2011/12/21 18:26]
schneider [Bridge]
rem0te [2012/01/07 19:59] (current)
rene-dev [Bridge]
Line 41: Line 41:
 ====== Bridge ====== ====== Bridge ======
 The firmware for the bridge is located in the file firmware/​applications/​bridge.c The firmware for the bridge is located in the file firmware/​applications/​bridge.c
- 
-To build it you have to edit firmware/​core/​projectconfig.h and 
-  - deactivate CFG_USBMSC 
-  - activate CFG_USBCDC 
  
 Then run: Then run:
 <​code>​ <​code>​
 cd firmware cd firmware
-make APP=bridge+make clean 
 +make APP=bridge ​USBSERIAL=YES
 </​code>​ </​code>​
  
Line 121: Line 118:
   - the addition and removal of players   - the addition and removal of players
   - new packets sent by players. This includes joins, nicknames and the state of the button   - new packets sent by players. This includes joins, nicknames and the state of the button
 +
 +===== Writing own libraries =====
 +
 +Have a look at the top of l0dables/​r_player.c. It contains the definitions of the packets and the flags used.
 +
 +To host a game do the following:
 +
 +1) Select a random 16bit GameID, select a random 5 Byte GameMAC, set a global ctr variable to 0, select the channel you want your game to run on
 +
 +2) Every second set the bridge channel and TX mac to the values recommended above and send an announce packet with the following content:
 +   - len = 32
 +   - protocol = '​G'​
 +   - command = '​A'​
 +   - id = 0
 +   - ctr++
 +   - gameMAC
 +   - gameChannel
 +   - gameID
 +   - gameFlags:
 +       - 1 : Mass game. The players do not need to join the game
 +       - 2 : Short packet. The players will only send 16 Byte responses. (EXPERIMENTAL)
 +       - 4 : Long Recv: The players will have their radio for a longer time in receive mode
 +   - interval: The interval in 5ms at which the button should be sampled by the l0dable and sent.
 +   - jitter: The amount of randomisation on top of the the interval
 +   - gameTitle: 8 Bytes with the name of the game
 +   Now set the bridge back to receive on the gameChannel
 +
 +3) When a player sends a Join packet it will contain:
 +   - len = 32
 +   - protocol = '​G'​
 +   - command = '​J'​
 +   - id = the player id
 +   - ctr = the player ctr++
 +   - gameId = your gameId
 +   Now send the following packet:
 +   - len = 32
 +   - protocol = '​G'​
 +   - command = '​a'​
 +   - id = player id
 +   - ctr = ctr of join packet
 +   - flags = 1 if the join was OK, 0 if the join has failed
 +   As destination MAC use the gameMac with the last byte incremented by 1.
 +4) The player will start to send:
 +   - len = 32
 +   - protocol = '​G'​
 +   - command = '​B'​
 +   - id = player id
 +   - ctr = player ctr++
 +   - button = state of the button
rem0te.1324488400.txt.gz · Last modified: 2011/12/21 18:26 by schneider