import java.util.UUID;
+import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.bluetooth.BluetoothCharacteristic;
/**
* @author Connor Petty - Initial contribution
*
*/
+@NonNullByDefault
public class BlueGigaBluetoothCharacteristic extends BluetoothCharacteristic {
private boolean notifying;
import org.openhab.binding.bluetooth.BluetoothBindingConstants;
import org.openhab.binding.bluetooth.BluetoothCharacteristic;
import org.openhab.binding.bluetooth.BluetoothDescriptor;
-import org.openhab.binding.bluetooth.BluetoothDevice;
import org.openhab.binding.bluetooth.BluetoothException;
import org.openhab.binding.bluetooth.BluetoothService;
import org.openhab.binding.bluetooth.BluetoothUtils;
*/
@NonNullByDefault
public class BlueGigaBluetoothDevice extends BaseBluetoothDevice implements BlueGigaEventListener {
- private final long TIMEOUT_SEC = 60;
+ private static final long TIMEOUT_SEC = 60;
private final Logger logger = LoggerFactory.getLogger(BlueGigaBluetoothDevice.class);
characteristic.setService(service);
handleToCharacteristic.put(handle, characteristic);
} else {
+ @Nullable
Integer chrHandle = handleToCharacteristic.floorKey(handle);
if (chrHandle == null) {
logger.debug("BlueGiga: Unable to find characteristic for handle {}", handle);
return;
}
+ @Nullable
BlueGigaBluetoothCharacteristic characteristic = handleToCharacteristic.get(chrHandle);
- characteristic.addDescriptor(new BluetoothDescriptor(characteristic, attUUID, handle));
+ if (characteristic != null) {
+ characteristic.addDescriptor(new BluetoothDescriptor(characteristic, attUUID, handle));
+ }
}
}
} else {
// it must be one of the descriptors we need to update
UUID attUUID = handleToUUID.get(handle);
- BluetoothDescriptor descriptor = characteristic.getDescriptor(attUUID);
- notifyListeners(BluetoothEventType.DESCRIPTOR_UPDATED, descriptor,
- BluetoothUtils.toByteArray(event.getValue()));
+ if (attUUID != null) {
+ BluetoothDescriptor descriptor = characteristic.getDescriptor(attUUID);
+ notifyListeners(BluetoothEventType.DESCRIPTOR_UPDATED, descriptor,
+ BluetoothUtils.toByteArray(event.getValue()));
+ }
}
}
private final Logger logger = LoggerFactory.getLogger(BlueGigaBridgeHandler.class);
- private final int COMMAND_TIMEOUT_MS = 5000;
- private final int INITIALIZATION_INTERVAL_SEC = 60;
+ private static final int COMMAND_TIMEOUT_MS = 5000;
+ private static final int INITIALIZATION_INTERVAL_SEC = 60;
private final SerialPortManager serialPortManager;
@Override
public void dispose() {
- if (initTask != null) {
- initTask.cancel(true);
- initTask = null;
+ @Nullable
+ ScheduledFuture<?> task = initTask;
+ if (task != null) {
+ task.cancel(true);
+ task = null;
}
stop();
super.dispose();
}
private void cancelScheduledPassiveScan() {
- if (passiveScanIdleTimer != null) {
- passiveScanIdleTimer.cancel(true);
+ @Nullable
+ Future<?> scanTimer = passiveScanIdleTimer;
+ if (scanTimer != null) {
+ scanTimer.cancel(true);
}
}
private void stopScheduledTasks() {
cancelScheduledPassiveScan();
- if (removeInactiveDevicesTask != null) {
- removeInactiveDevicesTask.cancel(true);
- removeInactiveDevicesTask = null;
+ @Nullable
+ ScheduledFuture<?> removeTask = removeInactiveDevicesTask;
+ if (removeTask != null) {
+ removeTask.cancel(true);
+ removeTask = null;
}
- if (discoveryTask != null) {
- discoveryTask.cancel(true);
- discoveryTask = null;
+ @Nullable
+ ScheduledFuture<?> discoverTask = discoveryTask;
+ if (discoverTask != null) {
+ discoverTask.cancel(true);
+ discoverTask = null;
}
}
private static Logger logger = LoggerFactory.getLogger(BlueGigaResponsePackets.class);
- private static final Map<Integer, Class<?>> packetMap = new HashMap<>();
+ private static final Map<Integer, Class<?>> PACKETMAP = new HashMap<>();
static {
- packetMap.put(Objects.hash(0x00, 0x06, true), BlueGigaProtocolErrorEvent.class);
- packetMap.put(Objects.hash(0x00, 0x02, true), BlueGigaEndpointWatermarkRxEvent.class);
- packetMap.put(Objects.hash(0x00, 0x03, true), BlueGigaEndpointWatermarkTxEvent.class);
- packetMap.put(Objects.hash(0x00, 0x05, true), BlueGigaNoLicenseKeyEvent.class);
- packetMap.put(Objects.hash(0x04, 0x05, false), BlueGigaAttributeWriteResponse.class);
- packetMap.put(Objects.hash(0x04, 0x0A, false), BlueGigaExecuteWriteResponse.class);
- packetMap.put(Objects.hash(0x04, 0x00, false), BlueGigaFindByTypeValueResponse.class);
- packetMap.put(Objects.hash(0x04, 0x03, false), BlueGigaFindInformationResponse.class);
- packetMap.put(Objects.hash(0x04, 0x07, false), BlueGigaIndicateConfirmResponse.class);
- packetMap.put(Objects.hash(0x04, 0x09, false), BlueGigaPrepareWriteResponse.class);
- packetMap.put(Objects.hash(0x04, 0x01, false), BlueGigaReadByGroupTypeResponse.class);
- packetMap.put(Objects.hash(0x04, 0x04, false), BlueGigaReadByHandleResponse.class);
- packetMap.put(Objects.hash(0x04, 0x02, false), BlueGigaReadByTypeResponse.class);
- packetMap.put(Objects.hash(0x04, 0x08, false), BlueGigaReadLongResponse.class);
- packetMap.put(Objects.hash(0x04, 0x0B, false), BlueGigaReadMultipleResponse.class);
- packetMap.put(Objects.hash(0x04, 0x06, false), BlueGigaWriteCommandResponse.class);
- packetMap.put(Objects.hash(0x04, 0x01, true), BlueGigaProcedureCompletedEvent.class);
- packetMap.put(Objects.hash(0x04, 0x05, true), BlueGigaAttributeValueEvent.class);
- packetMap.put(Objects.hash(0x04, 0x04, true), BlueGigaFindInformationFoundEvent.class);
- packetMap.put(Objects.hash(0x04, 0x02, true), BlueGigaGroupFoundEvent.class);
- packetMap.put(Objects.hash(0x04, 0x00, true), BlueGigaIndicatedEvent.class);
- packetMap.put(Objects.hash(0x04, 0x00, true), BlueGigaReadMultipleResponseEvent.class);
- packetMap.put(Objects.hash(0x02, 0x01, false), BlueGigaReadResponse.class);
- packetMap.put(Objects.hash(0x02, 0x02, false), BlueGigaReadTypeResponse.class);
- packetMap.put(Objects.hash(0x02, 0x02, false), BlueGigaSendAttributesResponse.class);
- packetMap.put(Objects.hash(0x02, 0x03, false), BlueGigaUserReadResponseResponse.class);
- packetMap.put(Objects.hash(0x02, 0x04, false), BlueGigaUserWriteResponseResponse.class);
- packetMap.put(Objects.hash(0x02, 0x00, false), BlueGigaWriteResponse.class);
- packetMap.put(Objects.hash(0x02, 0x02, true), BlueGigaAttributeStatusEvent.class);
- packetMap.put(Objects.hash(0x02, 0x01, true), BlueGigaUserReadRequestEvent.class);
- packetMap.put(Objects.hash(0x02, 0x00, true), BlueGigaValueEvent.class);
- packetMap.put(Objects.hash(0x03, 0x04, false), BlueGigaChannelMapGetResponse.class);
- packetMap.put(Objects.hash(0x03, 0x00, false), BlueGigaDisconnectResponse.class);
- packetMap.put(Objects.hash(0x03, 0x01, false), BlueGigaGetRssiResponse.class);
- packetMap.put(Objects.hash(0x03, 0x07, false), BlueGigaGetStatusResponse.class);
- packetMap.put(Objects.hash(0x03, 0x02, false), BlueGigaUpdateResponse.class);
- packetMap.put(Objects.hash(0x03, 0x04, true), BlueGigaDisconnectedEvent.class);
- packetMap.put(Objects.hash(0x03, 0x02, true), BlueGigaFeatureIndEvent.class);
- packetMap.put(Objects.hash(0x03, 0x00, true), BlueGigaConnectionStatusEvent.class);
- packetMap.put(Objects.hash(0x03, 0x01, true), BlueGigaVersionIndEvent.class);
- packetMap.put(Objects.hash(0x06, 0x07, false), BlueGigaSetScanParametersResponse.class);
- packetMap.put(Objects.hash(0x06, 0x03, false), BlueGigaConnectDirectResponse.class);
- packetMap.put(Objects.hash(0x06, 0x05, false), BlueGigaConnectSelectiveResponse.class);
- packetMap.put(Objects.hash(0x06, 0x02, false), BlueGigaDiscoverResponse.class);
- packetMap.put(Objects.hash(0x06, 0x08, false), BlueGigaSetAdvParametersResponse.class);
- packetMap.put(Objects.hash(0x06, 0x09, false), BlueGigaSetAdvDataResponse.class);
- packetMap.put(Objects.hash(0x06, 0x04, false), BlueGigaEndProcedureResponse.class);
- packetMap.put(Objects.hash(0x06, 0x01, false), BlueGigaSetModeResponse.class);
- packetMap.put(Objects.hash(0x06, 0x00, true), BlueGigaScanResponseEvent.class);
- packetMap.put(Objects.hash(0x05, 0x02, false), BlueGigaDeleteBondingResponse.class);
- packetMap.put(Objects.hash(0x05, 0x00, false), BlueGigaEncryptStartResponse.class);
- packetMap.put(Objects.hash(0x05, 0x05, false), BlueGigaGetBondsResponse.class);
- packetMap.put(Objects.hash(0x05, 0x04, false), BlueGigaPassKeyResponse.class);
- packetMap.put(Objects.hash(0x05, 0x01, false), BlueGigaSetBondableModeResponse.class);
- packetMap.put(Objects.hash(0x05, 0x03, false), BlueGigaSetParametersResponse.class);
- packetMap.put(Objects.hash(0x05, 0x07, false), BlueGigaWhitelistBondsResponse.class);
- packetMap.put(Objects.hash(0x00, 0x0A, false), BlueGigaWhitelistAppendResponse.class);
- packetMap.put(Objects.hash(0x00, 0x0B, false), BlueGigaWhitelistRemoveResponse.class);
- packetMap.put(Objects.hash(0x00, 0x0C, false), BlueGigaWhitelistClearResponse.class);
- packetMap.put(Objects.hash(0x05, 0x01, true), BlueGigaBondingFailEvent.class);
- packetMap.put(Objects.hash(0x05, 0x04, true), BlueGigaBondStatusEvent.class);
- packetMap.put(Objects.hash(0x05, 0x02, true), BlueGigaPasskeyDisplayEvent.class);
- packetMap.put(Objects.hash(0x05, 0x03, true), BlueGigaPasskeyRequestEvent.class);
- packetMap.put(Objects.hash(0x00, 0x02, false), BlueGigaAddressGetResponse.class);
- packetMap.put(Objects.hash(0x00, 0x01, false), BlueGigaHelloResponse.class);
- packetMap.put(Objects.hash(0x00, 0x00, false), BlueGigaResetResponse.class);
- packetMap.put(Objects.hash(0x00, 0x06, false), BlueGigaGetConnectionsResponse.class);
- packetMap.put(Objects.hash(0x00, 0x05, false), BlueGigaGetCountersResponse.class);
- packetMap.put(Objects.hash(0x00, 0x08, false), BlueGigaGetInfoResponse.class);
- packetMap.put(Objects.hash(0x00, 0x00, true), BlueGigaBootEvent.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x06, true), BlueGigaProtocolErrorEvent.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x02, true), BlueGigaEndpointWatermarkRxEvent.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x03, true), BlueGigaEndpointWatermarkTxEvent.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x05, true), BlueGigaNoLicenseKeyEvent.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x05, false), BlueGigaAttributeWriteResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x0A, false), BlueGigaExecuteWriteResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x00, false), BlueGigaFindByTypeValueResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x03, false), BlueGigaFindInformationResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x07, false), BlueGigaIndicateConfirmResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x09, false), BlueGigaPrepareWriteResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x01, false), BlueGigaReadByGroupTypeResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x04, false), BlueGigaReadByHandleResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x02, false), BlueGigaReadByTypeResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x08, false), BlueGigaReadLongResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x0B, false), BlueGigaReadMultipleResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x06, false), BlueGigaWriteCommandResponse.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x01, true), BlueGigaProcedureCompletedEvent.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x05, true), BlueGigaAttributeValueEvent.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x04, true), BlueGigaFindInformationFoundEvent.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x02, true), BlueGigaGroupFoundEvent.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x00, true), BlueGigaIndicatedEvent.class);
+ PACKETMAP.put(Objects.hash(0x04, 0x00, true), BlueGigaReadMultipleResponseEvent.class);
+ PACKETMAP.put(Objects.hash(0x02, 0x01, false), BlueGigaReadResponse.class);
+ PACKETMAP.put(Objects.hash(0x02, 0x02, false), BlueGigaReadTypeResponse.class);
+ PACKETMAP.put(Objects.hash(0x02, 0x02, false), BlueGigaSendAttributesResponse.class);
+ PACKETMAP.put(Objects.hash(0x02, 0x03, false), BlueGigaUserReadResponseResponse.class);
+ PACKETMAP.put(Objects.hash(0x02, 0x04, false), BlueGigaUserWriteResponseResponse.class);
+ PACKETMAP.put(Objects.hash(0x02, 0x00, false), BlueGigaWriteResponse.class);
+ PACKETMAP.put(Objects.hash(0x02, 0x02, true), BlueGigaAttributeStatusEvent.class);
+ PACKETMAP.put(Objects.hash(0x02, 0x01, true), BlueGigaUserReadRequestEvent.class);
+ PACKETMAP.put(Objects.hash(0x02, 0x00, true), BlueGigaValueEvent.class);
+ PACKETMAP.put(Objects.hash(0x03, 0x04, false), BlueGigaChannelMapGetResponse.class);
+ PACKETMAP.put(Objects.hash(0x03, 0x00, false), BlueGigaDisconnectResponse.class);
+ PACKETMAP.put(Objects.hash(0x03, 0x01, false), BlueGigaGetRssiResponse.class);
+ PACKETMAP.put(Objects.hash(0x03, 0x07, false), BlueGigaGetStatusResponse.class);
+ PACKETMAP.put(Objects.hash(0x03, 0x02, false), BlueGigaUpdateResponse.class);
+ PACKETMAP.put(Objects.hash(0x03, 0x04, true), BlueGigaDisconnectedEvent.class);
+ PACKETMAP.put(Objects.hash(0x03, 0x02, true), BlueGigaFeatureIndEvent.class);
+ PACKETMAP.put(Objects.hash(0x03, 0x00, true), BlueGigaConnectionStatusEvent.class);
+ PACKETMAP.put(Objects.hash(0x03, 0x01, true), BlueGigaVersionIndEvent.class);
+ PACKETMAP.put(Objects.hash(0x06, 0x07, false), BlueGigaSetScanParametersResponse.class);
+ PACKETMAP.put(Objects.hash(0x06, 0x03, false), BlueGigaConnectDirectResponse.class);
+ PACKETMAP.put(Objects.hash(0x06, 0x05, false), BlueGigaConnectSelectiveResponse.class);
+ PACKETMAP.put(Objects.hash(0x06, 0x02, false), BlueGigaDiscoverResponse.class);
+ PACKETMAP.put(Objects.hash(0x06, 0x08, false), BlueGigaSetAdvParametersResponse.class);
+ PACKETMAP.put(Objects.hash(0x06, 0x09, false), BlueGigaSetAdvDataResponse.class);
+ PACKETMAP.put(Objects.hash(0x06, 0x04, false), BlueGigaEndProcedureResponse.class);
+ PACKETMAP.put(Objects.hash(0x06, 0x01, false), BlueGigaSetModeResponse.class);
+ PACKETMAP.put(Objects.hash(0x06, 0x00, true), BlueGigaScanResponseEvent.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x02, false), BlueGigaDeleteBondingResponse.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x00, false), BlueGigaEncryptStartResponse.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x05, false), BlueGigaGetBondsResponse.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x04, false), BlueGigaPassKeyResponse.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x01, false), BlueGigaSetBondableModeResponse.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x03, false), BlueGigaSetParametersResponse.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x07, false), BlueGigaWhitelistBondsResponse.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x0A, false), BlueGigaWhitelistAppendResponse.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x0B, false), BlueGigaWhitelistRemoveResponse.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x0C, false), BlueGigaWhitelistClearResponse.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x01, true), BlueGigaBondingFailEvent.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x04, true), BlueGigaBondStatusEvent.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x02, true), BlueGigaPasskeyDisplayEvent.class);
+ PACKETMAP.put(Objects.hash(0x05, 0x03, true), BlueGigaPasskeyRequestEvent.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x02, false), BlueGigaAddressGetResponse.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x01, false), BlueGigaHelloResponse.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x00, false), BlueGigaResetResponse.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x06, false), BlueGigaGetConnectionsResponse.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x05, false), BlueGigaGetCountersResponse.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x08, false), BlueGigaGetInfoResponse.class);
+ PACKETMAP.put(Objects.hash(0x00, 0x00, true), BlueGigaBootEvent.class);
}
- @SuppressWarnings({ "null", "unused" })
@Nullable
public static BlueGigaResponse getPacket(int[] data) {
int cmdClass = data[2];
int cmdMethod = data[3];
boolean isEvent = (data[0] & 0x80) != 0;
- Class<?> bleClass = packetMap.get(Objects.hash(cmdClass, cmdMethod, isEvent));
+ Class<?> bleClass = PACKETMAP.get(Objects.hash(cmdClass, cmdMethod, isEvent));
if (bleClass == null) {
return null;
}
private void cancelTransactionTimer() {
- if (transactionTimeoutTimer != null) {
- transactionTimeoutTimer.cancel(true);
- transactionTimeoutTimer = null;
+ @Nullable
+ Future<?> transTimer = transactionTimeoutTimer;
+ if (transTimer != null) {
+ transTimer.cancel(true);
+ transTimer = null;
}
}
});
}
- @SuppressWarnings({ "null", "unused" })
private Optional<BlueGigaUniqueCommand> getNextFrame() {
while (!sendQueue.isEmpty()) {
+ @Nullable
BlueGigaUniqueCommand frame = sendQueue.poll();
if (frame != null) {
- if (frame.getMessage() != null) {
- return Optional.of(frame);
- } else {
- logger.debug("Null message found from queue, skip it");
- continue;
- }
+ return Optional.of(frame);
} else {
logger.debug("Null frame found from queue, skip it");
continue;
*/
@NonNullByDefault
public class BlueGigaAttributeValueEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x05;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x05;
/**
* Attribute handle
*/
@NonNullByDefault
public class BlueGigaAttributeWriteCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x05;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x05;
private BlueGigaAttributeWriteCommand(CommandBuilder builder) {
super.setConnection(builder.connection);
*/
@NonNullByDefault
public class BlueGigaAttributeWriteResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x05;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x05;
/**
* 0 : write was successful. Otherwise error occurred
*/
@NonNullByDefault
public class BlueGigaExecuteWriteCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x0A;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x0A;
/**
* 1: commits queued writes, 0: cancels queued writes
*/
@NonNullByDefault
public class BlueGigaExecuteWriteResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x0A;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x0A;
/**
* 0 : write was successful. Otherwise error occurred
*/
@NonNullByDefault
public class BlueGigaFindByTypeValueCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x00;
/**
* First requested handle number
*/
@NonNullByDefault
public class BlueGigaFindByTypeValueResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x00;
/**
* 0 : the operation was successful. Otherwise error occurred
*/
@NonNullByDefault
public class BlueGigaFindInformationCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x03;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x03;
private BlueGigaFindInformationCommand(CommandBuilder builder) {
super.setConnection(builder.connection);
*/
@NonNullByDefault
public class BlueGigaFindInformationFoundEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x04;
/**
* Characteristics handle
*/
@NonNullByDefault
public class BlueGigaFindInformationResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x03;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x03;
/**
* 0 : the operation was successful. Otherwise error occurred
*/
@NonNullByDefault
public class BlueGigaGroupFoundEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x02;
/**
* Starting handle
*/
@NonNullByDefault
public class BlueGigaIndicateConfirmCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x07;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x07;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaIndicateConfirmResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x07;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x07;
/**
* Command result.
*/
@NonNullByDefault
public class BlueGigaIndicatedEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x00;
/**
* Attribute handle
*/
@NonNullByDefault
public class BlueGigaPrepareWriteCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x09;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x09;
/**
* Attribute handle
*/
@NonNullByDefault
public class BlueGigaPrepareWriteResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x09;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x09;
/**
* Command result.
*/
@NonNullByDefault
public class BlueGigaProcedureCompletedEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x01;
/**
* 0: The operation was successful. Otherwise: attribute protocol error code returned by
*/
@NonNullByDefault
public class BlueGigaReadByGroupTypeCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x01;
private BlueGigaReadByGroupTypeCommand(CommandBuilder builder) {
super.setConnection(builder.connection);
*/
@NonNullByDefault
public class BlueGigaReadByGroupTypeResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x01;
/**
* Command result.
*/
@NonNullByDefault
public class BlueGigaReadByHandleCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x04;
private BlueGigaReadByHandleCommand(CommandBuilder builder) {
super.setConnection(builder.connection);
*/
@NonNullByDefault
public class BlueGigaReadByHandleResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x04;
/**
* 0 : the command was successful. Otherwise an error occurred
*/
@NonNullByDefault
public class BlueGigaReadByTypeCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x02;
/**
* First attribute handle
*/
@NonNullByDefault
public class BlueGigaReadByTypeResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x02;
/**
* 0 : the command was successful. Otherwise an error occurred
*/
@NonNullByDefault
public class BlueGigaReadLongCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x08;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x08;
/**
* Attribute handle
*/
@NonNullByDefault
public class BlueGigaReadLongResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x08;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x08;
/**
* 0 : the command was successful. Otherwise an error occurred
*/
@NonNullByDefault
public class BlueGigaReadMultipleCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x0B;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x0B;
/**
* List of attribute handles to read from the remote device
*/
@NonNullByDefault
public class BlueGigaReadMultipleResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x0B;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x0B;
/**
* 0 : the command was successful. Otherwise an error occurred
*/
@NonNullByDefault
public class BlueGigaReadMultipleResponseEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x00;
/**
* This array contains the concatenated data from the multiple attributes that have been read,
*/
@NonNullByDefault
public class BlueGigaWriteCommandCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x06;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x06;
/**
* Attribute handle to write
*/
@NonNullByDefault
public class BlueGigaWriteCommandResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x04;
- public static int COMMAND_METHOD = 0x06;
+ public static final int COMMAND_CLASS = 0x04;
+ public static final int COMMAND_METHOD = 0x06;
/**
* 0 : the command was successful. Otherwise an error occurred
*/
@NonNullByDefault
public class BlueGigaAttributeStatusEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x02;
/**
* Attribute handle
*/
@NonNullByDefault
public class BlueGigaReadCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x01;
/**
* Handle of the attribute to read
*/
@NonNullByDefault
public class BlueGigaReadResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x01;
/**
* Handle of the attribute which was read
*/
@NonNullByDefault
public class BlueGigaReadTypeCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x02;
/**
* Handle of the attribute to read
*/
@NonNullByDefault
public class BlueGigaReadTypeResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x02;
/**
* Handle of the attribute which was read
*/
@NonNullByDefault
public class BlueGigaSendAttributesCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x02;
/**
* Attribute handle to send.
*/
@NonNullByDefault
public class BlueGigaSendAttributesResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x02;
/**
* 0 : the command was successful. Otherwise an error occurred
*/
@NonNullByDefault
public class BlueGigaUserReadRequestEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x01;
/**
* Attribute handle requested
*/
@NonNullByDefault
public class BlueGigaUserReadResponseCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x03;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x03;
/**
* 0: User Read Request is responded with data. In case of an error an application specific error
*/
@NonNullByDefault
public class BlueGigaUserReadResponseResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x03;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x03;
/**
* Response constructor
*/
@NonNullByDefault
public class BlueGigaUserWriteResponseCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x04;
/**
* 0: User Read Request is responded with data. In case of an error an application specific error
*/
@NonNullByDefault
public class BlueGigaUserWriteResponseResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x04;
/**
* Response constructor
*/
@NonNullByDefault
public class BlueGigaValueEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x00;
/**
* Reason why value has changed see: enum Attribute Change Reason
*/
@NonNullByDefault
public class BlueGigaWriteCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x00;
/**
* Handle of the attribute to write.
*/
@NonNullByDefault
public class BlueGigaWriteResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x02;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x02;
+ public static final int COMMAND_METHOD = 0x00;
/**
* 0: the write was successful. Non-zero: An error occurred
*/
@NonNullByDefault
public class BlueGigaChannelMapGetCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x04;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaChannelMapGetResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x04;
/**
* Current Channel Map. Each bit corresponds to one channel. 0-bit corresponds to 0 channel.
*/
@NonNullByDefault
public class BlueGigaConnectionStatusEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x00;
/**
* Connection status flags use connstatus-enumerator
*/
@NonNullByDefault
public class BlueGigaDisconnectCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x00;
private BlueGigaDisconnectCommand(CommandBuilder builder) {
super.setConnection(builder.connection);
*/
@NonNullByDefault
public class BlueGigaDisconnectResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x00;
/**
* 0 : the update was successful. Non-zero: An error occurred.
*/
@NonNullByDefault
public class BlueGigaDisconnectedEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x04;
/**
* Disconnection reason code. 0 : disconnected by local user
*/
@NonNullByDefault
public class BlueGigaFeatureIndEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x02;
/**
* CtrData field from LL_FEATURE_RSP - packet
*/
@NonNullByDefault
public class BlueGigaGetRssiCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x01;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaGetRssiResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x01;
/**
* RSSI value of the connection in dBm. Range: -103 to -38
*/
@NonNullByDefault
public class BlueGigaGetStatusCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x07;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x07;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaGetStatusResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x07;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x07;
/**
* Response constructor
*/
@NonNullByDefault
public class BlueGigaUpdateCommand extends BlueGigaDeviceCommand {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x02;
/**
* Minimum connection interval (units of 1.25ms)
*/
@NonNullByDefault
public class BlueGigaUpdateResponse extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x02;
/**
* 0 : the update was successful. Non-zero: An error occurred.
*/
@NonNullByDefault
public class BlueGigaVersionIndEvent extends BlueGigaDeviceResponse {
- public static int COMMAND_CLASS = 0x03;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x03;
+ public static final int COMMAND_METHOD = 0x01;
/**
* Bluetooth controller specification version
*/
@NonNullByDefault
public class BlueGigaConnectDirectCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x03;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x03;
private BlueGigaConnectDirectCommand(CommandBuilder builder) {
this.address = builder.address;
*/
@NonNullByDefault
public class BlueGigaConnectDirectResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x03;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x03;
/**
* 0 : procedure was successfully started Non-zero: An error occurred
*/
@NonNullByDefault
public class BlueGigaConnectSelectiveCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x05;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x05;
/**
* Minimum Connection Interval (in units of 1.25ms). Range: 6 - 3200 The lowest possible
*/
@NonNullByDefault
public class BlueGigaConnectSelectiveResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x05;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x05;
/**
* 0 : procedure was successfully started Non-zero: An error occurred
*/
@NonNullByDefault
public class BlueGigaDiscoverCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x02;
private BlueGigaDiscoverCommand(CommandBuilder builder) {
this.mode = builder.mode;
*/
@NonNullByDefault
public class BlueGigaDiscoverResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x02;
/**
* 0: Scan procedure was successfully started Non-zero: An error occurred.
*/
@NonNullByDefault
public class BlueGigaEndProcedureCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x04;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaEndProcedureResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x04;
/**
* 0: the command was successful. Non-zero: An error occurred
*/
@NonNullByDefault
public class BlueGigaScanResponseEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x00;
/**
* RSSI value (dBm). Range: -103 to -38
*/
@NonNullByDefault
public class BlueGigaSetAdvDataCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x09;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x09;
/**
* Advertisement data type. 0 : sets advertisement data. 1 : sets scan response data
*/
@NonNullByDefault
public class BlueGigaSetAdvDataResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x09;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x09;
/**
* 0: Command was successfully executed. Non-zero: An error occurred
*/
@NonNullByDefault
public class BlueGigaSetAdvParametersCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x08;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x08;
/**
* Minimum advertisement interval in units of 625us. Range: 0x20 to 0x4000. Default: 0x200
*/
@NonNullByDefault
public class BlueGigaSetAdvParametersResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x08;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x08;
/**
* 0: Command was successfully executed. Non-zero: An error occurred
*/
@NonNullByDefault
public class BlueGigaSetModeCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x01;
private BlueGigaSetModeCommand(CommandBuilder builder) {
this.discover = builder.discover;
*/
@NonNullByDefault
public class BlueGigaSetModeResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x01;
/**
* 0: the command was successful. Non-zero: An error occurred
*/
@NonNullByDefault
public class BlueGigaSetScanParametersCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x07;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x07;
private BlueGigaSetScanParametersCommand(CommandBuilder builder) {
this.scanInterval = builder.scanInterval;
*/
@NonNullByDefault
public class BlueGigaSetScanParametersResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x06;
- public static int COMMAND_METHOD = 0x07;
+ public static final int COMMAND_CLASS = 0x06;
+ public static final int COMMAND_METHOD = 0x07;
/**
* 0: The command was executed successfully. Non-zero: An error occurred
*/
@NonNullByDefault
public class BlueGigaBondStatusEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x04;
/**
* Bonding handle
*/
@NonNullByDefault
public class BlueGigaBondingFailEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x01;
/**
* Connection handle
*/
@NonNullByDefault
public class BlueGigaDeleteBondingCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x02;
/**
* Bonding handle of a device. This handle can be obtained for example from events like: Scan
*/
@NonNullByDefault
public class BlueGigaDeleteBondingResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x02;
/**
* 0: the command was successful. Non-zero: An error occurred
*/
@NonNullByDefault
public class BlueGigaEncryptStartCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x00;
/**
* Bonding handle of a device. This handle can be obtained for example from events like: Scan
*/
@NonNullByDefault
public class BlueGigaEncryptStartResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x00;
/**
* Connection handle
*/
@NonNullByDefault
public class BlueGigaGetBondsCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x05;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x05;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaGetBondsResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x05;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x05;
/**
* Num of currently bonded devices
*/
@NonNullByDefault
public class BlueGigaPassKeyCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x04;
/**
* Connection handle
*/
@NonNullByDefault
public class BlueGigaPassKeyResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x04;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x04;
/**
* Command Result
*/
@NonNullByDefault
public class BlueGigaPasskeyDisplayEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x02;
/**
* Bluetooth connection handle
*/
@NonNullByDefault
public class BlueGigaPasskeyRequestEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x03;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x03;
/**
* Bluetooth connection handle
*/
@NonNullByDefault
public class BlueGigaSetBondableModeCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x01;
/**
* Enables or disables bonding mode. 0 : the device is not bondable. 1 : the device is bondable
*/
@NonNullByDefault
public class BlueGigaSetBondableModeResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x01;
/**
* Response constructor
*/
@NonNullByDefault
public class BlueGigaSetParametersCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x03;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x03;
/**
* 1: Man-in-the-middle protection required. 0: No Man-in-the-middle protection. Default:
*/
@NonNullByDefault
public class BlueGigaSetParametersResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x03;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x03;
/**
* Response constructor
*/
@NonNullByDefault
public class BlueGigaWhitelistBondsCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x07;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x07;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaWhitelistBondsResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x05;
- public static int COMMAND_METHOD = 0x07;
+ public static final int COMMAND_CLASS = 0x05;
+ public static final int COMMAND_METHOD = 0x07;
/**
* Command result
*/
@NonNullByDefault
public class BlueGigaAddressGetCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x02;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaAddressGetResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x02;
/**
* Bluetooth address of the local device
*/
@NonNullByDefault
public class BlueGigaBootEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x00;
/**
* Major software version
*/
@NonNullByDefault
public class BlueGigaEndpointWatermarkRxEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x02;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x02;
/**
* Endpoint index where data was received
*/
@NonNullByDefault
public class BlueGigaEndpointWatermarkTxEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x03;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x03;
/**
* Endpoint index where data was sent
*/
@NonNullByDefault
public class BlueGigaGetConnectionsCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x06;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x06;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaGetConnectionsResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x06;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x06;
/**
* Max supported connections
*/
@NonNullByDefault
public class BlueGigaGetCountersCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x05;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x05;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaGetCountersResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x05;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x05;
/**
* Number of transmitted packets
*/
@NonNullByDefault
public class BlueGigaGetInfoCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x08;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x08;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaGetInfoResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x08;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x08;
/**
* Major software version
*/
@NonNullByDefault
public class BlueGigaHelloCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x01;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaHelloResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x01;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x01;
/**
* Response constructor
*/
@NonNullByDefault
public class BlueGigaNoLicenseKeyEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x05;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x05;
/**
* Event constructor
*/
@NonNullByDefault
public class BlueGigaProtocolErrorEvent extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x06;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x06;
/**
* Reason for failure
*/
@NonNullByDefault
public class BlueGigaResetCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x00;
/**
* Selects the boot mode. 0 : boot to main program. 1 : boot to DFU
*/
@NonNullByDefault
public class BlueGigaResetResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x00;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x00;
/**
* Response constructor
*/
@NonNullByDefault
public class BlueGigaWhitelistAppendCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x0A;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x0A;
/**
* Bluetooth device address to add to the running white list. Maximum of 8 can be stored before
*/
@NonNullByDefault
public class BlueGigaWhitelistAppendResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x0A;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x0A;
/**
* Command result
*/
@NonNullByDefault
public class BlueGigaWhitelistClearCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x0C;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x0C;
@Override
public int[] serialize() {
*/
@NonNullByDefault
public class BlueGigaWhitelistClearResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x0C;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x0C;
/**
* Response constructor
*/
@NonNullByDefault
public class BlueGigaWhitelistRemoveCommand extends BlueGigaCommand {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x0B;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x0B;
/**
* Bluetooth device address to remove from the running white list.
*/
@NonNullByDefault
public class BlueGigaWhitelistRemoveResponse extends BlueGigaResponse {
- public static int COMMAND_CLASS = 0x00;
- public static int COMMAND_METHOD = 0x0B;
+ public static final int COMMAND_CLASS = 0x00;
+ public static final int COMMAND_METHOD = 0x0B;
/**
* Command result
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Assigned numbers are used in GAP for inquiry response, EIR data type values, manufacturer-specific data, advertising
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, EirDataType> codeMapping = new HashMap<>();
+ private static @Nullable Map<Integer, EirDataType> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- for (EirDataType s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param bluetoothAddressType
* the code to lookup
* @return enumeration value.
*/
- @SuppressWarnings({ "null", "unused" })
public static EirDataType getEirPacketType(int eirDataType) {
- if (codeMapping.isEmpty()) {
- initMapping();
+ Map<Integer, EirDataType> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (EirDataType s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.getOrDefault(eirDataType, UNKNOWN);
+ return localCodeMapping.getOrDefault(eirDataType, UNKNOWN);
}
/**
import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Definition of the EIR Flags field
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, EirFlags> codeMapping = new HashMap<>();
+ private static @Nullable Map<Integer, EirFlags> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (EirFlags s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param bluetoothAddressType
* the code to lookup
* @return enumeration value.
*/
- @SuppressWarnings({ "null", "unused" })
public static EirFlags getEirFlag(int eirFlag) {
- if (codeMapping.isEmpty()) {
- initMapping();
+ Map<Integer, EirFlags> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (EirFlags s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.getOrDefault(eirFlag, UNKNOWN);
+ return localCodeMapping.getOrDefault(eirFlag, UNKNOWN);
}
/**
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Class to implement the BlueGiga Enumeration <b>AttributeChangeReason</b>.
* <p>
*
* @author Chris Jackson - Initial contribution of Java code generator
*/
+@NonNullByDefault
public enum AttributeChangeReason {
/**
* Default unknown value
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, AttributeChangeReason> codeMapping;
+ private static @Nullable Map<Integer, AttributeChangeReason> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (AttributeChangeReason s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param attributeChangeReason
* the code to lookup
* @return enumeration value.
*/
public static AttributeChangeReason getAttributeChangeReason(int attributeChangeReason) {
- if (codeMapping == null) {
- initMapping();
- }
-
- if (codeMapping.get(attributeChangeReason) == null) {
- return UNKNOWN;
+ Map<Integer, AttributeChangeReason> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (AttributeChangeReason s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.get(attributeChangeReason);
+ return localCodeMapping.getOrDefault(attributeChangeReason, UNKNOWN);
}
/**
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Class to implement the BlueGiga Enumeration <b>AttributeValueType</b>.
* <p>
*
* @author Chris Jackson - Initial contribution of Java code generator
*/
+@NonNullByDefault
public enum AttributeValueType {
/**
* Default unknown value
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, AttributeValueType> codeMapping;
+ private static @Nullable Map<Integer, AttributeValueType> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (AttributeValueType s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param attributeValueType
* the code to lookup
* @return enumeration value.
*/
public static AttributeValueType getAttributeValueType(int attributeValueType) {
- if (codeMapping == null) {
- initMapping();
- }
-
- if (codeMapping.get(attributeValueType) == null) {
- return UNKNOWN;
+ Map<Integer, AttributeValueType> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (AttributeValueType s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.get(attributeValueType);
+ return localCodeMapping.getOrDefault(attributeValueType, UNKNOWN);
}
/**
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Class to implement the BlueGiga Enumeration <b>BgApiResponse</b>.
* <p>
*
* @author Chris Jackson - Initial contribution of Java code generator
*/
+@NonNullByDefault
public enum BgApiResponse {
/**
* Default unknown value
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, BgApiResponse> codeMapping;
+ private static @Nullable Map<Integer, BgApiResponse> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (BgApiResponse s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param bgApiResponse
* the code to lookup
* @return enumeration value.
*/
public static BgApiResponse getBgApiResponse(int bgApiResponse) {
- if (codeMapping == null) {
- initMapping();
- }
-
- if (codeMapping.get(bgApiResponse) == null) {
- return UNKNOWN;
+ Map<Integer, BgApiResponse> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (BgApiResponse s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.get(bgApiResponse);
+ return localCodeMapping.getOrDefault(bgApiResponse, UNKNOWN);
}
/**
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Class to implement the BlueGiga Enumeration <b>BluetoothAddressType</b>.
* <p>
*
* @author Chris Jackson - Initial contribution of Java code generator
*/
+@NonNullByDefault
public enum BluetoothAddressType {
/**
* Default unknown value
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, BluetoothAddressType> codeMapping;
+ private static @Nullable Map<Integer, BluetoothAddressType> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (BluetoothAddressType s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param bluetoothAddressType
* the code to lookup
* @return enumeration value.
*/
public static BluetoothAddressType getBluetoothAddressType(int bluetoothAddressType) {
- if (codeMapping == null) {
- initMapping();
- }
-
- if (codeMapping.get(bluetoothAddressType) == null) {
- return UNKNOWN;
+ Map<Integer, BluetoothAddressType> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (BluetoothAddressType s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.get(bluetoothAddressType);
+ return localCodeMapping.getOrDefault(bluetoothAddressType, UNKNOWN);
}
/**
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Class to implement the BlueGiga Enumeration <b>ConnectionStatusFlag</b>.
* <p>
*
* @author Chris Jackson - Initial contribution of Java code generator
*/
+@NonNullByDefault
public enum ConnectionStatusFlag {
/**
* Default unknown value
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, ConnectionStatusFlag> codeMapping;
+ private static @Nullable Map<Integer, ConnectionStatusFlag> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (ConnectionStatusFlag s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param connectionStatusFlag
* the code to lookup
* @return enumeration value.
*/
public static ConnectionStatusFlag getConnectionStatusFlag(int connectionStatusFlag) {
- if (codeMapping == null) {
- initMapping();
- }
-
- if (codeMapping.get(connectionStatusFlag) == null) {
- return UNKNOWN;
+ Map<Integer, ConnectionStatusFlag> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (ConnectionStatusFlag s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.get(connectionStatusFlag);
+ return localCodeMapping.getOrDefault(connectionStatusFlag, UNKNOWN);
}
/**
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Class to implement the BlueGiga Enumeration <b>GapConnectableMode</b>.
* <p>
*
* @author Chris Jackson - Initial contribution of Java code generator
*/
+@NonNullByDefault
public enum GapConnectableMode {
/**
* Default unknown value
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, GapConnectableMode> codeMapping;
+ private static @Nullable Map<Integer, GapConnectableMode> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (GapConnectableMode s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param gapConnectableMode
* the code to lookup
* @return enumeration value.
*/
public static GapConnectableMode getGapConnectableMode(int gapConnectableMode) {
- if (codeMapping == null) {
- initMapping();
- }
-
- if (codeMapping.get(gapConnectableMode) == null) {
- return UNKNOWN;
+ Map<Integer, GapConnectableMode> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (GapConnectableMode s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.get(gapConnectableMode);
+ return localCodeMapping.getOrDefault(gapConnectableMode, UNKNOWN);
}
/**
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Class to implement the BlueGiga Enumeration <b>GapDiscoverMode</b>.
* <p>
*
* @author Chris Jackson - Initial contribution of Java code generator
*/
+@NonNullByDefault
public enum GapDiscoverMode {
/**
* Default unknown value
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, GapDiscoverMode> codeMapping;
+ private static @Nullable Map<Integer, GapDiscoverMode> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (GapDiscoverMode s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param gapDiscoverMode
* the code to lookup
* @return enumeration value.
*/
public static GapDiscoverMode getGapDiscoverMode(int gapDiscoverMode) {
- if (codeMapping == null) {
- initMapping();
- }
-
- if (codeMapping.get(gapDiscoverMode) == null) {
- return UNKNOWN;
+ Map<Integer, GapDiscoverMode> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (GapDiscoverMode s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.get(gapDiscoverMode);
+ return localCodeMapping.getOrDefault(gapDiscoverMode, UNKNOWN);
}
/**
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Class to implement the BlueGiga Enumeration <b>GapDiscoverableMode</b>.
* <p>
*
* @author Chris Jackson - Initial contribution of Java code generator
*/
+@NonNullByDefault
public enum GapDiscoverableMode {
/**
* Default unknown value
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, GapDiscoverableMode> codeMapping;
+ private static @Nullable Map<Integer, GapDiscoverableMode> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (GapDiscoverableMode s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param gapDiscoverableMode
* the code to lookup
* @return enumeration value.
*/
public static GapDiscoverableMode getGapDiscoverableMode(int gapDiscoverableMode) {
- if (codeMapping == null) {
- initMapping();
- }
-
- if (codeMapping.get(gapDiscoverableMode) == null) {
- return UNKNOWN;
+ Map<Integer, GapDiscoverableMode> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (GapDiscoverableMode s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.get(gapDiscoverableMode);
+ return localCodeMapping.getOrDefault(gapDiscoverableMode, UNKNOWN);
}
/**
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Class to implement the BlueGiga Enumeration <b>ScanResponseType</b>.
* <p>
*
* @author Chris Jackson - Initial contribution of Java code generator
*/
+@NonNullByDefault
public enum ScanResponseType {
/**
* Default unknown value
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, ScanResponseType> codeMapping;
+ private static @Nullable Map<Integer, ScanResponseType> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (ScanResponseType s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param scanResponseType
* the code to lookup
* @return enumeration value.
*/
public static ScanResponseType getScanResponseType(int scanResponseType) {
- if (codeMapping == null) {
- initMapping();
- }
-
- if (codeMapping.get(scanResponseType) == null) {
- return UNKNOWN;
+ Map<Integer, ScanResponseType> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (ScanResponseType s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.get(scanResponseType);
+ return localCodeMapping.getOrDefault(scanResponseType, UNKNOWN);
}
/**
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
/**
* Class to implement the BlueGiga Enumeration <b>SmpIoCapabilities</b>.
* <p>
*
* @author Chris Jackson - Initial contribution of Java code generator
*/
+@NonNullByDefault
public enum SmpIoCapabilities {
/**
* Default unknown value
* A mapping between the integer code and its corresponding type to
* facilitate lookup by code.
*/
- private static Map<Integer, SmpIoCapabilities> codeMapping;
+ private static @Nullable Map<Integer, SmpIoCapabilities> codeMapping;
private int key;
this.key = key;
}
- private static void initMapping() {
- codeMapping = new HashMap<>();
- for (SmpIoCapabilities s : values()) {
- codeMapping.put(s.key, s);
- }
- }
-
/**
- * Lookup function based on the type code. Returns null if the code does not exist.
+ * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
*
* @param smpIoCapabilities
* the code to lookup
* @return enumeration value.
*/
public static SmpIoCapabilities getSmpIoCapabilities(int smpIoCapabilities) {
- if (codeMapping == null) {
- initMapping();
- }
-
- if (codeMapping.get(smpIoCapabilities) == null) {
- return UNKNOWN;
+ Map<Integer, SmpIoCapabilities> localCodeMapping = codeMapping;
+ if (localCodeMapping == null) {
+ localCodeMapping = new HashMap<>();
+ for (SmpIoCapabilities s : values()) {
+ localCodeMapping.put(s.key, s);
+ }
+ codeMapping = localCodeMapping;
}
- return codeMapping.get(smpIoCapabilities);
+ return localCodeMapping.getOrDefault(smpIoCapabilities, UNKNOWN);
}
/**
bundleContext.registerService(BluetoothAdapter.class.getName(), adapter, new Hashtable<>()));
}
- @SuppressWarnings("null")
@Override
protected synchronized void removeHandler(ThingHandler thingHandler) {
if (thingHandler instanceof BluetoothAdapter) {