Compare commits

..

No commits in common. "b430f626c964541ca8e284f6e7ed39d7f44dd8ed" and "3542231987991ddbe0afedb9bc011f1711ad71ed" have entirely different histories.

8 changed files with 14 additions and 19 deletions

1
.gitignore vendored
View file

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

View file

@ -92,11 +92,6 @@ struct DeviceNumbers {
}; };
}; };
typedef uint16_t ChannelPeriod; 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; static constexpr DeviceNumber DeviceNumberWildcard = 0x00;

View file

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

View file

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

View file

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

View file

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

View file

@ -23,7 +23,7 @@ PowerChannel::PowerChannel() {
channel_config_.frequency = 57; channel_config_.frequency = 57;
channel_config_.transmission_type = 0; channel_config_.transmission_type = 0;
channel_config_.device_type = DeviceTypes::kPower; channel_config_.device_type = DeviceTypes::kPower;
channel_config_.channel_period = ChannelPeriods::kBicyclePower; channel_config_.channel_period = 8182;
} }
void PowerChannel::OnBroadcastData(godot::Ref<BroadcastPayload> data) { void PowerChannel::OnBroadcastData(godot::Ref<BroadcastPayload> data) {
@ -33,12 +33,12 @@ void PowerChannel::OnBroadcastData(godot::Ref<BroadcastPayload> data) {
SetChannelState(ChannelState::kConnected); SetChannelState(ChannelState::kConnected);
msg::common::RequestChannelID msg(channel_); msg::common::RequestChannelID msg(channel_);
SendBuffered(msg); SendBuffered(msg);
bicycle_power::AdvancedCapabilities2 caps2; // bicycle_power::AdvancedCapabilities2 caps2;
caps2.EnableAllDynamics(); // caps2.EnableAllDynamics();
caps2.UnmaskAllDynamics(); // caps2.UnmaskAllDynamics();
caps2.Enable8Hz(); // caps2.Enable8Hz();
caps2.Unmask8Hz(); // caps2.Unmask8Hz();
SetAdvancedCapabilities2(caps2); // SetAdvancedCapabilities2(caps2);
// bicycle_power::AdvancedCapabilities caps; // bicycle_power::AdvancedCapabilities caps;
// RequestAdvancedCapabilities2(); // RequestAdvancedCapabilities2();
// RequestAdvancedCapabilities1(); // RequestAdvancedCapabilities1();
@ -47,7 +47,7 @@ void PowerChannel::OnBroadcastData(godot::Ref<BroadcastPayload> data) {
// SetAdvancedCapabilities(caps); // SetAdvancedCapabilities(caps);
} }
uint8_t page_number = data->raw_data[0]; uint8_t page_number = data->raw_data[0];
// printf("[channel %hu] received page: %hu\n", channel_, page_number); //printf("[channel %hu] received page: %hu\n", channel_, page_number);
switch (page_number) { switch (page_number) {
case PowerProfilePages::kBattery: { case PowerProfilePages::kBattery: {
BatteryStatusMessage msg(BatteryStatusMessage::FromPayload(data->raw_data)); BatteryStatusMessage msg(BatteryStatusMessage::FromPayload(data->raw_data));

BIN
demo/bin/libant.so Executable file

Binary file not shown.