Compare commits
No commits in common. "b430f626c964541ca8e284f6e7ed39d7f44dd8ed" and "3542231987991ddbe0afedb9bc011f1711ad71ed" have entirely different histories.
b430f626c9
...
3542231987
8 changed files with 14 additions and 19 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,4 +1,3 @@
|
|||
.cache/
|
||||
build/
|
||||
.godot/
|
||||
demo/bin/libant.so
|
||||
|
|
|
|||
|
|
@ -92,11 +92,6 @@ 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;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ void Channel::_bind_methods() {
|
|||
Channel::Channel() {
|
||||
channel_config_.frequency = 57;
|
||||
channel_config_.transmission_type = 0;
|
||||
channel_config_.device_number = DeviceNumbers::Wildcard;
|
||||
device_number_ = DeviceNumbers::Wildcard;
|
||||
channel_ = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,9 +91,9 @@ protected:
|
|||
state_ = _state;
|
||||
}
|
||||
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; }
|
||||
ChannelNumber GetChannel() const { return channel_; }
|
||||
|
|
@ -112,6 +112,7 @@ protected:
|
|||
|
||||
// PROPERTIES
|
||||
ChannelNumber channel_;
|
||||
DeviceNumber device_number_;
|
||||
|
||||
private:
|
||||
void Initialize();
|
||||
|
|
|
|||
|
|
@ -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 = ChannelPeriods::kFitnessEquipment;
|
||||
channel_config_.channel_period = 8192;
|
||||
}
|
||||
|
||||
void FitnessEquipmentChannel::OnBroadcastData(
|
||||
|
|
|
|||
|
|
@ -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 = ChannelPeriods::kHeartRate;
|
||||
channel_config_.channel_period = 8070;
|
||||
}
|
||||
void HeartRateChannel::OnBroadcastData(godot::Ref<BroadcastPayload> data) {
|
||||
if (state_ != ChannelState::kConnected) {
|
||||
|
|
|
|||
|
|
@ -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 = ChannelPeriods::kBicyclePower;
|
||||
channel_config_.channel_period = 8182;
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
@ -47,7 +47,7 @@ void PowerChannel::OnBroadcastData(godot::Ref<BroadcastPayload> data) {
|
|||
// SetAdvancedCapabilities(caps);
|
||||
}
|
||||
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) {
|
||||
case PowerProfilePages::kBattery: {
|
||||
BatteryStatusMessage msg(BatteryStatusMessage::FromPayload(data->raw_data));
|
||||
|
|
|
|||
BIN
demo/bin/libant.so
Executable file
BIN
demo/bin/libant.so
Executable file
Binary file not shown.
Loading…
Reference in a new issue