btnut/btnode/include/time/bt_time_sync.h File Reference


Detailed Description

Time Synchronization based on Bluetooth clock offsets.

Author:
Matthias Ringwald <mringwal@inf.ethz.ch>

Qin Yin <qyin@student.ethz.ch>

This implementation uses l2cap-cl for the one-time exchange of the complete BT clock and provides time-stamped single and multihop send and receive operations

To use with mhop, just call bt_time_sync_mhop_init and use bt_time_sync_send_mhop_pkt to send time stamped packets. bt_time_sync_get_time is used to extract time information of a received packets

The time sync thread uses the random number generator. We assume that it is already seeded.

Details on the implementation can be found in:

Matthias Ringwald, Kay Römer: Practical Time Synchronization for Bluetooth Scatternets. Proceedings of the 4th International Conference on Broadband Communications, Networks, and Systems (BROADNETS 2007). Raleigh, North Carolina, USA, September 2007. http://www.vs.inf.ethz.ch/publ/papers/mringwal-practi-2007.pdf Invited Paper

#include <sys/types.h>
#include <bt/bt_hci_defs.h>

Defines

#define BT_TIME_CLOCK_PSM   0xFFED

Functions

u_long bt_time_sync_get_time (bt_acl_pkt_buf *pkt)
void bt_time_sync_handle_neighbor_clock (bt_hci_con_handle_t handle, u_long remote_bt_clock)
void bt_time_sync_init (struct btstack *bt_stack)
void bt_time_sync_l2cl_init (struct btstack *bt_stack, bt_psm_t *psmux)
void bt_time_sync_mhop_init (struct btstack *bt_stack, bt_psm_t *psmux, u_short mhop_psm)
u_short bt_time_sync_mhop_max_payload (void)
long bt_time_sync_send_mhop_pkt (long event_sys_tstamp, u_char *data, u_short data_len, bt_addr_t dest, u_short psm, u_char bc_flag, u_char ttl)
long bt_time_sync_send_pkt (long event_sys_tstamp, u_char *data, u_short data_len, bt_hci_con_handle_t hdl, u_short psm)


Function Documentation

u_long bt_time_sync_get_time ( bt_acl_pkt_buf pkt  ) 

get time of timestamped event with respect to local time

Parameters:
pkt received packet

void bt_time_sync_handle_neighbor_clock ( bt_hci_con_handle_t  handle,
u_long  remote_bt_clock 
)

process time stamp from neighbour has to be called once per neighbour node this is done by higher-level API automatically (if using bt_time_sync_l2cl_init or bt_time_sync_mhop_init)

void bt_time_sync_init ( struct btstack bt_stack  ) 

low-level init

prepares bt time sync service creates timesync thread which periodically update clock offsets to neighours using inquiry registers connection callback at hci layer

void bt_time_sync_l2cl_init ( struct btstack bt_stack,
bt_psm_t psmux 
)

init bt time sync for use with l2cap connection-less

registers data callback for BT_TIME_CLOCK_PSM provides function to send timestamp over l2cap-cl

Parameters:
bt_stack 
psmux used for l2cap-cl

void bt_time_sync_mhop_init ( struct btstack bt_stack,
bt_psm_t psmux,
u_short  mhop_psm 
)

init bt time sync for use with mhop

Parameters:
bt_stack 
psmux used for l2cap-cl
mhop_psm the psm of the uses mhop service

long bt_time_sync_send_mhop_pkt ( long  event_sys_tstamp,
u_char data,
u_short  data_len,
bt_addr_t  dest,
u_short  psm,
u_char  bc_flag,
u_char  ttl 
)

send timestamped packet over mhop to destination

Parameters:
event_sys_tstamp in milli seconds obtained from NutGetMillis()
data to send
len of data
destination. use
receiver psm
bc_flag Determines if the packet should be broadcasted or not. MHOP_CL_BROADCAST | MHOP_CL_UNICAST
ttl Maximal time to live for the packet - pass TTL_INFINITE for inifinite hops

long bt_time_sync_send_pkt ( long  event_sys_tstamp,
u_char data,
u_short  data_len,
bt_hci_con_handle_t  hdl,
u_short  psm 
)

send timestamped packet over l2cap-cl

Parameters:
event_sys_tstamp in milli seconds obtained from NutGetMillis()
data to send
len of data
con handle
receiver psm


Generated on Wed Apr 29 11:12:30 2009 for BTnut System Software by doxygen 1.5.1
!!! Dieses Dokument stammt aus dem ETH Web-Archiv und wird nicht mehr gepflegt !!!
!!! This document is stored in the ETH Web archive and is no longer maintained !!!