# EDTT transport for BabbleSim devices This is a description of the inner workings of the EDTT transport for BabbleSim (`edttt_bsim.py` and associated embedded driver) ## Introduction In simulation the picture of how the communication between the EDTT and the devices looks as follows: ``` ___________ __________ _________________ | | --> | | --> | | | | | Device 0 | | | | EDTT | <-- |__________| <-- | | | BSim | __________ | | | transport | --> | | --> | | | | | Device 1 | | | | | <-- |__________| <-- | | | | | | | | <------------------- | | |___________| -------------------> | | | | BabbleSim | | | | ________ | | | | | | | low | ----------------------> | | | level | | | | device | <---------------------- | | |________| |_________________| ``` Each of the “-->” is a POSIX named pipe (FIFO) (which by default can buffer up to 64KB in each direction). The low level device (if enabled) is a BSim device in itself; It can be used to inject raw BLE packets without going through a BLE controller first. The transport has 2 main functions: * It allows reading and writting from the EDTT data to the appropriate device * It pauses the simulation while the EDTT is processing, so there is no asynchronous behaviour, and let's it advance only when desired (when wait() is called, or when a recv() cannot be completed instantenously The EDTT, will only run while the simulation itself is paused. The EDTT can interact in 3 ways with the devices and Phy: * When the EDTT writes to a device, that data is piped immediately to the device (without unblocking the simulation). * When the EDTT reads from the device, it tries to read from the device pipe immediately: * If it succeeds it responds to the caller immediately with the data * If there is not enough data yet from the device, it will wait `` in simulated time, that is, it will let the simulation time to advance by ``, and try again. (`` is a command line option, by default 10ms) * When the EDTT does `transport.wait(time)`, it tells the Phy to just let the simulation time go ahead for `