Skip to content

Commit edff7f0

Browse files
committed
Add remove profile mechanism
1 parent 8b629f9 commit edff7f0

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/MainClasses/ANTPLUS_AntPlusRouter.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ void AntPlusRouter::setProfile(uint8_t channel, BaseProfile* profile) {
6868
profile->setRouter(this);
6969
}
7070

71+
void AntPlusRouter::removeProfile(uint8_t channel) {
72+
if (_profiles[channel]) {
73+
_profiles[channel]->stop();
74+
_profiles[channel]->setChannelNumber(0);
75+
_profiles[channel]->setRouter(NULL);
76+
_profiles[channel] = NULL;
77+
UnAssignChannel uc;
78+
uc.setChannel(channel);
79+
send(uc);
80+
}
81+
}
82+
7183
void AntPlusRouter::send(AntRequest& msg) {
7284
if (_ant) {
7385
_ant->send(msg);

src/MainClasses/ANTPLUS_AntPlusRouter.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ class AntPlusRouter {
2828
* Associates a profile with a channel
2929
*/
3030
void setProfile(uint8_t channel, BaseProfile* profile);
31+
/**
32+
* Stops a provile at the given channel
33+
* Unassigns channel
34+
* Removes the profile from index
35+
*/
36+
void removeProfile(uint8_t channel);
37+
/**
38+
* Send an ANT message to the associated router.
39+
* Do not use until a router has been associated.
40+
*/
3141
void send(AntRequest& msg);
3242
/**
3343
* Returns the maximum number of channels the radio

0 commit comments

Comments
 (0)