Compare commits

...

2 Commits

Author SHA1 Message Date
rodolpheh 8a9caca7d1 Set getters to const in ultraleap 2023-12-08 09:08:05 +00:00
rodolpheh e46bc2e49f Fix missing EOL in server_namespace 2023-12-08 09:07:39 +00:00
2 changed files with 27 additions and 31 deletions

View File

@ -344,15 +344,16 @@ void UltraleapHandTracking::start() {
started = true;
LEAP_CONNECTION_CONFIG config;
LEAP_CONNECTION_CONFIG config = {0};
// Set connection to multi-device aware
memset(&config, 0, sizeof(config));
config.size = sizeof(config);
config.flags = eLeapConnectionConfig_MultiDeviceAware;
config.server_namespace = generate_connection_payload().utf8().get_data();
config.flags = (uint32_t)eLeapConnectionConfig_MultiDeviceAware;
if(connectionHandle || LeapCreateConnection(&config, &connectionHandle) == eLeapRS_Success) {
CharString server_namespace = generate_connection_payload().utf8();
config.server_namespace = server_namespace.get_data();
if (LeapCreateConnection(&config, &connectionHandle) == eLeapRS_Success) {
eLeapRS result = LeapOpenConnection(connectionHandle);
if(result == eLeapRS_Success) {
opened = true;
@ -494,7 +495,7 @@ void UltraleapHandTracking::serviceMessageLoop() {
is_running = false;
}
UltraleapTypes::TrackingMode UltraleapHandTracking::get_tracking_mode() {
UltraleapTypes::TrackingMode UltraleapHandTracking::get_tracking_mode() const {
if (primary_device == NULL) {
return UltraleapTypes::TrackingMode::Desktop;
}
@ -555,11 +556,11 @@ void UltraleapHandTracking::set_policy(UltraleapTypes::PolicyFlag flag, bool val
LeapSetPolicyFlags(connectionHandle, set_flags, clear_flags);
}
bool UltraleapHandTracking::get_images_policy() {
bool UltraleapHandTracking::get_images_policy() const {
return get_policy(UltraleapTypes::PolicyFlag::Images);
}
bool UltraleapHandTracking::get_policy(UltraleapTypes::PolicyFlag flag) {
bool UltraleapHandTracking::get_policy(UltraleapTypes::PolicyFlag flag) const {
return UltraleapTypes::read_policy_flag(policy_flags, flag);
}
@ -818,11 +819,11 @@ void UltraleapHandTracking::set_primary_device(Ref<UltraleapDevice> device) {
LeapSetPrimaryDevice(connectionHandle, device->device, false);
}
Ref<UltraleapDevice> UltraleapHandTracking::get_primary_device() {
Ref<UltraleapDevice> UltraleapHandTracking::get_primary_device() const {
return primary_device;
}
Ref<UltraleapFrame> UltraleapHandTracking::get_last_frame() {
Ref<UltraleapFrame> UltraleapHandTracking::get_last_frame() const {
if (primary_device == NULL) {
return NULL;
}
@ -830,7 +831,7 @@ Ref<UltraleapFrame> UltraleapHandTracking::get_last_frame() {
return primary_device->get_last_frame();
}
Ref<UltraleapImage> UltraleapHandTracking::get_left_image() {
Ref<UltraleapImage> UltraleapHandTracking::get_left_image() const {
if (primary_device == NULL) {
return NULL;
}
@ -838,7 +839,7 @@ Ref<UltraleapImage> UltraleapHandTracking::get_left_image() {
return primary_device->get_left_image();
}
Ref<UltraleapImage> UltraleapHandTracking::get_right_image() {
Ref<UltraleapImage> UltraleapHandTracking::get_right_image() const {
if (primary_device == NULL) {
return NULL;
}

View File

@ -35,11 +35,6 @@ public:
UltraleapTypes::TrackingMode default_tracking_mode = UltraleapTypes::TrackingMode::Desktop;
bool interpolate = true;
bool get_interpolate();
void set_interpolate(bool value);
Ref<UltraleapDeviceList> devices;
String service_ip = String("127.0.0.1");
@ -48,30 +43,30 @@ public:
bool autostart = true;
bool enable_images = true;
UltraleapTypes::TrackingMode get_tracking_mode();
UltraleapTypes::TrackingMode get_tracking_mode() const;
void set_tracking_mode(UltraleapTypes::TrackingMode value);
Ref<UltraleapFrame> get_last_frame();
Ref<UltraleapImage> get_left_image();
Ref<UltraleapImage> get_right_image();
Ref<UltraleapFrame> get_last_frame() const;
Ref<UltraleapImage> get_left_image() const;
Ref<UltraleapImage> get_right_image() const;
Array get_devices() { return devices->devices; }
Array get_devices() const { return devices->devices; }
void set_devices(Array value) { devices->devices = value; }
String get_service_ip() { return service_ip; }
String get_service_ip() const { return service_ip; }
void set_service_ip(String value) { service_ip = value; }
int get_service_port() { return service_port; }
int get_service_port() const { return service_port; }
void set_service_port(int value) { service_port = value; }
bool get_autostart() { return autostart; }
bool get_autostart() const { return autostart; }
void set_autostart(bool value) { autostart = value; }
bool get_enable_images() { return enable_images; }
bool get_enable_images() const { return enable_images; }
void set_enable_images(bool value) { enable_images = value; }
bool is_connected() { return connected; }
bool is_started() { return started; }
bool is_connected() const { return connected; }
bool is_started() const { return started; }
// Policy setters
void set_images_policy(bool value);
@ -81,11 +76,11 @@ public:
// Policy getters
// Only reimplementing the things we know do something
bool get_images_policy();
bool get_images_policy() const;
// Set and get primary device
void set_primary_device(Ref<UltraleapDevice> device);
Ref<UltraleapDevice> get_primary_device();
Ref<UltraleapDevice> get_primary_device() const;
void set_pause(bool value);
@ -122,7 +117,7 @@ private:
void handle_device_status_change_event(const LEAP_DEVICE_STATUS_CHANGE_EVENT* event, uint32_t device_id);
void set_policy(UltraleapTypes::PolicyFlag flag, bool value);
bool get_policy(UltraleapTypes::PolicyFlag flag);
bool get_policy(UltraleapTypes::PolicyFlag flag) const;
String generate_connection_payload();