Compare commits

...

4 commits

8 changed files with 19 additions and 14 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
.cache/
build/
.godot/
demo/bin/libant.so

View file

@ -92,6 +92,11 @@ struct DeviceNumbers {
};
};
typedef uint16_t ChannelPeriod;
namespace ChannelPeriods {
static constexpr ChannelPeriod kBicyclePower = 8182;
static constexpr ChannelPeriod kHeartRate = 8070;
static constexpr ChannelPeriod kFitnessEquipment = 8192;
}
static constexpr DeviceNumber DeviceNumberWildcard = 0x00;

View file

@ -33,7 +33,7 @@ void Channel::_bind_methods() {
Channel::Channel() {
channel_config_.frequency = 57;
channel_config_.transmission_type = 0;
device_number_ = DeviceNumbers::Wildcard;
channel_config_.device_number = DeviceNumbers::Wildcard;
channel_ = 0;
}

View file

@ -91,9 +91,9 @@ protected:
state_ = _state;
}
void SetDeviceNumber(const DeviceNumber device_number) {
device_number_ = device_number;
channel_config_.device_number = device_number;
}
DeviceNumber GetDeviceNumber() const { return device_number_; }
DeviceNumber GetDeviceNumber() const { return channel_config_.device_number; }
void SetChannel(const ChannelNumber channel) { channel_ = channel; }
ChannelNumber GetChannel() const { return channel_; }
@ -112,7 +112,6 @@ protected:
// PROPERTIES
ChannelNumber channel_;
DeviceNumber device_number_;
private:
void Initialize();

View file

@ -22,7 +22,7 @@ FitnessEquipmentChannel::FitnessEquipmentChannel() {
channel_config_.type = ChannelTypes::kRX;
channel_config_.transmission_type = 0;
channel_config_.device_type = DeviceTypes::kFitnessEquipment;
channel_config_.channel_period = 8192;
channel_config_.channel_period = ChannelPeriods::kFitnessEquipment;
}
void FitnessEquipmentChannel::OnBroadcastData(

View file

@ -12,7 +12,7 @@ HeartRateChannel::HeartRateChannel() {
channel_config_.type = ChannelTypes::kRX;
channel_config_.transmission_type = 0;
channel_config_.device_type = DeviceTypes::kHeartRate;
channel_config_.channel_period = 8070;
channel_config_.channel_period = ChannelPeriods::kHeartRate;
}
void HeartRateChannel::OnBroadcastData(godot::Ref<BroadcastPayload> data) {
if (state_ != ChannelState::kConnected) {

View file

@ -23,7 +23,7 @@ PowerChannel::PowerChannel() {
channel_config_.frequency = 57;
channel_config_.transmission_type = 0;
channel_config_.device_type = DeviceTypes::kPower;
channel_config_.channel_period = 8182;
channel_config_.channel_period = ChannelPeriods::kBicyclePower;
}
void PowerChannel::OnBroadcastData(godot::Ref<BroadcastPayload> data) {
@ -33,12 +33,12 @@ void PowerChannel::OnBroadcastData(godot::Ref<BroadcastPayload> data) {
SetChannelState(ChannelState::kConnected);
msg::common::RequestChannelID msg(channel_);
SendBuffered(msg);
// bicycle_power::AdvancedCapabilities2 caps2;
// caps2.EnableAllDynamics();
// caps2.UnmaskAllDynamics();
// caps2.Enable8Hz();
// caps2.Unmask8Hz();
// SetAdvancedCapabilities2(caps2);
bicycle_power::AdvancedCapabilities2 caps2;
caps2.EnableAllDynamics();
caps2.UnmaskAllDynamics();
caps2.Enable8Hz();
caps2.Unmask8Hz();
SetAdvancedCapabilities2(caps2);
// bicycle_power::AdvancedCapabilities caps;
// RequestAdvancedCapabilities2();
// RequestAdvancedCapabilities1();

Binary file not shown.