Skip to content

Commit 923e170

Browse files
committed
Fix write_command function signature
1 parent a2848d9 commit 923e170

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

src/main/java/us/ihmc/abilityhand/AbilityHandBLEManager.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import us.ihmc.abilityhand.ble.SimpleBLE;
55
import us.ihmc.abilityhand.ble.SimpleBLE.libsimpleble.size_t;
66
import us.ihmc.abilityhand.ble.SimpleBLE.libsimpleble.uuid_t.ByValue;
7-
import us.ihmc.tools.nativelibraries.NativeLibraryDescription.OperatingSystem;
87

98
import java.util.HashMap;
109
import java.util.LinkedList;
@@ -67,14 +66,7 @@ private void consume() throws InterruptedException
6766
ByValue characteristicID = new ByValue();
6867
writeUUID(characteristicID, BLEUUID.ABILITY_HAND_TX_CHARACTERISTIC_ID);
6968

70-
if (SimpleBLE.getOS() == OperatingSystem.WIN64)
71-
{
72-
simpleBLE.writeRequest(handPeripheralPointer, serviceID, characteristicID, data, dataLength);
73-
}
74-
else if (SimpleBLE.getOS() == OperatingSystem.LINUX64)
75-
{
76-
simpleBLE.writeCommand(handPeripheralPointer, data, dataLength, serviceID, characteristicID);
77-
}
69+
simpleBLE.writeCommand(handPeripheralPointer, serviceID, characteristicID, data, dataLength);
7870
}
7971

8072
lock.unlock();

src/main/java/us/ihmc/abilityhand/ble/SimpleBLE.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ public interface libsimpleble extends Library
9797

9898
boolean simpleble_peripheral_connect(Pointer handle);
9999

100-
boolean simpleble_peripheral_write_command(Pointer handle, byte[] data, size_t length, uuid_t.ByValue service, uuid_t.ByValue characteristic);
100+
boolean simpleble_peripheral_write_command(Pointer handle, uuid_t.ByValue service, uuid_t.ByValue characteristic, byte[] data, size_t length);
101101

102-
boolean simpleble_peripheral_write_request(Pointer handle, uuid_t service, uuid_t characteristic, byte[] data, size_t length);
102+
boolean simpleble_peripheral_write_request(Pointer handle, uuid_t.ByValue service, uuid_t.ByValue characteristic, byte[] data, size_t length);
103103

104104
boolean simpleble_peripheral_services_get(Pointer handle, int index, service_t services);
105105

@@ -286,17 +286,17 @@ public boolean connectToPeripheral(Pointer peripheralHandle)
286286
}
287287

288288
public boolean writeCommand(Pointer peripheralHandle,
289-
byte[] data,
290-
libsimpleble.size_t length,
291289
libsimpleble.uuid_t.ByValue serviceUuid,
292-
libsimpleble.uuid_t.ByValue characteristicUuid)
290+
libsimpleble.uuid_t.ByValue characteristicUuid,
291+
byte[] data,
292+
libsimpleble.size_t length)
293293
{
294-
return libsimpleble.INSTANCE.simpleble_peripheral_write_command(peripheralHandle, data, length, serviceUuid, characteristicUuid);
294+
return libsimpleble.INSTANCE.simpleble_peripheral_write_command(peripheralHandle, serviceUuid, characteristicUuid, data, length);
295295
}
296296

297297
public boolean writeRequest(Pointer peripheralHandle,
298-
libsimpleble.uuid_t serviceUuid,
299-
libsimpleble.uuid_t characteristicUuid,
298+
libsimpleble.uuid_t.ByValue serviceUuid,
299+
libsimpleble.uuid_t.ByValue characteristicUuid,
300300
byte[] data,
301301
libsimpleble.size_t length)
302302
{

0 commit comments

Comments
 (0)