29 #ifndef INCLUDE_OLA_RDM_DISCOVERYAGENT_H_
30 #define INCLUDE_OLA_RDM_DISCOVERYAGENT_H_
84 MuteDeviceCallback *mute_complete) = 0;
91 virtual void UnMuteAll(UnMuteDeviceCallback *unmute_complete) = 0;
175 UIDRange(
const UID &_lower,
const UID &_upper, UIDRange *_parent)
182 branch_corrupt(
false) {
187 unsigned int attempt;
188 unsigned int failures;
189 unsigned int uids_discovered;
193 typedef std::stack<UIDRange*> UIDRanges;
199 DiscoveryCompleteCallback *m_on_complete;
201 std::queue<UID> m_uids_to_mute;
203 std::auto_ptr<DiscoveryTargetInterface::UnMuteDeviceCallback>
205 std::auto_ptr<DiscoveryTargetInterface::MuteDeviceCallback>
206 m_incremental_mute_callback;
207 std::auto_ptr<DiscoveryTargetInterface::MuteDeviceCallback>
208 m_branch_mute_callback;
209 std::auto_ptr<DiscoveryTargetInterface::BranchCallback> m_branch_callback;
212 UIDRanges m_uid_ranges;
214 unsigned int m_unmute_count;
215 unsigned int m_mute_attempts;
218 void InitDiscovery(DiscoveryCompleteCallback *on_complete,
221 void UnMuteComplete();
222 void MaybeMuteNextDevice();
223 void IncrementalMuteComplete(
bool status);
224 void SendDiscovery();
226 void BranchComplete(
const uint8_t *data,
unsigned int length);
227 void BranchMuteComplete(
bool status);
228 void HandleCollision();
229 void FreeCurrentRange();
231 static const unsigned int PREAMBLE_SIZE = 8;
232 static const unsigned int EUID_SIZE = 12;
233 static const unsigned int CHECKSUM_SIZE = 4;
239 static const unsigned int MAX_EMPTY_BRANCH_ATTEMPTS = 5;
244 static const unsigned int MAX_BRANCH_FAILURES = 5;
247 static const unsigned int MAX_MUTE_ATTEMPTS = 5;
250 static const unsigned int BROADCAST_UNMUTE_REPEATS = 3;
252 static const uint8_t PREAMBLE = 0xfe;
253 static const uint8_t PREAMBLE_SEPARATOR = 0xaa;
257 #endif // INCLUDE_OLA_RDM_DISCOVERYAGENT_H_
Represents a set of RDM UIDs.
Definition: UIDSet.h:48
virtual void Branch(const UID &lower, const UID &upper, BranchCallback *callback)=0
Send a DUB command.
ola::BaseCallback2< void, const uint8_t *, unsigned int > BranchCallback
The callback run when a DUB command completes.
Definition: DiscoveryAgent.h:73
ola::BaseCallback1< void, bool > MuteDeviceCallback
The callback run when a mute command completes.
Definition: DiscoveryAgent.h:60
~DiscoveryAgent()
Destructor.
Definition: DiscoveryAgent.cpp:51
virtual void UnMuteAll(UnMuteDeviceCallback *unmute_complete)=0
Unmute all devices.
A RDM unique identifier (UID).
void Abort()
Cancel any in-progress discovery operation. If a discovery operation is running, this will result in ...
Definition: DiscoveryAgent.cpp:55
void StartIncrementalDiscovery(DiscoveryCompleteCallback *on_complete)
Initiate an incremental discovery operation.
Definition: DiscoveryAgent.cpp:75
void StartFullDiscovery(DiscoveryCompleteCallback *on_complete)
Initiate a full discovery operation.
Definition: DiscoveryAgent.cpp:70
ola::BaseCallback0< void > UnMuteDeviceCallback
The callback run when an unmute command completes.
Definition: DiscoveryAgent.h:65
virtual void MuteDevice(const UID &target, MuteDeviceCallback *mute_complete)=0
Mute a device.
The base class for all 1 argument callbacks.
Definition: Callback.h:982
An asyncronous RDM Discovery algorithm.
Definition: DiscoveryAgent.h:135
DiscoveryAgent(DiscoveryTargetInterface *target)
Create a new DiscoveryAgent.
Definition: DiscoveryAgent.cpp:34
Represents a RDM UID.
Definition: UID.h:57
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
The base class for all 2 argument callbacks.
Definition: Callback.h:1885
The interface used by the DiscoveryTarget to send RDM commands.
Definition: DiscoveryAgent.h:53
A 2 argument callback which deletes itself after it's run.
Definition: Callback.h:1907