LibMuse 6.0.3
com.choosemuse.libmuse.MuseConnectionListener Class Referenceabstract

Public Member Functions

abstract void receiveMuseConnectionPacket (MuseConnectionPacket packet, Muse muse)

Detailed Description

Implement this interface to listen for changes to the current connection status (like connect/disconnect).

Important: DO NOT CALL Muse.connect()/ Muse.disconnect() directly from a connection listener handler. Either create a new thread and run it from there or use Muse.runAsynchronously() which creates a new thread implicitly.

Member Function Documentation

§ receiveMuseConnectionPacket()

abstract void com.choosemuse.libmuse.MuseConnectionListener.receiveMuseConnectionPacket ( MuseConnectionPacket  packet,
Muse  muse 

Called from the Muse connection thread whenever there is a change in the current connection status of the Muse

It is important that you do not perform any computation intensive tasks in this callback. This would result in significant delays in all the listener callbacks from being called. You should delegate any intensive tasks to another thread or schedule it to run with a delay through handler/scheduler for the platform.

However, you can register/unregister listeners in this callback. All previously registered listeners would still receive callbacks for this current event. On subsequent events, the newly registered listeners will be called. For example, if you had 2 listeners 'A' and 'B' for this event. If, on the callback for listener A, listener A unregisters all listeners and registers a new listener 'C' and then in the callback for listener 'B', you unregister all listeners again and register a new listener 'D'. Then on the subsequent event callback, only listener D's callback will be invoked.

packetThe connection packet
museThe Muse that sent the connection packet.

The documentation for this class was generated from the following file: