Sockets
After choosing the host and port on which to accept socket connections and enabling connectivity from the menu EntrainerFX will accept socket connections and send and receive state messages, acting on received messages as if generated by internal events. A simple interface has been provided to observe messages and to test this functionality.
In order to obtain the current state of EntrainerFX a request must be sent upon successful connection and must be the first message sent to EntrainerFX. Its form also determines whether XML or JSON is used for communication:
JSON Request State
{ "requestState" : true }
XML Request State
<entrainerStateMessage>
<requestState>true</requestState>
</entrainerStateMessage>
If using NIO sockets from the socket connector communication is performed using XML:
If using Web Sockets from the socket connector communication is performed using JSON:
More information about socket connectivity can be obtained from the class
net.sourceforge.entrainer.socket.EntrainerStateMessage
ESP Library Loading
EntrainerFX implements a dynamic library loading mechanism that the ESP subsystem uses to load the libraries included with EntrainerFX. Any implementation build upon the ESP architecture can be jar'd and placed in the ~/EntrainerFX-Settings/esp directory. On restart the library will appear in the ESP menu of EntrainerFX.
OpenBCI EEG
As of version 6.0.1 the OpenBCI ESP implementation is experimental. To use, edit the file ~/EntrainerFX-6.0.1/esp.config/esp.openbci.properties to reflect the hardware's connectivity settings. Any feedback on the OpenBCI ESP implementation is appreciated.
Animations
Animations are also dynamically loaded and new implementations can be jar'd and dropped into the ~/EntrainerFX-Settings/animation directory while EntrainerFX is running. Animations are groups of rectangles which on repaint can change size and position as the animation dictates and can respond to proximity to screen edges, each other and the main UI for EntrainerFX.
Logging
Logging is performed using the Logback framework. Logging is controlled by the file ~/EntrainerFX-6.0.1/logback/logback.xml and by default writes to the file ~/EntrainerFX-Settings/entrainerfx.log. Logging can be tailored by modifying logback.xml accordingly.