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;
162 void StartFullDiscovery(DiscoveryCompleteCallback *on_complete);
168 void StartIncrementalDiscovery(DiscoveryCompleteCallback *on_complete);
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;
201 DiscoveryCompleteCallback *m_on_complete;
203 std::queue<UID> m_uids_to_mute;
205 std::auto_ptr<DiscoveryTargetInterface::UnMuteDeviceCallback>
207 std::auto_ptr<DiscoveryTargetInterface::MuteDeviceCallback>
208 m_incremental_mute_callback;
209 std::auto_ptr<DiscoveryTargetInterface::MuteDeviceCallback>
210 m_branch_mute_callback;
211 std::auto_ptr<DiscoveryTargetInterface::BranchCallback> m_branch_callback;
214 UIDRanges m_uid_ranges;
216 unsigned int m_unmute_count;
217 unsigned int m_mute_attempts;
220 void InitDiscovery(DiscoveryCompleteCallback *on_complete,
223 void UnMuteComplete();
224 void MaybeMuteNextDevice();
225 void IncrementalMuteComplete(
bool status);
226 void SendDiscovery();
228 void BranchComplete(
const uint8_t *data,
unsigned int length);
229 void BranchMuteComplete(
bool status);
230 void HandleCollision();
231 void SplitAroundBadUID(
UID bad_uid);
232 void FreeCurrentRange();
234 static const unsigned int PREAMBLE_SIZE = 8;
235 static const unsigned int EUID_SIZE = 12;
236 static const unsigned int CHECKSUM_SIZE = 4;
242 static const unsigned int MAX_EMPTY_BRANCH_ATTEMPTS = 5;
247 static const unsigned int MAX_BRANCH_FAILURES = 5;
250 static const unsigned int MAX_MUTE_ATTEMPTS = 5;
253 static const unsigned int BROADCAST_UNMUTE_REPEATS = 3;
255 static const uint8_t PREAMBLE = 0xfe;
256 static const uint8_t PREAMBLE_SEPARATOR = 0xaa;
260 #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
virtual void UnMuteAll(UnMuteDeviceCallback *unmute_complete)=0
Unmute all devices.
A RDM unique identifier (UID).
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 asynchronous RDM Discovery algorithm.
Definition: DiscoveryAgent.h:135
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