From f69135c8cfbc7d36b5d2ee69f1baa473c967496c Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Mon, 7 Apr 2025 10:48:17 +0200 Subject: [PATCH 01/16] WIP for ESPProvisionProvider: device and wifi discovery happy flow working, lots of cleanup to do --- ORLib/build.gradle | 5 + .../orlib/service/ESPProvisionProvider.kt | 289 ++++++++++++++++++ .../service/espprovision/BatteryProvision.kt | 8 + .../service/espprovision/CallbackChannel.kt | 16 + .../service/espprovision/DeviceConnection.kt | 120 ++++++++ .../service/espprovision/DeviceRegistry.kt | 222 ++++++++++++++ .../service/espprovision/LoopDetector.kt | 29 ++ .../service/espprovision/ORConfigChannel.kt | 126 ++++++++ .../service/espprovision/WifiProvisioner.kt | 146 +++++++++ .../io/openremote/orlib/ui/OrMainActivity.kt | 92 ++++++ .../orlib/service/ESPProvisionProviderTest.kt | 4 + build.gradle | 1 + 12 files changed, 1058 insertions(+) create mode 100644 ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt create mode 100644 ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt create mode 100644 ORLib/src/main/java/io/openremote/orlib/service/espprovision/CallbackChannel.kt create mode 100644 ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt create mode 100644 ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt create mode 100644 ORLib/src/main/java/io/openremote/orlib/service/espprovision/LoopDetector.kt create mode 100644 ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannel.kt create mode 100644 ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt create mode 100644 ORLib/src/test/java/io/openremote/orlib/service/ESPProvisionProviderTest.kt diff --git a/ORLib/build.gradle b/ORLib/build.gradle index 9c8db68..0bcc64d 100644 --- a/ORLib/build.gradle +++ b/ORLib/build.gradle @@ -64,6 +64,11 @@ dependencies { implementation platform('com.google.firebase:firebase-bom:33.6.0') implementation 'com.google.firebase:firebase-messaging-ktx' implementation 'androidx.constraintlayout:constraintlayout:2.2.0' + implementation 'com.github.espressif:esp-idf-provisioning-android:lib-2.2.3' + implementation 'org.greenrobot:eventbus:3.3.1' + + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' } diff --git a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt new file mode 100644 index 0000000..fbb0849 --- /dev/null +++ b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt @@ -0,0 +1,289 @@ +package io.openremote.orlib.service + +import android.Manifest +import android.annotation.SuppressLint +import android.app.Activity +import android.bluetooth.BluetoothAdapter +import android.bluetooth.BluetoothManager +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Build +import android.util.Log +import androidx.annotation.VisibleForTesting +import androidx.core.app.ActivityCompat +import io.openremote.orlib.R +import io.openremote.orlib.service.BleProvider.BleCallback +import io.openremote.orlib.service.BleProvider.Companion.BLUETOOTH_PERMISSION_REQUEST_CODE +import io.openremote.orlib.service.BleProvider.Companion.ENABLE_BLUETOOTH_REQUEST_CODE +import io.openremote.orlib.service.espprovision.CallbackChannel +import io.openremote.orlib.service.espprovision.DeviceConnection +import io.openremote.orlib.service.espprovision.DeviceRegistry +import io.openremote.orlib.service.espprovision.WifiProvisioner + +object ESPProvisionProviderActions { + const val PROVIDER_INIT = "PROVIDER_INIT" + const val PROVIDER_ENABLE = "PROVIDER_ENABLE" + const val PROVIDER_DISABLE = "PROVIDER_DISABLE" + const val START_BLE_SCAN = "START_BLE_SCAN" + const val STOP_BLE_SCAN = "STOP_BLE_SCAN" + const val CONNECT_TO_DEVICE = "CONNECT_TO_DEVICE" + const val START_WIFI_SCAN = "START_WIFI_SCAN" + const val STOP_WIFI_SCAN = "STOP_WIFI_SCAN" + const val SEND_WIFI_CONFIGURATION = "SEND_WIFI_CONFIGURATION" + const val PROVISION_DEVICE = "PROVISION_DEVICE" + const val EXIT_PROVISIONING = "EXIT_PROVISIONING" +} + +class ESPProvisionProvider(val context: Context) { + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + val deviceRegistry: DeviceRegistry + var deviceConnection: DeviceConnection? = null + + private var searchDeviceTimeout: Long = 120 + private var searchDeviceMaxIterations = 25 + + var wifiProvisioner: WifiProvisioner? = null + private var searchWifiTimeout: Long = 120 + private var searchWifiMaxIterations = 25 + + init { + deviceRegistry = DeviceRegistry(context, searchDeviceTimeout, searchDeviceMaxIterations) + } + + interface ESPProvisionCallback { + fun accept(responseData: Map) + } + + companion object { + private const val espProvisionDisabledKey = "espProvisionDisabled" + private const val version = "beta" + + const val TAG = "ESPProvisionProvider" + + const val ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE = 655 + const val BLUETOOTH_PERMISSION_ESPPROVISION_REQUEST_CODE = 656 + } + + private val bluetoothAdapter: BluetoothAdapter by lazy { + val bluetoothManager = + context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager + bluetoothManager.adapter + } + + fun initialize(): Map { + val sharedPreferences = + context.getSharedPreferences(context.getString(R.string.app_name), Context.MODE_PRIVATE) + + return hashMapOf( + "action" to ESPProvisionProviderActions.PROVIDER_INIT, + "provider" to "espprovision", + "version" to version, + "requiresPermission" to true, + "hasPermission" to hasPermission(), + "success" to true, + "enabled" to false, + "disabled" to sharedPreferences.contains(espProvisionDisabledKey) + ) + } + + @SuppressLint("MissingPermission") + fun enable(callback: ESPProvisionCallback?, activity: Activity) { + if (!bluetoothAdapter.isEnabled) { + Log.d("ESP", "BLE not enabled") + val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) + activity.startActivityForResult(enableBtIntent, + ESPProvisionProvider.Companion.ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE + ) + } else if (!hasPermission()) { + Log.d("ESP", "Does not have permissions") + requestPermissions(activity) + } + + deviceRegistry.enable() + + val sharedPreferences = + context.getSharedPreferences(context.getString(R.string.app_name), Context.MODE_PRIVATE) + + sharedPreferences.edit() + .remove(espProvisionDisabledKey) + .apply() + + callback?.accept( + hashMapOf( + "action" to ESPProvisionProviderActions.PROVIDER_ENABLE, + "provider" to "espprovision", + "hasPermission" to hasPermission(), + "success" to true, + "enabled" to true, + "disabled" to sharedPreferences.contains(espProvisionDisabledKey) + ) + ) + } + + @SuppressLint("MissingPermission") + fun disable(): Map { + deviceRegistry.disable() + +// disconnectFromDevice() + + val sharedPreferences = + context.getSharedPreferences(context.getString(R.string.app_name), Context.MODE_PRIVATE) + sharedPreferences.edit() + .putBoolean(espProvisionDisabledKey, true) + .apply() + + return hashMapOf( + "action" to ESPProvisionProviderActions.PROVIDER_DISABLE, + "provider" to "espprovision" + ) + } + + @SuppressLint("MissingPermission") + fun onRequestPermissionsResult( + activity: Activity, + requestCode: Int, + prefix: String + ) { + if (requestCode == BLUETOOTH_PERMISSION_ESPPROVISION_REQUEST_CODE) { + val hasPermission = hasPermission() + if (hasPermission) { + if (!bluetoothAdapter.isEnabled) { + val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) + activity.startActivityForResult(enableBtIntent, ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE) + } else { +// deviceRegistry.startDevicesScan(prefix) + } + } + } else if (requestCode == ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE) { + if (bluetoothAdapter.isEnabled) { +// deviceRegistry.startDevicesScan(prefix) + } + } + } + + // Device scan + + @SuppressLint("MissingPermission") + fun startDevicesScan(prefix: String?, activity: Activity, callback: ESPProvisionCallback) { + // TODO: check in BLE provider what activity is used for + deviceRegistry.callbackChannel = CallbackChannel(callback, "espprovision") + if (!bluetoothAdapter.isEnabled) { + Log.d("ESP", "BLE not enabled") + val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) + activity.startActivityForResult(enableBtIntent, + ESPProvisionProvider.Companion.ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE + ) + } else if (!hasPermission()) { + Log.d("ESP", "Does not have permissions") + requestPermissions(activity) + } else { + deviceRegistry.startDevicesScan(prefix) + } + } + + @SuppressLint("MissingPermission") + fun stopDevicesScan() { + deviceRegistry.stopDevicesScan() + } + + // MARK: Device connect/disconnect + + @SuppressLint("MissingPermission") + fun connectTo(deviceId: String, pop: String? = null, username: String? = null) { + if (deviceConnection == null) { + deviceConnection = DeviceConnection(deviceRegistry, deviceRegistry.callbackChannel) + } + deviceConnection?.connectTo(deviceId, pop, username) + } + + fun disconnectFromDevice() { + // TODO + } + + fun exitProvisioning() { + if (deviceConnection == null) { + // TODO + return + } + if (!deviceConnection!!.isConnected) { + // TODO + return + } + deviceConnection!!.exitProvisioning() + // TODO + } + + // Wifi scan + + fun startWifiScan() { + if (wifiProvisioner == null) { + wifiProvisioner = WifiProvisioner(deviceConnection, deviceRegistry.callbackChannel, searchWifiTimeout, searchWifiMaxIterations) + } + wifiProvisioner!!.startWifiScan() + } + + fun stopWifiScan() { + wifiProvisioner?.stopWifiScan() + } + + fun sendWifiConfiguration(ssid: String, password: String) { + if (wifiProvisioner == null) { + wifiProvisioner = WifiProvisioner(deviceConnection, deviceRegistry.callbackChannel, searchWifiTimeout, searchWifiMaxIterations) + } + wifiProvisioner!!.sendWifiConfiguration(ssid, password) + } + + // OR Configuration + + fun provisionDevice(userToken: String) { + // TODO + } + + private fun requestPermissions(activity: Activity) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + ActivityCompat.requestPermissions( + activity, + arrayOf( + Manifest.permission.BLUETOOTH_SCAN, + Manifest.permission.BLUETOOTH_CONNECT + ), + ESPProvisionProvider.Companion.BLUETOOTH_PERMISSION_ESPPROVISION_REQUEST_CODE + ) + } else { + ActivityCompat.requestPermissions( + activity, + arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), + ESPProvisionProvider.Companion.BLUETOOTH_PERMISSION_ESPPROVISION_REQUEST_CODE + ) + } + } + + private fun hasPermission() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + context.checkSelfPermission(Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED && + context.checkSelfPermission(Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED + } else { + context.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED + } + +} + +enum class ESPProviderErrorCode(val code: Int) { + UNKNOWN_DEVICE(100), + + BLE_COMMUNICATION_ERROR(200), + + NOT_CONNECTED(300), + COMMUNICATION_ERROR(301), + + SECURITY_ERROR(400), + + WIFI_CONFIGURATION_ERROR(500), + WIFI_COMMUNICATION_ERROR(501), + WIFI_AUTHENTICATION_ERROR(502), + WIFI_NETWORK_NOT_FOUND(503), + + TIMEOUT_ERROR(600), + + GENERIC_ERROR(10000); +} \ No newline at end of file diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt new file mode 100644 index 0000000..28887c7 --- /dev/null +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt @@ -0,0 +1,8 @@ +package io.openremote.orlib.service.espprovision + +class BatteryProvision(var deviceConnection: DeviceConnection?, var callbackChannel: CallbackChannel?) { + + suspend fun provision(userToken: String) { + + } +} \ No newline at end of file diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/CallbackChannel.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/CallbackChannel.kt new file mode 100644 index 0000000..ad8eb76 --- /dev/null +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/CallbackChannel.kt @@ -0,0 +1,16 @@ +package io.openremote.orlib.service.espprovision + +import io.openremote.orlib.service.ESPProvisionProvider + +class CallbackChannel(private val espProvisionCallback: ESPProvisionProvider.ESPProvisionCallback, private val provider: String) { + + fun sendMessage(action: String, data: Map? = null) { + var payload: MutableMap = hashMapOf( + "action" to action, + "provider" to "espprovision") + + data?.let { payload.putAll(it) } + + espProvisionCallback.accept(payload) + } +} \ No newline at end of file diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt new file mode 100644 index 0000000..a92489f --- /dev/null +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt @@ -0,0 +1,120 @@ +package io.openremote.orlib.service.espprovision + +import android.Manifest +import android.util.Log +import androidx.annotation.RequiresPermission +import com.espressif.provisioning.DeviceConnectionEvent +import com.espressif.provisioning.ESPConstants +import com.espressif.provisioning.ESPDevice +import io.openremote.orlib.service.ESPProvisionProvider +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import org.greenrobot.eventbus.EventBus +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode +import java.util.UUID + +class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: CallbackChannel? = null) { + + init { + EventBus.getDefault().register(this) + } +// TODO: must un-register -> need a clean-up routine + + private var bleStatus: BLEStatus = BLEStatus.DISCONNECTED + + var deviceId: UUID? = null + private set + + private var configChannel: ORConfigChannel? = null + + @RequiresPermission(allOf = [Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH]) + fun connectTo(deviceId: String, pop: String? = null, username: String? = null) { + + if (deviceRegistry.bleScanning) { + deviceRegistry.stopDevicesScan() + } + + val devId = UUID.fromString(deviceId) + val dev = deviceRegistry.getDeviceWithId(devId) + + if (dev != null) { +// device = dev.device // TODO: should I set this ? to what ? + this.deviceId = devId + + espDevice?.proofOfPossession = pop ?: "abcd1234" + espDevice?.userName = username ?: "UNUSED" + espDevice?.connectBLEDevice(dev.device, dev.serviceUuid) + + } +// TODO send status message back + } + + fun exitProvisioning() { + if (!isConnected) { + // TODO + } + // Is IO OK ? + CoroutineScope(Dispatchers.IO).launch { + try { +// configChannel?.exitProvisioning() + } catch (e: Exception) { + // Handle error (log or show UI feedback) + } + } + } + + @Subscribe(threadMode = ThreadMode.MAIN) + fun onDeviceConnectionEvent(event: DeviceConnectionEvent) { + + when (event.getEventType()) { + ESPConstants.EVENT_DEVICE_CONNECTED -> { + Log.d(ESPProvisionProvider.TAG, "Device Connected Event Received") +// setSecurityTypeFromVersionInfo() // TODO: do we need this ? + + + bleStatus = BLEStatus.CONNECTED + + configChannel = ORConfigChannel() // TODO: should implement / pass device + + + callbackChannel?.sendMessage("CONNECT_TO_DEVICE", mapOf( + "id" to (deviceId?.toString() ?: ""), + "status" to "connected")) + // TODO: proper enum for status + } +/* + ESPConstants.EVENT_DEVICE_DISCONNECTED -> if (espDevice != null && espDevice!!.getTransportType() == ESPConstants.TransportType.TRANSPORT_BLE) { + Toast.makeText(this@AddDeviceActivity, "Device disconnected", Toast.LENGTH_LONG) + .show() + finish() + } else { + if (!isFinishing()) { + askForManualDeviceConnection() + } + } + + ESPConstants.EVENT_DEVICE_CONNECTION_FAILED -> if (espDevice != null && espDevice!!.getTransportType() == ESPConstants.TransportType.TRANSPORT_BLE) { + alertForDeviceNotSupported("Failed to connect with device") + } else { + if (!isFinishing()) { + askForManualDeviceConnection() + } + }*/ + } + } + + + val espDevice: ESPDevice? + get() = deviceRegistry.provisionManager?.espDevice + + val isConnected: Boolean + get() = bleStatus == BLEStatus.CONNECTED && espDevice != null && configChannel != null + + enum class BLEStatus { + CONNECTING, + CONNECTED, + DISCONNECTED + } +} \ No newline at end of file diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt new file mode 100644 index 0000000..a2e4a08 --- /dev/null +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt @@ -0,0 +1,222 @@ +package io.openremote.orlib.service.espprovision + +import android.Manifest +import android.bluetooth.BluetoothDevice +import android.bluetooth.le.ScanResult +import android.content.Context +import android.util.Log +import androidx.annotation.RequiresPermission +import com.espressif.provisioning.ESPConstants +import com.espressif.provisioning.ESPDevice +import com.espressif.provisioning.ESPProvisionManager +import com.espressif.provisioning.listeners.BleScanListener +import io.openremote.orlib.service.ESPProviderErrorCode +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.suspendCancellableCoroutine +import kotlinx.coroutines.withContext +import java.util.UUID + +/* +// TODO: do we really need to for Android ? +interface ORESPProvisionManager { + suspend fun searchESPDevices(devicePrefix: String, transport: ESPConstants.TransportType, security: ESPConstants.SecurityType): List< + DeviceRegistry.DiscoveredDevice> + fun stopESPDevicesSearch() +} + */ + +class EspressifProvisionManager(private val provisionManager: ESPProvisionManager) { + init { + provisionManager.createESPDevice(ESPConstants.TransportType.TRANSPORT_BLE, ESPConstants.SecurityType.SECURITY_1) + } + + @androidx.annotation.RequiresPermission(allOf = [android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.BLUETOOTH]) + suspend fun searchESPDevices(devicePrefix: String): List { + return withContext(Dispatchers.Main) { + + // Was Dispatchers.IO + + + suspendCancellableCoroutine { continuation -> + var alreadyResumed = false // TODO: does it behave same as iOS ? will we receive 2 times the call ? + var devices: MutableList = mutableListOf() + + provisionManager.searchBleEspDevices(devicePrefix, object: BleScanListener { + override fun scanStartFailed() { + // Don't care about that information + } + + override fun onPeripheralFound(device: BluetoothDevice, scanResult: ScanResult) { +// Log.d("espprovision", "Found peripheral") + if (!scanResult.scanRecord?.deviceName.isNullOrEmpty()) { +// Log.d("espprovision", "Device name ${scanResult.scanRecord?.deviceName}") + + var serviceUuid = "" + scanResult.scanRecord?.serviceUuids?.firstOrNull()?.toString()?.let { uuid -> + serviceUuid = uuid + } +// Log.d("espprovision", "Service UUID $serviceUuid") + scanResult.scanRecord!!.deviceName?.let { deviceName -> + // TODO: should only add device if it doesn't exist yet + if (devices.find { it.name == deviceName } == null) { + devices.add(DeviceRegistry.DiscoveredDevice(deviceName, serviceUuid, device)) + Log.d("espprovision", "Added device, list is now $devices") + } + } + } + } + + override fun scanCompleted() { + Log.d("espprovision", "Scan completed") + // TODO: I don't want that second param + continuation.resume(devices, onCancellation = null) + } + + override fun onFailure(e: Exception) { + continuation.cancel(e) + } + + }) + /* + provisionManager.searchESPDevices(devicePrefix, transport, security) { deviceList, error -> + if (error != null) { + if (!alreadyResumed) { + alreadyResumed = true + continuation.resumeWith(Result.failure(error)) + } + } else { + alreadyResumed = true + continuation.resumeWith(Result.success(deviceList ?: emptyList())) + } + }*/ + } + } + } + + @RequiresPermission(allOf = [Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH]) + fun stopESPDevicesSearch() + { + provisionManager.stopBleScan() + } + + val espDevice: ESPDevice + get() = provisionManager.espDevice +} + +class DeviceRegistry(private val context: Context, searchDeviceTimeout: Long, searchDeviceMaxIterations: Int, var callbackChannel: CallbackChannel? = null) { + private var loopDetector = LoopDetector(searchDeviceTimeout, searchDeviceMaxIterations) + var provisionManager: EspressifProvisionManager? = null + + // var callbackChannel: CallbackChannel? = null +// private var devices = mutableListOf() +// private val devicesIndex = mutableMapOf() + var bleScanning = false + + private var devices: MutableList = mutableListOf() + private var devicesIndex: MutableMap = mutableMapOf() + + fun enable() { + provisionManager = EspressifProvisionManager(ESPProvisionManager.getInstance(context)) + } + + @RequiresPermission(allOf = [Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH]) + fun disable() { + if (bleScanning) stopDevicesScan() + provisionManager = null + } + + @RequiresPermission(allOf = [Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH]) + fun startDevicesScan(prefix: String? = "") { + bleScanning = true + resetDevicesList() + loopDetector.reset() + devicesScan(prefix ?: "") + } + + @RequiresPermission(allOf = [Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH]) + fun stopDevicesScan(sendMessage: Boolean = true) { + bleScanning = false + provisionManager?.stopESPDevicesSearch() + if (sendMessage) { + callbackChannel?.sendMessage("STOP_BLE_SCAN", null) + } + } + + @androidx.annotation.RequiresPermission(allOf = [android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.BLUETOOTH]) + private fun devicesScan(prefix: String) { + provisionManager?.let { manager -> + if (loopDetector.detectLoop()) { + stopDevicesScan(sendMessage = false) + sendDeviceScanError(ESPProviderErrorCode.TIMEOUT_ERROR) + return + } + + CoroutineScope(Dispatchers.IO).launch { + +// Log.d("DeviceRegistry", "Starting BLE scan") + + try { + val deviceList = manager.searchESPDevices(prefix) + Log.d("espprovision", "I got a list of devices $deviceList") + if (bleScanning) { + var devicesChanged = false + for (device in deviceList) { + if (getDeviceNamed(device.name) == null) { + devicesChanged = true + registerDevice(device) + } + } + Log.d("espprovision", "devicesChanges $devicesChanged") + Log.d("espprovision", "devices $devices") + if (devices.isNotEmpty() && devicesChanged) { + Log.d("espprovision", "callbackChannel $callbackChannel") + callbackChannel?.sendMessage( + "START_BLE_SCAN", + mapOf("devices" to devices.map { it.info }) + ) + } + devicesScan(prefix) + } + } catch (e: Exception) { + Log.w("DeviceRegistry", "Error during device scan: ${e.localizedMessage}") + sendDeviceScanError(ESPProviderErrorCode.GENERIC_ERROR) + } + } + } + } + + private fun sendDeviceScanError(error: ESPProviderErrorCode, errorMessage: String? = null) { + val data = mutableMapOf("errorCode" to error.code) + + errorMessage?.let { + data["errorMessage"] = it + } + + callbackChannel?.sendMessage(action = "STOP_BLE_SCAN", data = data) + } + + private fun resetDevicesList() { + devices = mutableListOf() + devicesIndex = mutableMapOf() + } + + private fun getDeviceNamed(name: String): DiscoveredDevice? { + return devices.firstOrNull { it.name == name } + } + + fun getDeviceWithId(id: UUID): DiscoveredDevice? { + return devicesIndex[id] + } + + private fun registerDevice(device: DiscoveredDevice) { + devices.add(device) + devicesIndex[device.id] = device + } + + data class DiscoveredDevice(val name: String, val serviceUuid: String, val device: BluetoothDevice, val id: UUID = UUID.randomUUID()) { + val info: Map + get() = mapOf("id" to id.toString(), "name" to name) + } +} \ No newline at end of file diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/LoopDetector.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/LoopDetector.kt new file mode 100644 index 0000000..18d17e3 --- /dev/null +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/LoopDetector.kt @@ -0,0 +1,29 @@ +package io.openremote.orlib.service.espprovision + +import java.util.Date +import java.util.concurrent.TimeUnit + +class LoopDetector( + private val timeout: Long = TimeUnit.MINUTES.toSeconds(2), + private val maxIterations: Int = 25) { + + private var startTime: Date? = null + private var iterationCount = 0 + + fun reset() { + startTime = Date() + iterationCount = 0 + } + + fun detectLoop(): Boolean { + iterationCount++ + if (iterationCount > maxIterations) { + return true + } + val start = startTime ?: return true + if ((Date().time - start.time) / 1000 > timeout) { + return true + } + return false + } +} diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannel.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannel.kt new file mode 100644 index 0000000..ed85bb9 --- /dev/null +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannel.kt @@ -0,0 +1,126 @@ +package io.openremote.orlib.service.espprovision + +import com.espressif.provisioning.ESPDevice +import com.espressif.provisioning.listeners.ResponseListener +import kotlinx.coroutines.suspendCancellableCoroutine +import kotlin.coroutines.resumeWithException + +data class DeviceInfo( + val deviceId: String, + val modelName: String +) + +enum class BackendConnectionStatus { + DISCONNECTED, CONNECTING, CONNECTED, FAILED +} +sealed class ORConfigChannelError(message: String) : Exception(message) { + class InvalidRequest(message: String) : ORConfigChannelError(message) + object MessageOutOfOrder : ORConfigChannelError("Message out of order") + class InvalidResponse(message: String) : ORConfigChannelError(message) + object OperationFailure : ORConfigChannelError("Operation failed") + object GenericError : ORConfigChannelError("Generic error") +} + +// TODO: see RequestKt and ResponseKt + + +class ORConfigChannel(/*private val device: ESPDevice*/) { +/* + private var messageId = 0 + + suspend fun getDeviceInfo(): DeviceInfo { + val request = Request.newBuilder() + .setDeviceInfo(Request.DeviceInfo.getDefaultInstance()) + .setId(messageId++.toString()) + .build() + + val response = sendRequest(request) + if (response.hasDeviceInfo()) { + val info = response.deviceInfo + return DeviceInfo(deviceId = info.deviceId, modelName = info.modelName) + } else { + throw ORConfigChannelError.InvalidResponse("Invalid response type") + } + } + + suspend fun sendOpenRemoteConfig( + mqttBrokerUrl: String, + mqttUser: String, + mqttPassword: String, + realm: String = "master", + assetId: String + ) { + val config = Request.OpenRemoteConfig.newBuilder() + .setMqttBrokerUrl(mqttBrokerUrl) + .setUser(mqttUser) + .setMqttPassword(mqttPassword) + .setAssetId(assetId) + .setRealm(realm) + .build() + + val request = Request.newBuilder() + .setOpenRemoteConfig(config) + .setId(messageId++.toString()) + .build() + + val response = sendRequest(request) + if (!response.hasOpenRemoteConfig() || response.openRemoteConfig.status != Response.OpenRemoteConfig.Status.SUCCESS) { + throw ORConfigChannelError.OperationFailure + } + } + + suspend fun getBackendConnectionStatus(): BackendConnectionStatus { + val request = Request.newBuilder() + .setBackendConnectionStatus(Request.BackendConnectionStatus.getDefaultInstance()) + .setId(messageId++.toString()) + .build() + + val response = sendRequest(request) + if (response.hasBackendConnectionStatus()) { + return when (response.backendConnectionStatus.status) { + Response.BackendConnectionStatus.Status.DISCONNECTED -> BackendConnectionStatus.DISCONNECTED + Response.BackendConnectionStatus.Status.CONNECTING -> BackendConnectionStatus.CONNECTING + Response.BackendConnectionStatus.Status.CONNECTED -> BackendConnectionStatus.CONNECTED + Response.BackendConnectionStatus.Status.FAILED -> BackendConnectionStatus.FAILED + else -> throw ORConfigChannelError.InvalidResponse("Unrecognized status") + } + } else { + throw ORConfigChannelError.InvalidResponse("Invalid response type") + } + } + + suspend fun exitProvisioning() { + val request = Request.newBuilder() + .setExitProvisioning(Request.ExitProvisioning.getDefaultInstance()) + .setId(messageId++.toString()) + .build() + sendRequest(request) + } + + private suspend fun sendRequest(request: Request): Response = suspendCancellableCoroutine { cont -> + val data = request.toByteArray() + device.sendDataToCustomEndPoint("or-cfg", data, object: ResponseListener { + override fun onSuccess(returnData: ByteArray?) { + val response = Response.parseFrom(returnData) + if (response.id != request.id) { + cont.resumeWithException(ORConfigChannelError.MessageOutOfOrder) + } else if (!response.hasResult() || response.result.result != Response.ResponseResult.Result.SUCCESS) { + cont.resumeWithException( + ORConfigChannelError.InvalidResponse("Response result was not success") + ) + } else { + // TODO: why the onCancellation ? + cont.resume(response, onCancellation = null) + } + } + + override fun onFailure(e: java.lang.Exception?) { + // TODO: pass some details ? + cont.resumeWithException(ORConfigChannelError.GenericError) + } + + }) + } + + */ +} \ No newline at end of file diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt new file mode 100644 index 0000000..be10daf --- /dev/null +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt @@ -0,0 +1,146 @@ +package io.openremote.orlib.service.espprovision + +import android.util.Log +import android.widget.Toast +import com.espressif.provisioning.ESPConstants +import com.espressif.provisioning.ESPConstants.ProvisionFailureReason +import com.espressif.provisioning.WiFiAccessPoint +import com.espressif.provisioning.listeners.ProvisionListener +import com.espressif.provisioning.listeners.WiFiScanListener +import io.openremote.orlib.service.ESPProviderErrorCode +import io.openremote.orlib.service.ESPProvisionProvider +import io.openremote.orlib.service.ESPProvisionProviderActions + +class WifiProvisioner(private var deviceConnection: DeviceConnection? = null, var callbackChannel: CallbackChannel? = null, searchWifiTimeout: Long, searchWifiMaxIterations: Int) { + private var loopDetector = LoopDetector(searchWifiTimeout, searchWifiMaxIterations) + + var wifiScanning = false + private set + + private val wifiNetworks = mutableListOf() + + fun startWifiScan() { + if (deviceConnection?.isConnected != true) { + sendWifiScanError(ESPProviderErrorCode.NOT_CONNECTED) + return + } + wifiScanning = true + loopDetector.reset() + scanWifi() + } + + fun stopWifiScan(sendMessage: Boolean = true) { + wifiScanning = false + if (sendMessage) { + callbackChannel?.sendMessage(ESPProvisionProviderActions.STOP_WIFI_SCAN, null) + } + } + + private fun scanWifi() { + if (loopDetector.detectLoop()) { + stopWifiScan(false) + sendWifiScanError(ESPProviderErrorCode.TIMEOUT_ERROR) + return + } + + + deviceConnection?.espDevice?.scanNetworks(object : WiFiScanListener { + override fun onWifiListReceived(wifiList: ArrayList?) { + wifiList?.let { wifiNetworks.addAll(it.mapNotNull { network -> network }) } + callbackChannel?.sendMessage(ESPProvisionProviderActions.START_WIFI_SCAN, hashMapOf( + "networks" to wifiNetworks.map { network -> + hashMapOf( + "ssid" to network.wifiName, + "signalStrength" to network.rssi) + } + )) + } + + override fun onWiFiScanFailed(e: Exception) { + // TODO +/* + Log.e(com.espressif.ui.activities.WiFiScanActivity.TAG, "onWiFiScanFailed") + e.printStackTrace() + runOnUiThread(object : Runnable { + override fun run() { + updateProgressAndScanBtn(false) + Toast.makeText( + this@WiFiScanActivity, + "Failed to get Wi-Fi scan list", + Toast.LENGTH_LONG + ).show() + } + }) + */ + } + }) + } + + private fun sendWifiScanError(error: ESPProviderErrorCode? = null, errorMessage: String? = null) { + val data = mutableMapOf( + "id" to (deviceConnection?.deviceId?.toString() ?: "N/A") + ) + error?.let { data["errorCode"] = it.code } + errorMessage?.let { data["errorMessage"] = it } + callbackChannel?.sendMessage(ESPProvisionProviderActions.STOP_WIFI_SCAN, data) + } + + fun sendWifiConfiguration(ssid: String, password: String) { + if (deviceConnection?.isConnected != true) { + sendWifiConfigurationStatus(false, ESPProviderErrorCode.NOT_CONNECTED) + return + } + stopWifiScan() + + deviceConnection?.espDevice?.provision(ssid, password, object: ProvisionListener { + override fun createSessionFailed(e: java.lang.Exception?) { + sendWifiConfigurationStatus(false, ESPProviderErrorCode.GENERIC_ERROR, e.toString()) + } + + override fun wifiConfigSent() { + /* ignore */ + } + + override fun wifiConfigFailed(e: java.lang.Exception?) { + sendWifiConfigurationStatus(false, ESPProviderErrorCode.WIFI_CONFIGURATION_ERROR, e.toString()) + } + + override fun wifiConfigApplied() { + /* ignore */ + } + + override fun wifiConfigApplyFailed(e: java.lang.Exception?) { + sendWifiConfigurationStatus(false, ESPProviderErrorCode.GENERIC_ERROR, e.toString()) + } + + override fun provisioningFailedFromDevice(failureReason: ESPConstants.ProvisionFailureReason?) { + sendWifiConfigurationStatus(false, mapProvisionFailureReason(failureReason ?: ProvisionFailureReason.UNKNOWN)) + } + + override fun deviceProvisioningSuccess() { + sendWifiConfigurationStatus(true) + } + + override fun onProvisioningFailed(e: java.lang.Exception?) { + sendWifiConfigurationStatus(false, ESPProviderErrorCode.GENERIC_ERROR, e.toString()) + } + + }) + } + + private fun sendWifiConfigurationStatus(connected: Boolean, error: ESPProviderErrorCode? = null, errorMessage: String? = null) { + val data = mutableMapOf("connected" to connected) + error?.let { data["errorCode"] = it.code } + errorMessage?.let { data["errorMessage"] = it } + callbackChannel?.sendMessage(ESPProvisionProviderActions.SEND_WIFI_CONFIGURATION, data) + } + + private fun mapProvisionFailureReason(reason: ProvisionFailureReason): ESPProviderErrorCode { + return when (reason) { + ProvisionFailureReason.AUTH_FAILED -> ESPProviderErrorCode.WIFI_AUTHENTICATION_ERROR + ProvisionFailureReason.NETWORK_NOT_FOUND -> ESPProviderErrorCode.WIFI_NETWORK_NOT_FOUND + ProvisionFailureReason.DEVICE_DISCONNECTED -> ESPProviderErrorCode.NOT_CONNECTED + ProvisionFailureReason.UNKNOWN -> ESPProviderErrorCode.GENERIC_ERROR + } + } +} \ No newline at end of file diff --git a/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt b/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt index c26d941..9b4d569 100644 --- a/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt +++ b/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt @@ -35,6 +35,8 @@ import io.openremote.orlib.R import io.openremote.orlib.databinding.ActivityOrMainBinding import io.openremote.orlib.service.BleProvider import io.openremote.orlib.service.ConnectivityChangeReceiver +import io.openremote.orlib.service.ESPProvisionProvider +import io.openremote.orlib.service.ESPProvisionProviderActions import io.openremote.orlib.service.GeofenceProvider import io.openremote.orlib.service.QrScannerProvider import io.openremote.orlib.service.SecureStorageProvider @@ -73,6 +75,7 @@ open class OrMainActivity : Activity() { private var geofenceProvider: GeofenceProvider? = null private var qrScannerProvider: QrScannerProvider? = null private var bleProvider: BleProvider? = null + private var espProvisionProvider: ESPProvisionProvider? = null private var secureStorageProvider: SecureStorageProvider? = null private var consoleId: String? = null private var connectFailCount: Int = 0 @@ -501,6 +504,16 @@ open class OrMainActivity : Activity() { notifyClient(responseData) } }) + + + } else if (requestCode == ESPProvisionProvider.BLUETOOTH_PERMISSION_ESPPROVISION_REQUEST_CODE || requestCode == ESPProvisionProvider.ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE) { + espProvisionProvider?.onRequestPermissionsResult( + this, + requestCode, + "moduleone-") +// TODO: should retrieve prefix from somewhere + + } else if (requestCode == pushResponseCode) { if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { notifyClient( @@ -588,6 +601,10 @@ open class OrMainActivity : Activity() { provider.equals("ble", ignoreCase = true) -> { handleBleProviderMessage(it) } + + provider.equals("espprovision", ignoreCase = true) -> { + handleESPProvisionProviderMessage(it) + } } } } @@ -942,6 +959,81 @@ open class OrMainActivity : Activity() { } } } + + + @Throws(JSONException::class) + private fun handleESPProvisionProviderMessage(data: JSONObject) { + val action = data.getString("action") + if (espProvisionProvider == null) { + espProvisionProvider = ESPProvisionProvider(activity) + } + when { + action.equals(ESPProvisionProviderActions.PROVIDER_INIT, ignoreCase = true) -> { + val initData: Map = espProvisionProvider!!.initialize() + notifyClient(initData) + } + action.equals(ESPProvisionProviderActions.PROVIDER_ENABLE, ignoreCase = true) -> { + espProvisionProvider?.enable(object : ESPProvisionProvider.ESPProvisionCallback { + override fun accept(responseData: Map) { + notifyClient(responseData) + } + }, activity) + } + + action.equals(ESPProvisionProviderActions.PROVIDER_DISABLE, ignoreCase = true) -> { + val response = espProvisionProvider?.disable() + notifyClient(response) + } + + action.equals(ESPProvisionProviderActions.START_BLE_SCAN, ignoreCase = true) -> { + val prefix = data.optString("prefix", "") + // TODO: store in variable so I can re-use when BLE permissions are received + + espProvisionProvider?.startDevicesScan(prefix, + this@OrMainActivity, + object : ESPProvisionProvider.ESPProvisionCallback { + override fun accept(responseData: Map) { + notifyClient(responseData) + } + }) + } + action.equals(ESPProvisionProviderActions.STOP_BLE_SCAN, ignoreCase = true) -> { + espProvisionProvider?.stopDevicesScan() + } + + action.equals(ESPProvisionProviderActions.CONNECT_TO_DEVICE) -> { + val deviceId = data.optString("id") + if (!deviceId.isNullOrEmpty()) { + espProvisionProvider?.connectTo(deviceId) + } else { + // TODO + // Handle null or empty case here + } + } + + action.equals(ESPProvisionProviderActions.START_WIFI_SCAN) -> { + espProvisionProvider?.startWifiScan() + } + action.equals(ESPProvisionProviderActions.STOP_WIFI_SCAN) -> { + espProvisionProvider?.stopWifiScan() + } + action.equals(ESPProvisionProviderActions.SEND_WIFI_CONFIGURATION) -> { + val ssid = data.optString("ssid") + val password = data.optString("password") + if (!ssid.isNullOrEmpty() && !password.isNullOrEmpty()) { + espProvisionProvider?.sendWifiConfiguration(ssid, password) + } else { + // TODO + } + } + action.equals(ESPProvisionProviderActions.PROVISION_DEVICE) -> { + // handle provision device + } + action.equals(ESPProvisionProviderActions.EXIT_PROVISIONING) -> { + // handle exit provisioning + } + } + } } private fun notifyClient(data: Map?) { diff --git a/ORLib/src/test/java/io/openremote/orlib/service/ESPProvisionProviderTest.kt b/ORLib/src/test/java/io/openremote/orlib/service/ESPProvisionProviderTest.kt new file mode 100644 index 0000000..41c1482 --- /dev/null +++ b/ORLib/src/test/java/io/openremote/orlib/service/ESPProvisionProviderTest.kt @@ -0,0 +1,4 @@ +package io.openremote.orlib.service + +class ESPProvisionProviderTest { +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index e5a57f3..1af6a92 100644 --- a/build.gradle +++ b/build.gradle @@ -55,6 +55,7 @@ allprojects { repositories { google() mavenCentral() + maven { url 'https://jitpack.io' } } } From 210614aaf3030fb2f9e09112e7cc048803ed2377 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Mon, 7 Apr 2025 16:50:01 +0200 Subject: [PATCH 02/16] Implement device disconnect and better handling of connection statuses --- .../orlib/service/ESPProvisionProvider.kt | 3 +- .../service/espprovision/DeviceConnection.kt | 59 ++++++++++++------- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt index fbb0849..3254ae0 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt @@ -198,7 +198,8 @@ class ESPProvisionProvider(val context: Context) { } fun disconnectFromDevice() { - // TODO + wifiProvisioner?.stopWifiScan() + deviceConnection?.disconnectFromDevice() } fun exitProvisioning() { diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt index a92489f..52efc5c 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt @@ -6,7 +6,9 @@ import androidx.annotation.RequiresPermission import com.espressif.provisioning.DeviceConnectionEvent import com.espressif.provisioning.ESPConstants import com.espressif.provisioning.ESPDevice +import io.openremote.orlib.service.ESPProviderErrorCode import io.openremote.orlib.service.ESPProvisionProvider +import io.openremote.orlib.service.ESPProvisionProviderActions import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -48,7 +50,10 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: espDevice?.connectBLEDevice(dev.device, dev.serviceUuid) } -// TODO send status message back + } + + fun disconnectFromDevice() { + espDevice?.disconnectDevice() } fun exitProvisioning() { @@ -78,33 +83,36 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: configChannel = ORConfigChannel() // TODO: should implement / pass device - - callbackChannel?.sendMessage("CONNECT_TO_DEVICE", mapOf( - "id" to (deviceId?.toString() ?: ""), - "status" to "connected")) - // TODO: proper enum for status + sendConnectToDeviceStatus(ESPProviderConnectToDeviceStatus.CONNECTED.value) } -/* - ESPConstants.EVENT_DEVICE_DISCONNECTED -> if (espDevice != null && espDevice!!.getTransportType() == ESPConstants.TransportType.TRANSPORT_BLE) { - Toast.makeText(this@AddDeviceActivity, "Device disconnected", Toast.LENGTH_LONG) - .show() - finish() - } else { - if (!isFinishing()) { - askForManualDeviceConnection() - } + + ESPConstants.EVENT_DEVICE_DISCONNECTED -> { + bleStatus = BLEStatus.DISCONNECTED + configChannel = null + sendConnectToDeviceStatus(ESPProviderConnectToDeviceStatus.DISCONNECTED.value) } - ESPConstants.EVENT_DEVICE_CONNECTION_FAILED -> if (espDevice != null && espDevice!!.getTransportType() == ESPConstants.TransportType.TRANSPORT_BLE) { - alertForDeviceNotSupported("Failed to connect with device") - } else { - if (!isFinishing()) { - askForManualDeviceConnection() - } - }*/ + ESPConstants.EVENT_DEVICE_CONNECTION_FAILED -> { + bleStatus = BLEStatus.DISCONNECTED + + // TODO: can I get some error details ? + sendConnectToDeviceStatus(ESPProviderConnectToDeviceStatus.CONNECTION_ERROR.value) + } } } + private fun sendConnectToDeviceStatus(status: String, error: ESPProviderErrorCode? = null, errorMessage: String? = null) { + val data = mutableMapOf("id" to (deviceId?.toString() ?: ""), "status" to status) + + error?.let { + data["errorCode"] = error.code + } + errorMessage?.let { + data["errorMessage"] = it + } + + callbackChannel?.sendMessage(ESPProvisionProviderActions.CONNECT_TO_DEVICE, data) + } val espDevice: ESPDevice? get() = deviceRegistry.provisionManager?.espDevice @@ -112,6 +120,13 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: val isConnected: Boolean get() = bleStatus == BLEStatus.CONNECTED && espDevice != null && configChannel != null + enum class ESPProviderConnectToDeviceStatus(val value: String) { + CONNECTED("connected"), + DISCONNECTED("disconnected"), + CONNECTION_ERROR("connectionError"); + + override fun toString(): String = value + } enum class BLEStatus { CONNECTING, CONNECTED, From 80c2940b9fb3870e01166f2f75928a02ba1dde7c Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Tue, 8 Apr 2025 11:38:15 +0200 Subject: [PATCH 03/16] Whole ESPProvision flow working but code review/cleaning required --- ORLib/build.gradle | 7 + .../orlib/service/ESPProvisionProvider.kt | 12 +- .../service/espprovision/BatteryProvision.kt | 110 +- .../espprovision/BatteryProvisionAPI.kt | 84 + .../service/espprovision/DeviceConnection.kt | 122 +- .../service/espprovision/ORConfigChannel.kt | 9 +- .../espprovision/ORConfigChannelProtocol.java | 4770 +++++++++++++++++ .../io/openremote/orlib/ui/OrMainActivity.kt | 15 +- 8 files changed, 5114 insertions(+), 15 deletions(-) create mode 100644 ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvisionAPI.kt create mode 100644 ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannelProtocol.java diff --git a/ORLib/build.gradle b/ORLib/build.gradle index 0bcc64d..561fd2f 100644 --- a/ORLib/build.gradle +++ b/ORLib/build.gradle @@ -67,8 +67,15 @@ dependencies { implementation 'com.github.espressif:esp-idf-provisioning-android:lib-2.2.3' implementation 'org.greenrobot:eventbus:3.3.1' + implementation 'com.google.protobuf:protobuf-javalite:4.30.2' + implementation('com.google.protobuf:protobuf-kotlin:4.30.2') { + exclude group: 'com.google.protobuf', module: 'protobuf-java' + } + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' + + implementation 'com.github.iammohdzaki:Password-Generator:0.6' } diff --git a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt index 3254ae0..689783d 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt @@ -16,10 +16,15 @@ import io.openremote.orlib.R import io.openremote.orlib.service.BleProvider.BleCallback import io.openremote.orlib.service.BleProvider.Companion.BLUETOOTH_PERMISSION_REQUEST_CODE import io.openremote.orlib.service.BleProvider.Companion.ENABLE_BLUETOOTH_REQUEST_CODE +import io.openremote.orlib.service.espprovision.BatteryProvision import io.openremote.orlib.service.espprovision.CallbackChannel import io.openremote.orlib.service.espprovision.DeviceConnection import io.openremote.orlib.service.espprovision.DeviceRegistry import io.openremote.orlib.service.espprovision.WifiProvisioner +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import java.net.URL object ESPProvisionProviderActions { const val PROVIDER_INIT = "PROVIDER_INIT" @@ -35,7 +40,7 @@ object ESPProvisionProviderActions { const val EXIT_PROVISIONING = "EXIT_PROVISIONING" } -class ESPProvisionProvider(val context: Context) { +class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://localhost:8080/api/master")) { @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) val deviceRegistry: DeviceRegistry var deviceConnection: DeviceConnection? = null @@ -239,6 +244,11 @@ class ESPProvisionProvider(val context: Context) { fun provisionDevice(userToken: String) { // TODO + + val batteryProvision = BatteryProvision(deviceConnection, deviceRegistry.callbackChannel, apiURL) + CoroutineScope(Dispatchers.Main).launch { // TODO: what's the appropriate dispatcher ? and should this be here or further down the call chain ? + batteryProvision.provision(userToken) + } } private fun requestPermissions(activity: Activity) { diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt index 28887c7..463ad8a 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt @@ -1,8 +1,116 @@ package io.openremote.orlib.service.espprovision -class BatteryProvision(var deviceConnection: DeviceConnection?, var callbackChannel: CallbackChannel?) { +import android.util.Log +import data.entity.Response +import io.openremote.orlib.service.ESPProviderErrorCode +import io.openremote.orlib.service.ESPProvisionProvider +import io.openremote.orlib.service.ESPProvisionProviderActions +import utils.PasswordType +import java.net.URL +import java.util.Locale +import kotlin.coroutines.resume +import kotlin.coroutines.suspendCoroutine + +class BatteryProvision(var deviceConnection: DeviceConnection?, var callbackChannel: CallbackChannel?, var apiURL: URL) { + var batteryProvisionAPI: BatteryProvisionAPI + + var backendConnectionTimeoutMillis = 60_000 + + init { + batteryProvisionAPI = BatteryProvisionAPIREST(apiURL) + } suspend fun provision(userToken: String) { + if (deviceConnection == null || !deviceConnection!!.isConnected) { + sendProvisionDeviceStatus(false, ESPProviderErrorCode.NOT_CONNECTED, "No connection established to device") + } + + try { + val deviceInfo = deviceConnection!!.getDeviceInfo() + Log.d(ESPProvisionProvider.TAG, "Device id is ${deviceInfo.deviceId}") + + val password = generatePassword() + + val assetId = batteryProvisionAPI.provision(deviceInfo.deviceId, password, userToken) + val userName = deviceInfo.deviceId.lowercase(Locale("en")) + + deviceConnection?.sendOpenRemoteConfig( + mqttBrokerUrl = mqttURL, + mqttUser = userName, + mqttPassword = password, + assetId = assetId + ) + + var status = BackendConnectionStatus.CONNECTING + val startTime = System.currentTimeMillis() + + while (status != BackendConnectionStatus.CONNECTED) { + if (System.currentTimeMillis() - startTime > backendConnectionTimeoutMillis) { + sendProvisionDeviceStatus( + connected = false, + error = ESPProviderErrorCode.TIMEOUT_ERROR, + errorMessage = "Timeout waiting for backend to get connected" + ) + return + } + + status = deviceConnection?.getBackendConnectionStatus() + ?: BackendConnectionStatus.DISCONNECTED + } + sendProvisionDeviceStatus(true) + } catch (e: BatteryProvisionAPIError) { + val (errorCode, errorMessage) = mapBatteryProvisionAPIError(e) + sendProvisionDeviceStatus(false, errorCode, errorMessage) + } + } + + private fun sendProvisionDeviceStatus(connected: Boolean, error: ESPProviderErrorCode? = null, errorMessage: String? = null) { + val data = mutableMapOf("connected" to connected) + + error?.let { + data["errorCode"] = it.code + } + errorMessage?.let { + data["errorMessage"] = it + } + callbackChannel?.sendMessage(ESPProvisionProviderActions.PROVISION_DEVICE, data) } + + private fun mapBatteryProvisionAPIError(error: BatteryProvisionAPIError): Pair { + return when (error) { + is BatteryProvisionAPIError.BusinessError, + is BatteryProvisionAPIError.UnknownError -> ESPProviderErrorCode.GENERIC_ERROR to null + + is BatteryProvisionAPIError.GenericError -> ESPProviderErrorCode.GENERIC_ERROR to error.error.localizedMessage + + is BatteryProvisionAPIError.Unauthorized -> ESPProviderErrorCode.SECURITY_ERROR to null + + is BatteryProvisionAPIError.CommunicationError -> ESPProviderErrorCode.COMMUNICATION_ERROR to error.message + } + } + + // Using https://github.com/iammohdzaki/Password-Generator + private suspend fun generatePassword(): String = suspendCoroutine { continuation -> + PasswordGenerator.Builder(PasswordType.RANDOM) + .showLogs(false) + .includeUpperCaseChars(true) + .includeNumbers(true) + .includeLowerCaseChars(true) + .includeSpecialSymbols(false) + .passwordLength(16) + .callback(object : PasswordGenerator.Callback { + override fun onPasswordGenerated(response: Response) { + continuation.resume(response.password) + } + }) + .build() + .generate() + } + + private val mqttURL: String + get() { + // TODO: is this OK or do we want to get the mqtt url from the server? + return "mqtts://${apiURL.host ?: "localhost"}:8883" + } } \ No newline at end of file diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvisionAPI.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvisionAPI.kt new file mode 100644 index 0000000..0e42629 --- /dev/null +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvisionAPI.kt @@ -0,0 +1,84 @@ +package io.openremote.orlib.service.espprovision + +import android.net.Uri +import android.util.Log +import io.openremote.orlib.service.ESPProvisionProvider +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext +import org.json.JSONObject +import java.io.BufferedReader +import java.io.InputStreamReader +import java.io.OutputStreamWriter +import java.net.HttpURLConnection +import java.net.URL + +interface BatteryProvisionAPI { + suspend fun provision(deviceId: String, password: String, token: String): String +} + +class BatteryProvisionAPIREST(private val apiURL: URL) : BatteryProvisionAPI { + + companion object { + private const val TAG = "BatteryProvisionAPIREST" + } + + override suspend fun provision(deviceId: String, password: String, token: String): String = withContext(Dispatchers.IO) { + Log.d(ESPProvisionProvider.TAG, "apiURL $apiURL") + val uri = Uri.parse(apiURL.toString()).buildUpon() + .appendPath("rest") + .appendPath("battery") + .build() + + val url = URL(uri.toString()) + Log.d(ESPProvisionProvider.TAG, "Calling URL $url") + val connection = url.openConnection() as HttpURLConnection + connection.requestMethod = "POST" + connection.setRequestProperty("Content-Type", "application/json") + connection.setRequestProperty("Authorization", "Bearer $token") + connection.doOutput = true + + val requestBody = JSONObject().apply { + put("deviceId", deviceId) + put("password", password) + } + + try { + OutputStreamWriter(connection.outputStream).use { writer -> + writer.write(requestBody.toString()) + writer.flush() + } + + val responseCode = connection.responseCode + val responseText = BufferedReader(InputStreamReader( + if (responseCode in 200..299) connection.inputStream else connection.errorStream + )).use { it.readText() } + + if (responseCode !in 200..299) { + Log.d(ESPProvisionProvider.TAG, "Response code $responseCode") + Log.d(ESPProvisionProvider.TAG, "Response text $responseText") + when (responseCode) { + 401 -> throw BatteryProvisionAPIError.Unauthorized + 409 -> throw BatteryProvisionAPIError.BusinessError + else -> throw BatteryProvisionAPIError.UnknownError + } + } + + val json = JSONObject(responseText) + return@withContext json.getString("assetId") + } catch (e: BatteryProvisionAPIError) { + throw e + } catch (e: Exception) { + throw BatteryProvisionAPIError.GenericError(e) + } finally { + connection.disconnect() + } + } +} + +sealed class BatteryProvisionAPIError(message: String? = null, cause: Throwable? = null) : Exception(message, cause) { + object Unauthorized : BatteryProvisionAPIError("Unauthorized") + data class CommunicationError(val reason: String) : BatteryProvisionAPIError(reason) + object BusinessError : BatteryProvisionAPIError("Business logic error") + data class GenericError(val error: Throwable) : BatteryProvisionAPIError(error.message, error) + object UnknownError : BatteryProvisionAPIError("Unknown error") +} \ No newline at end of file diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt index 52efc5c..b49ba9a 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt @@ -1,6 +1,7 @@ package io.openremote.orlib.service.espprovision import android.Manifest +import android.text.TextUtils import android.util.Log import androidx.annotation.RequiresPermission import com.espressif.provisioning.DeviceConnectionEvent @@ -12,13 +13,22 @@ import io.openremote.orlib.service.ESPProvisionProviderActions import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode +import org.json.JSONException +import org.json.JSONObject import java.util.UUID class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: CallbackChannel? = null) { + companion object { + private const val SEC_TYPE_0: Int = 0 + private const val SEC_TYPE_1: Int = 1 + private const val SEC_TYPE_2: Int = 2 + + } init { EventBus.getDefault().register(this) } @@ -63,25 +73,86 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: // Is IO OK ? CoroutineScope(Dispatchers.IO).launch { try { -// configChannel?.exitProvisioning() + configChannel?.exitProvisioning() } catch (e: Exception) { // Handle error (log or show UI feedback) } } } + fun getDeviceInfo(): DeviceInfo { + // TODO: should check if connected + // TODO: should not block + return runBlocking { + configChannel!!.getDeviceInfo() + } + } + + suspend fun sendOpenRemoteConfig( + mqttBrokerUrl: String, + mqttUser: String, + mqttPassword: String, + assetId: String + ) { +/* if (!isConnected) { + throw ESPProviderException( + errorCode = ESPProviderErrorCode.NOT_CONNECTED, + errorMessage = "No connection established to device" + ) + }*/ + try { + configChannel?.sendOpenRemoteConfig( + mqttBrokerUrl = mqttBrokerUrl, + mqttUser = mqttUser, + mqttPassword = mqttPassword, + assetId = assetId + ) + } catch (e: Exception) { + /* + throw ESPProviderException( + errorCode = ESPProviderErrorCode.COMMUNICATION_ERROR, + errorMessage = e.localizedMessage ?: "Unknown error" + ) + + */ + } + } + + suspend fun getBackendConnectionStatus(): BackendConnectionStatus { + /* + if (!isConnected) { + throw ESPProviderException( + errorCode = ESPProviderErrorCode.NOT_CONNECTED, + errorMessage = "No connection established to device" + ) + }*/ + return try { + configChannel?.getBackendConnectionStatus() + ?: BackendConnectionStatus.DISCONNECTED /*throw ESPProviderException( + errorCode = ESPProviderErrorCode.COMMUNICATION_ERROR, + errorMessage = "Channel returned null status" + )*/ + } catch (e: Exception) { + /* + throw ESPProviderException( + errorCode = ESPProviderErrorCode.COMMUNICATION_ERROR, + errorMessage = e.localizedMessage ?: "Unknown error" + )*/ + } as BackendConnectionStatus + } + @Subscribe(threadMode = ThreadMode.MAIN) fun onDeviceConnectionEvent(event: DeviceConnectionEvent) { when (event.getEventType()) { ESPConstants.EVENT_DEVICE_CONNECTED -> { Log.d(ESPProvisionProvider.TAG, "Device Connected Event Received") -// setSecurityTypeFromVersionInfo() // TODO: do we need this ? - - bleStatus = BLEStatus.CONNECTED - configChannel = ORConfigChannel() // TODO: should implement / pass device + espDevice?.let { device -> + setSecurityTypeFromVersionInfo(device) + configChannel = ORConfigChannel(device) + } sendConnectToDeviceStatus(ESPProviderConnectToDeviceStatus.CONNECTED.value) } @@ -114,6 +185,47 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: callbackChannel?.sendMessage(ESPProvisionProviderActions.CONNECT_TO_DEVICE, data) } + fun setSecurityTypeFromVersionInfo(device: ESPDevice) { + val protoVerStr: String = device.getVersionInfo() + + try { + val jsonObject = JSONObject(protoVerStr) + val provInfo = jsonObject.getJSONObject("prov") + + if (provInfo != null) { + if (provInfo.has("sec_ver")) { + val serVer = provInfo.optInt("sec_ver") + Log.d(ESPProvisionProvider.TAG, "Security Version : " + serVer) + + when (serVer) { + SEC_TYPE_0 -> { + device.setSecurityType(ESPConstants.SecurityType.SECURITY_0) + } + + SEC_TYPE_1 -> { + device.setSecurityType(ESPConstants.SecurityType.SECURITY_1) + } + + SEC_TYPE_2 -> { + device.setSecurityType(ESPConstants.SecurityType.SECURITY_2) + } + + else -> { + device.setSecurityType(ESPConstants.SecurityType.SECURITY_2) + } + } + } else { + device.setSecurityType(ESPConstants.SecurityType.SECURITY_1) + } + } else { + Log.e(ESPProvisionProvider.TAG, "proto-ver info is not available.") + } + } catch (e: JSONException) { + e.printStackTrace() + Log.d(ESPProvisionProvider.TAG, "Capabilities JSON not available.") + } + } + val espDevice: ESPDevice? get() = deviceRegistry.provisionManager?.espDevice diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannel.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannel.kt index ed85bb9..d83dacd 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannel.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannel.kt @@ -2,6 +2,8 @@ package io.openremote.orlib.service.espprovision import com.espressif.provisioning.ESPDevice import com.espressif.provisioning.listeners.ResponseListener +import io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request +import io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response import kotlinx.coroutines.suspendCancellableCoroutine import kotlin.coroutines.resumeWithException @@ -21,11 +23,8 @@ sealed class ORConfigChannelError(message: String) : Exception(message) { object GenericError : ORConfigChannelError("Generic error") } -// TODO: see RequestKt and ResponseKt +class ORConfigChannel(private val device: ESPDevice) { - -class ORConfigChannel(/*private val device: ESPDevice*/) { -/* private var messageId = 0 suspend fun getDeviceInfo(): DeviceInfo { @@ -121,6 +120,4 @@ class ORConfigChannel(/*private val device: ESPDevice*/) { }) } - - */ } \ No newline at end of file diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannelProtocol.java b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannelProtocol.java new file mode 100644 index 0000000..3effae7 --- /dev/null +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/ORConfigChannelProtocol.java @@ -0,0 +1,4770 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: src/main/proto/ORConfigChannelProtocol.proto +// Protobuf Java Version: 4.29.3 + +package io.openremote.orlib.service.espprovision; + +public final class ORConfigChannelProtocol { + private ORConfigChannelProtocol() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + public interface ResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Response) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * string id = 1; + * @return The id. + */ + java.lang.String getId(); + /** + * string id = 1; + * @return The bytes for id. + */ + com.google.protobuf.ByteString + getIdBytes(); + + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + * @return Whether the result field is set. + */ + boolean hasResult(); + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + * @return The result. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult getResult(); + + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + * @return Whether the deviceInfo field is set. + */ + boolean hasDeviceInfo(); + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + * @return The deviceInfo. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo getDeviceInfo(); + + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + * @return Whether the backendConnectionStatus field is set. + */ + boolean hasBackendConnectionStatus(); + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + * @return The backendConnectionStatus. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus getBackendConnectionStatus(); + + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + * @return Whether the openRemoteConfig field is set. + */ + boolean hasOpenRemoteConfig(); + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + * @return The openRemoteConfig. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig getOpenRemoteConfig(); + + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + * @return Whether the exitProvisioning field is set. + */ + boolean hasExitProvisioning(); + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + * @return The exitProvisioning. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning getExitProvisioning(); + + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BodyCase getBodyCase(); + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response} + */ + public static final class Response extends + com.google.protobuf.GeneratedMessageLite< + Response, Response.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Response) + ResponseOrBuilder { + private Response() { + id_ = ""; + } + public interface ResponseResultOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Response.ResponseResult) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @return The enum numeric value on the wire for result. + */ + int getResultValue(); + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @return The result. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.Result getResult(); + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response.ResponseResult} + */ + public static final class ResponseResult extends + com.google.protobuf.GeneratedMessageLite< + ResponseResult, ResponseResult.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Response.ResponseResult) + ResponseResultOrBuilder { + private ResponseResult() { + } + /** + * Protobuf enum {@code io.openremote.orlib.service.espprovision.Response.ResponseResult.Result} + */ + public enum Result + implements com.google.protobuf.Internal.EnumLite { + /** + * SUCCESS = 0; + */ + SUCCESS(0), + /** + * REQUEST_UNKNOWN = 1; + */ + REQUEST_UNKNOWN(1), + /** + * INTERNAL_ERROR = 2; + */ + INTERNAL_ERROR(2), + /** + * ARGUMENT_ERROR = 3; + */ + ARGUMENT_ERROR(3), + UNRECOGNIZED(-1), + ; + + /** + * SUCCESS = 0; + */ + public static final int SUCCESS_VALUE = 0; + /** + * REQUEST_UNKNOWN = 1; + */ + public static final int REQUEST_UNKNOWN_VALUE = 1; + /** + * INTERNAL_ERROR = 2; + */ + public static final int INTERNAL_ERROR_VALUE = 2; + /** + * ARGUMENT_ERROR = 3; + */ + public static final int ARGUMENT_ERROR_VALUE = 3; + + + @java.lang.Override + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Result valueOf(int value) { + return forNumber(value); + } + + public static Result forNumber(int value) { + switch (value) { + case 0: return SUCCESS; + case 1: return REQUEST_UNKNOWN; + case 2: return INTERNAL_ERROR; + case 3: return ARGUMENT_ERROR; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + Result> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + @java.lang.Override + public Result findValueByNumber(int number) { + return Result.forNumber(number); + } + }; + + public static com.google.protobuf.Internal.EnumVerifier + internalGetVerifier() { + return ResultVerifier.INSTANCE; + } + + private static final class ResultVerifier implements + com.google.protobuf.Internal.EnumVerifier { + static final com.google.protobuf.Internal.EnumVerifier INSTANCE = new ResultVerifier(); + @java.lang.Override + public boolean isInRange(int number) { + return Result.forNumber(number) != null; + } + }; + + private final int value; + + private Result(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:io.openremote.orlib.service.espprovision.Response.ResponseResult.Result) + } + + public static final int RESULT_FIELD_NUMBER = 1; + private int result_; + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @return The enum numeric value on the wire for result. + */ + @java.lang.Override + public int getResultValue() { + return result_; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @return The result. + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.Result getResult() { + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.Result result = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.Result.forNumber(result_); + return result == null ? io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.Result.UNRECOGNIZED : result; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @param value The enum numeric value on the wire for result to set. + */ + private void setResultValue(int value) { + result_ = value; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @param value The result to set. + */ + private void setResult(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.Result value) { + result_ = value.getNumber(); + + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + */ + private void clearResult() { + + result_ = 0; + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response.ResponseResult} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Response.ResponseResult) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResultOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @return The enum numeric value on the wire for result. + */ + @java.lang.Override + public int getResultValue() { + return instance.getResultValue(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @param value The result to set. + * @return This builder for chaining. + */ + public Builder setResultValue(int value) { + copyOnWrite(); + instance.setResultValue(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @return The result. + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.Result getResult() { + return instance.getResult(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @param value The enum numeric value on the wire for result to set. + * @return This builder for chaining. + */ + public Builder setResult(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.Result value) { + copyOnWrite(); + instance.setResult(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult.Result result = 1; + * @return This builder for chaining. + */ + public Builder clearResult() { + copyOnWrite(); + instance.clearResult(); + return this; + } + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Response.ResponseResult) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "result_", + }; + java.lang.String info = + "\u0000\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0001\f"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Response.ResponseResult) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult DEFAULT_INSTANCE; + static { + ResponseResult defaultInstance = new ResponseResult(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + ResponseResult.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface OpenRemoteConfigOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @return The enum numeric value on the wire for status. + */ + int getStatusValue(); + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @return The status. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.Status getStatus(); + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig} + */ + public static final class OpenRemoteConfig extends + com.google.protobuf.GeneratedMessageLite< + OpenRemoteConfig, OpenRemoteConfig.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig) + OpenRemoteConfigOrBuilder { + private OpenRemoteConfig() { + } + /** + * Protobuf enum {@code io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status} + */ + public enum Status + implements com.google.protobuf.Internal.EnumLite { + /** + * SUCCESS = 0; + */ + SUCCESS(0), + /** + * FAIL = 1; + */ + FAIL(1), + UNRECOGNIZED(-1), + ; + + /** + * SUCCESS = 0; + */ + public static final int SUCCESS_VALUE = 0; + /** + * FAIL = 1; + */ + public static final int FAIL_VALUE = 1; + + + @java.lang.Override + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Status valueOf(int value) { + return forNumber(value); + } + + public static Status forNumber(int value) { + switch (value) { + case 0: return SUCCESS; + case 1: return FAIL; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + Status> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + @java.lang.Override + public Status findValueByNumber(int number) { + return Status.forNumber(number); + } + }; + + public static com.google.protobuf.Internal.EnumVerifier + internalGetVerifier() { + return StatusVerifier.INSTANCE; + } + + private static final class StatusVerifier implements + com.google.protobuf.Internal.EnumVerifier { + static final com.google.protobuf.Internal.EnumVerifier INSTANCE = new StatusVerifier(); + @java.lang.Override + public boolean isInRange(int number) { + return Status.forNumber(number) != null; + } + }; + + private final int value; + + private Status(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status) + } + + public static final int STATUS_FIELD_NUMBER = 1; + private int status_; + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @return The enum numeric value on the wire for status. + */ + @java.lang.Override + public int getStatusValue() { + return status_; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @return The status. + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.Status getStatus() { + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.Status result = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.Status.forNumber(status_); + return result == null ? io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.Status.UNRECOGNIZED : result; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @param value The enum numeric value on the wire for status to set. + */ + private void setStatusValue(int value) { + status_ = value; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @param value The status to set. + */ + private void setStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.Status value) { + status_ = value.getNumber(); + + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + */ + private void clearStatus() { + + status_ = 0; + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfigOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @return The enum numeric value on the wire for status. + */ + @java.lang.Override + public int getStatusValue() { + return instance.getStatusValue(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @param value The status to set. + * @return This builder for chaining. + */ + public Builder setStatusValue(int value) { + copyOnWrite(); + instance.setStatusValue(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @return The status. + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.Status getStatus() { + return instance.getStatus(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @param value The enum numeric value on the wire for status to set. + * @return This builder for chaining. + */ + public Builder setStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.Status value) { + copyOnWrite(); + instance.setStatus(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig.Status status = 1; + * @return This builder for chaining. + */ + public Builder clearStatus() { + copyOnWrite(); + instance.clearStatus(); + return this; + } + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "status_", + }; + java.lang.String info = + "\u0000\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0001\f"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig DEFAULT_INSTANCE; + static { + OpenRemoteConfig defaultInstance = new OpenRemoteConfig(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + OpenRemoteConfig.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface BackendConnectionStatusOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @return The enum numeric value on the wire for status. + */ + int getStatusValue(); + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @return The status. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.Status getStatus(); + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus} + */ + public static final class BackendConnectionStatus extends + com.google.protobuf.GeneratedMessageLite< + BackendConnectionStatus, BackendConnectionStatus.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus) + BackendConnectionStatusOrBuilder { + private BackendConnectionStatus() { + } + /** + * Protobuf enum {@code io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status} + */ + public enum Status + implements com.google.protobuf.Internal.EnumLite { + /** + * DISCONNECTED = 0; + */ + DISCONNECTED(0), + /** + * CONNECTING = 1; + */ + CONNECTING(1), + /** + * CONNECTED = 2; + */ + CONNECTED(2), + /** + * FAILED = 3; + */ + FAILED(3), + UNRECOGNIZED(-1), + ; + + /** + * DISCONNECTED = 0; + */ + public static final int DISCONNECTED_VALUE = 0; + /** + * CONNECTING = 1; + */ + public static final int CONNECTING_VALUE = 1; + /** + * CONNECTED = 2; + */ + public static final int CONNECTED_VALUE = 2; + /** + * FAILED = 3; + */ + public static final int FAILED_VALUE = 3; + + + @java.lang.Override + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Status valueOf(int value) { + return forNumber(value); + } + + public static Status forNumber(int value) { + switch (value) { + case 0: return DISCONNECTED; + case 1: return CONNECTING; + case 2: return CONNECTED; + case 3: return FAILED; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + Status> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + @java.lang.Override + public Status findValueByNumber(int number) { + return Status.forNumber(number); + } + }; + + public static com.google.protobuf.Internal.EnumVerifier + internalGetVerifier() { + return StatusVerifier.INSTANCE; + } + + private static final class StatusVerifier implements + com.google.protobuf.Internal.EnumVerifier { + static final com.google.protobuf.Internal.EnumVerifier INSTANCE = new StatusVerifier(); + @java.lang.Override + public boolean isInRange(int number) { + return Status.forNumber(number) != null; + } + }; + + private final int value; + + private Status(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status) + } + + public static final int STATUS_FIELD_NUMBER = 1; + private int status_; + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @return The enum numeric value on the wire for status. + */ + @java.lang.Override + public int getStatusValue() { + return status_; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @return The status. + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.Status getStatus() { + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.Status result = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.Status.forNumber(status_); + return result == null ? io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.Status.UNRECOGNIZED : result; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @param value The enum numeric value on the wire for status to set. + */ + private void setStatusValue(int value) { + status_ = value; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @param value The status to set. + */ + private void setStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.Status value) { + status_ = value.getNumber(); + + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + */ + private void clearStatus() { + + status_ = 0; + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatusOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @return The enum numeric value on the wire for status. + */ + @java.lang.Override + public int getStatusValue() { + return instance.getStatusValue(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @param value The status to set. + * @return This builder for chaining. + */ + public Builder setStatusValue(int value) { + copyOnWrite(); + instance.setStatusValue(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @return The status. + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.Status getStatus() { + return instance.getStatus(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @param value The enum numeric value on the wire for status to set. + * @return This builder for chaining. + */ + public Builder setStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.Status value) { + copyOnWrite(); + instance.setStatus(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus.Status status = 1; + * @return This builder for chaining. + */ + public Builder clearStatus() { + copyOnWrite(); + instance.clearStatus(); + return this; + } + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "status_", + }; + java.lang.String info = + "\u0000\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0001\f"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus DEFAULT_INSTANCE; + static { + BackendConnectionStatus defaultInstance = new BackendConnectionStatus(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + BackendConnectionStatus.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface DeviceInfoOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Response.DeviceInfo) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * string device_id = 1; + * @return The deviceId. + */ + java.lang.String getDeviceId(); + /** + * string device_id = 1; + * @return The bytes for deviceId. + */ + com.google.protobuf.ByteString + getDeviceIdBytes(); + + /** + * string model_name = 3; + * @return The modelName. + */ + java.lang.String getModelName(); + /** + * string model_name = 3; + * @return The bytes for modelName. + */ + com.google.protobuf.ByteString + getModelNameBytes(); + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response.DeviceInfo} + */ + public static final class DeviceInfo extends + com.google.protobuf.GeneratedMessageLite< + DeviceInfo, DeviceInfo.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Response.DeviceInfo) + DeviceInfoOrBuilder { + private DeviceInfo() { + deviceId_ = ""; + modelName_ = ""; + } + public static final int DEVICE_ID_FIELD_NUMBER = 1; + private java.lang.String deviceId_; + /** + * string device_id = 1; + * @return The deviceId. + */ + @java.lang.Override + public java.lang.String getDeviceId() { + return deviceId_; + } + /** + * string device_id = 1; + * @return The bytes for deviceId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDeviceIdBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(deviceId_); + } + /** + * string device_id = 1; + * @param value The deviceId to set. + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setDeviceId( + java.lang.String value) { + value.getClass(); // minimal bytecode null check + + deviceId_ = value; + } + /** + * string device_id = 1; + */ + private void clearDeviceId() { + + deviceId_ = getDefaultInstance().getDeviceId(); + } + /** + * string device_id = 1; + * @param value The bytes for deviceId to set. + */ + private void setDeviceIdBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + deviceId_ = value.toStringUtf8(); + + } + + public static final int MODEL_NAME_FIELD_NUMBER = 3; + private java.lang.String modelName_; + /** + * string model_name = 3; + * @return The modelName. + */ + @java.lang.Override + public java.lang.String getModelName() { + return modelName_; + } + /** + * string model_name = 3; + * @return The bytes for modelName. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getModelNameBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(modelName_); + } + /** + * string model_name = 3; + * @param value The modelName to set. + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setModelName( + java.lang.String value) { + value.getClass(); // minimal bytecode null check + + modelName_ = value; + } + /** + * string model_name = 3; + */ + private void clearModelName() { + + modelName_ = getDefaultInstance().getModelName(); + } + /** + * string model_name = 3; + * @param value The bytes for modelName to set. + */ + private void setModelNameBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + modelName_ = value.toStringUtf8(); + + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response.DeviceInfo} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Response.DeviceInfo) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfoOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * string device_id = 1; + * @return The deviceId. + */ + @java.lang.Override + public java.lang.String getDeviceId() { + return instance.getDeviceId(); + } + /** + * string device_id = 1; + * @return The bytes for deviceId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDeviceIdBytes() { + return instance.getDeviceIdBytes(); + } + /** + * string device_id = 1; + * @param value The deviceId to set. + * @return This builder for chaining. + */ + public Builder setDeviceId( + java.lang.String value) { + copyOnWrite(); + instance.setDeviceId(value); + return this; + } + /** + * string device_id = 1; + * @return This builder for chaining. + */ + public Builder clearDeviceId() { + copyOnWrite(); + instance.clearDeviceId(); + return this; + } + /** + * string device_id = 1; + * @param value The bytes for deviceId to set. + * @return This builder for chaining. + */ + public Builder setDeviceIdBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setDeviceIdBytes(value); + return this; + } + + /** + * string model_name = 3; + * @return The modelName. + */ + @java.lang.Override + public java.lang.String getModelName() { + return instance.getModelName(); + } + /** + * string model_name = 3; + * @return The bytes for modelName. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getModelNameBytes() { + return instance.getModelNameBytes(); + } + /** + * string model_name = 3; + * @param value The modelName to set. + * @return This builder for chaining. + */ + public Builder setModelName( + java.lang.String value) { + copyOnWrite(); + instance.setModelName(value); + return this; + } + /** + * string model_name = 3; + * @return This builder for chaining. + */ + public Builder clearModelName() { + copyOnWrite(); + instance.clearModelName(); + return this; + } + /** + * string model_name = 3; + * @param value The bytes for modelName to set. + * @return This builder for chaining. + */ + public Builder setModelNameBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setModelNameBytes(value); + return this; + } + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Response.DeviceInfo) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "deviceId_", + "modelName_", + }; + java.lang.String info = + "\u0000\u0002\u0000\u0000\u0001\u0003\u0002\u0000\u0000\u0000\u0001\u0208\u0003\u0208" + + ""; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Response.DeviceInfo) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo DEFAULT_INSTANCE; + static { + DeviceInfo defaultInstance = new DeviceInfo(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + DeviceInfo.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface ExitProvisioningOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Response.ExitProvisioning) + com.google.protobuf.MessageLiteOrBuilder { + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response.ExitProvisioning} + */ + public static final class ExitProvisioning extends + com.google.protobuf.GeneratedMessageLite< + ExitProvisioning, ExitProvisioning.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Response.ExitProvisioning) + ExitProvisioningOrBuilder { + private ExitProvisioning() { + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response.ExitProvisioning} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Response.ExitProvisioning) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioningOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Response.ExitProvisioning) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = null;java.lang.String info = + "\u0000\u0000"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Response.ExitProvisioning) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning DEFAULT_INSTANCE; + static { + ExitProvisioning defaultInstance = new ExitProvisioning(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + ExitProvisioning.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + private int bitField0_; + private int bodyCase_ = 0; + private java.lang.Object body_; + public enum BodyCase { + DEVICE_INFO(6), + BACKEND_CONNECTION_STATUS(7), + OPEN_REMOTE_CONFIG(8), + EXIT_PROVISIONING(9), + BODY_NOT_SET(0); + private final int value; + private BodyCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static BodyCase valueOf(int value) { + return forNumber(value); + } + + public static BodyCase forNumber(int value) { + switch (value) { + case 6: return DEVICE_INFO; + case 7: return BACKEND_CONNECTION_STATUS; + case 8: return OPEN_REMOTE_CONFIG; + case 9: return EXIT_PROVISIONING; + case 0: return BODY_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + @java.lang.Override + public BodyCase + getBodyCase() { + return BodyCase.forNumber( + bodyCase_); + } + + private void clearBody() { + bodyCase_ = 0; + body_ = null; + } + + public static final int ID_FIELD_NUMBER = 1; + private java.lang.String id_; + /** + * string id = 1; + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + return id_; + } + /** + * string id = 1; + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getIdBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(id_); + } + /** + * string id = 1; + * @param value The id to set. + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setId( + java.lang.String value) { + value.getClass(); // minimal bytecode null check + + id_ = value; + } + /** + * string id = 1; + */ + private void clearId() { + + id_ = getDefaultInstance().getId(); + } + /** + * string id = 1; + * @param value The bytes for id to set. + */ + private void setIdBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + id_ = value.toStringUtf8(); + + } + + public static final int RESULT_FIELD_NUMBER = 2; + private io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult result_; + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + @java.lang.Override + public boolean hasResult() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult getResult() { + return result_ == null ? io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.getDefaultInstance() : result_; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setResult(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult value) { + value.getClass(); // minimal bytecode null check + result_ = value; + bitField0_ |= 0x00000001; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + @java.lang.SuppressWarnings({"ReferenceEquality", "ReturnValueIgnored"}) + private void mergeResult(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult value) { + value.getClass(); // minimal bytecode null check + if (result_ != null && + result_ != io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.getDefaultInstance()) { + result_ = + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.newBuilder(result_).mergeFrom(value).buildPartial(); + } else { + result_ = value; + } + bitField0_ |= 0x00000001; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + private void clearResult() { result_ = null; + bitField0_ = (bitField0_ & ~0x00000001); + } + + public static final int DEVICE_INFO_FIELD_NUMBER = 6; + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + @java.lang.Override + public boolean hasDeviceInfo() { + return bodyCase_ == 6; + } + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo getDeviceInfo() { + if (bodyCase_ == 6) { + return (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo) body_; + } + return io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo.getDefaultInstance(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setDeviceInfo(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo value) { + value.getClass(); // minimal bytecode null check + body_ = value; + bodyCase_ = 6; + } + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void mergeDeviceInfo(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo value) { + value.getClass(); // minimal bytecode null check + if (bodyCase_ == 6 && + body_ != io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo.getDefaultInstance()) { + body_ = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo.newBuilder((io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo) body_) + .mergeFrom(value).buildPartial(); + } else { + body_ = value; + } + bodyCase_ = 6; + } + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + private void clearDeviceInfo() { + if (bodyCase_ == 6) { + bodyCase_ = 0; + body_ = null; + } + } + + public static final int BACKEND_CONNECTION_STATUS_FIELD_NUMBER = 7; + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.Override + public boolean hasBackendConnectionStatus() { + return bodyCase_ == 7; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus getBackendConnectionStatus() { + if (bodyCase_ == 7) { + return (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus) body_; + } + return io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.getDefaultInstance(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setBackendConnectionStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus value) { + value.getClass(); // minimal bytecode null check + body_ = value; + bodyCase_ = 7; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void mergeBackendConnectionStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus value) { + value.getClass(); // minimal bytecode null check + if (bodyCase_ == 7 && + body_ != io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.getDefaultInstance()) { + body_ = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.newBuilder((io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus) body_) + .mergeFrom(value).buildPartial(); + } else { + body_ = value; + } + bodyCase_ = 7; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + private void clearBackendConnectionStatus() { + if (bodyCase_ == 7) { + bodyCase_ = 0; + body_ = null; + } + } + + public static final int OPEN_REMOTE_CONFIG_FIELD_NUMBER = 8; + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.Override + public boolean hasOpenRemoteConfig() { + return bodyCase_ == 8; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig getOpenRemoteConfig() { + if (bodyCase_ == 8) { + return (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig) body_; + } + return io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.getDefaultInstance(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setOpenRemoteConfig(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig value) { + value.getClass(); // minimal bytecode null check + body_ = value; + bodyCase_ = 8; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void mergeOpenRemoteConfig(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig value) { + value.getClass(); // minimal bytecode null check + if (bodyCase_ == 8 && + body_ != io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.getDefaultInstance()) { + body_ = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.newBuilder((io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig) body_) + .mergeFrom(value).buildPartial(); + } else { + body_ = value; + } + bodyCase_ = 8; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + private void clearOpenRemoteConfig() { + if (bodyCase_ == 8) { + bodyCase_ = 0; + body_ = null; + } + } + + public static final int EXIT_PROVISIONING_FIELD_NUMBER = 9; + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.Override + public boolean hasExitProvisioning() { + return bodyCase_ == 9; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning getExitProvisioning() { + if (bodyCase_ == 9) { + return (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning) body_; + } + return io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning.getDefaultInstance(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setExitProvisioning(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning value) { + value.getClass(); // minimal bytecode null check + body_ = value; + bodyCase_ = 9; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void mergeExitProvisioning(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning value) { + value.getClass(); // minimal bytecode null check + if (bodyCase_ == 9 && + body_ != io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning.getDefaultInstance()) { + body_ = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning.newBuilder((io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning) body_) + .mergeFrom(value).buildPartial(); + } else { + body_ = value; + } + bodyCase_ = 9; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + private void clearExitProvisioning() { + if (bodyCase_ == 9) { + bodyCase_ = 0; + body_ = null; + } + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Response} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Response) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.ResponseOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + @java.lang.Override + public BodyCase + getBodyCase() { + return instance.getBodyCase(); + } + + public Builder clearBody() { + copyOnWrite(); + instance.clearBody(); + return this; + } + + + /** + * string id = 1; + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + return instance.getId(); + } + /** + * string id = 1; + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getIdBytes() { + return instance.getIdBytes(); + } + /** + * string id = 1; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId( + java.lang.String value) { + copyOnWrite(); + instance.setId(value); + return this; + } + /** + * string id = 1; + * @return This builder for chaining. + */ + public Builder clearId() { + copyOnWrite(); + instance.clearId(); + return this; + } + /** + * string id = 1; + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setIdBytes(value); + return this; + } + + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + @java.lang.Override + public boolean hasResult() { + return instance.hasResult(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult getResult() { + return instance.getResult(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + public Builder setResult(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult value) { + copyOnWrite(); + instance.setResult(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + public Builder setResult( + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult.Builder builderForValue) { + copyOnWrite(); + instance.setResult(builderForValue.build()); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + public Builder mergeResult(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ResponseResult value) { + copyOnWrite(); + instance.mergeResult(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ResponseResult result = 2; + */ + public Builder clearResult() { copyOnWrite(); + instance.clearResult(); + return this; + } + + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + @java.lang.Override + public boolean hasDeviceInfo() { + return instance.hasDeviceInfo(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo getDeviceInfo() { + return instance.getDeviceInfo(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + public Builder setDeviceInfo(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo value) { + copyOnWrite(); + instance.setDeviceInfo(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + public Builder setDeviceInfo( + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo.Builder builderForValue) { + copyOnWrite(); + instance.setDeviceInfo(builderForValue.build()); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + public Builder mergeDeviceInfo(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo value) { + copyOnWrite(); + instance.mergeDeviceInfo(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.DeviceInfo device_info = 6; + */ + public Builder clearDeviceInfo() { + copyOnWrite(); + instance.clearDeviceInfo(); + return this; + } + + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.Override + public boolean hasBackendConnectionStatus() { + return instance.hasBackendConnectionStatus(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus getBackendConnectionStatus() { + return instance.getBackendConnectionStatus(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + public Builder setBackendConnectionStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus value) { + copyOnWrite(); + instance.setBackendConnectionStatus(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + public Builder setBackendConnectionStatus( + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.Builder builderForValue) { + copyOnWrite(); + instance.setBackendConnectionStatus(builderForValue.build()); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + public Builder mergeBackendConnectionStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus value) { + copyOnWrite(); + instance.mergeBackendConnectionStatus(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.BackendConnectionStatus backend_connection_status = 7; + */ + public Builder clearBackendConnectionStatus() { + copyOnWrite(); + instance.clearBackendConnectionStatus(); + return this; + } + + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.Override + public boolean hasOpenRemoteConfig() { + return instance.hasOpenRemoteConfig(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig getOpenRemoteConfig() { + return instance.getOpenRemoteConfig(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + public Builder setOpenRemoteConfig(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig value) { + copyOnWrite(); + instance.setOpenRemoteConfig(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + public Builder setOpenRemoteConfig( + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.Builder builderForValue) { + copyOnWrite(); + instance.setOpenRemoteConfig(builderForValue.build()); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + public Builder mergeOpenRemoteConfig(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig value) { + copyOnWrite(); + instance.mergeOpenRemoteConfig(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.OpenRemoteConfig open_remote_config = 8; + */ + public Builder clearOpenRemoteConfig() { + copyOnWrite(); + instance.clearOpenRemoteConfig(); + return this; + } + + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.Override + public boolean hasExitProvisioning() { + return instance.hasExitProvisioning(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning getExitProvisioning() { + return instance.getExitProvisioning(); + } + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + public Builder setExitProvisioning(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning value) { + copyOnWrite(); + instance.setExitProvisioning(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + public Builder setExitProvisioning( + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning.Builder builderForValue) { + copyOnWrite(); + instance.setExitProvisioning(builderForValue.build()); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + public Builder mergeExitProvisioning(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning value) { + copyOnWrite(); + instance.mergeExitProvisioning(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Response.ExitProvisioning exit_provisioning = 9; + */ + public Builder clearExitProvisioning() { + copyOnWrite(); + instance.clearExitProvisioning(); + return this; + } + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Response) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "body_", + "bodyCase_", + "bitField0_", + "id_", + "result_", + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.DeviceInfo.class, + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.BackendConnectionStatus.class, + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.OpenRemoteConfig.class, + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.ExitProvisioning.class, + }; + java.lang.String info = + "\u0000\u0006\u0001\u0001\u0001\t\u0006\u0000\u0000\u0000\u0001\u0208\u0002\u1009" + + "\u0000\u0006<\u0000\u0007<\u0000\b<\u0000\t<\u0000"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Response) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response DEFAULT_INSTANCE; + static { + Response defaultInstance = new Response(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + Response.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Response getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface RequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Request) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * string id = 1; + * @return The id. + */ + java.lang.String getId(); + /** + * string id = 1; + * @return The bytes for id. + */ + com.google.protobuf.ByteString + getIdBytes(); + + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + * @return Whether the deviceInfo field is set. + */ + boolean hasDeviceInfo(); + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + * @return The deviceInfo. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo getDeviceInfo(); + + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + * @return Whether the backendConnectionStatus field is set. + */ + boolean hasBackendConnectionStatus(); + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + * @return The backendConnectionStatus. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus getBackendConnectionStatus(); + + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + * @return Whether the openRemoteConfig field is set. + */ + boolean hasOpenRemoteConfig(); + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + * @return The openRemoteConfig. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig getOpenRemoteConfig(); + + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + * @return Whether the exitProvisioning field is set. + */ + boolean hasExitProvisioning(); + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + * @return The exitProvisioning. + */ + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning getExitProvisioning(); + + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BodyCase getBodyCase(); + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Request} + */ + public static final class Request extends + com.google.protobuf.GeneratedMessageLite< + Request, Request.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Request) + RequestOrBuilder { + private Request() { + id_ = ""; + } + public interface DeviceInfoOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Request.DeviceInfo) + com.google.protobuf.MessageLiteOrBuilder { + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Request.DeviceInfo} + */ + public static final class DeviceInfo extends + com.google.protobuf.GeneratedMessageLite< + DeviceInfo, DeviceInfo.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Request.DeviceInfo) + DeviceInfoOrBuilder { + private DeviceInfo() { + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Request.DeviceInfo} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Request.DeviceInfo) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfoOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Request.DeviceInfo) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = null;java.lang.String info = + "\u0000\u0000"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Request.DeviceInfo) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo DEFAULT_INSTANCE; + static { + DeviceInfo defaultInstance = new DeviceInfo(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + DeviceInfo.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface BackendConnectionStatusOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus) + com.google.protobuf.MessageLiteOrBuilder { + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus} + */ + public static final class BackendConnectionStatus extends + com.google.protobuf.GeneratedMessageLite< + BackendConnectionStatus, BackendConnectionStatus.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus) + BackendConnectionStatusOrBuilder { + private BackendConnectionStatus() { + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatusOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = null;java.lang.String info = + "\u0000\u0000"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus DEFAULT_INSTANCE; + static { + BackendConnectionStatus defaultInstance = new BackendConnectionStatus(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + BackendConnectionStatus.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface OpenRemoteConfigOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * string mqtt_broker_url = 1; + * @return The mqttBrokerUrl. + */ + java.lang.String getMqttBrokerUrl(); + /** + * string mqtt_broker_url = 1; + * @return The bytes for mqttBrokerUrl. + */ + com.google.protobuf.ByteString + getMqttBrokerUrlBytes(); + + /** + * string user = 2; + * @return The user. + */ + java.lang.String getUser(); + /** + * string user = 2; + * @return The bytes for user. + */ + com.google.protobuf.ByteString + getUserBytes(); + + /** + * string mqtt_password = 3; + * @return The mqttPassword. + */ + java.lang.String getMqttPassword(); + /** + * string mqtt_password = 3; + * @return The bytes for mqttPassword. + */ + com.google.protobuf.ByteString + getMqttPasswordBytes(); + + /** + * string realm = 4; + * @return The realm. + */ + java.lang.String getRealm(); + /** + * string realm = 4; + * @return The bytes for realm. + */ + com.google.protobuf.ByteString + getRealmBytes(); + + /** + * string asset_id = 5; + * @return The assetId. + */ + java.lang.String getAssetId(); + /** + * string asset_id = 5; + * @return The bytes for assetId. + */ + com.google.protobuf.ByteString + getAssetIdBytes(); + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig} + */ + public static final class OpenRemoteConfig extends + com.google.protobuf.GeneratedMessageLite< + OpenRemoteConfig, OpenRemoteConfig.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig) + OpenRemoteConfigOrBuilder { + private OpenRemoteConfig() { + mqttBrokerUrl_ = ""; + user_ = ""; + mqttPassword_ = ""; + realm_ = ""; + assetId_ = ""; + } + public static final int MQTT_BROKER_URL_FIELD_NUMBER = 1; + private java.lang.String mqttBrokerUrl_; + /** + * string mqtt_broker_url = 1; + * @return The mqttBrokerUrl. + */ + @java.lang.Override + public java.lang.String getMqttBrokerUrl() { + return mqttBrokerUrl_; + } + /** + * string mqtt_broker_url = 1; + * @return The bytes for mqttBrokerUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMqttBrokerUrlBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(mqttBrokerUrl_); + } + /** + * string mqtt_broker_url = 1; + * @param value The mqttBrokerUrl to set. + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setMqttBrokerUrl( + java.lang.String value) { + value.getClass(); // minimal bytecode null check + + mqttBrokerUrl_ = value; + } + /** + * string mqtt_broker_url = 1; + */ + private void clearMqttBrokerUrl() { + + mqttBrokerUrl_ = getDefaultInstance().getMqttBrokerUrl(); + } + /** + * string mqtt_broker_url = 1; + * @param value The bytes for mqttBrokerUrl to set. + */ + private void setMqttBrokerUrlBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + mqttBrokerUrl_ = value.toStringUtf8(); + + } + + public static final int USER_FIELD_NUMBER = 2; + private java.lang.String user_; + /** + * string user = 2; + * @return The user. + */ + @java.lang.Override + public java.lang.String getUser() { + return user_; + } + /** + * string user = 2; + * @return The bytes for user. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUserBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(user_); + } + /** + * string user = 2; + * @param value The user to set. + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setUser( + java.lang.String value) { + value.getClass(); // minimal bytecode null check + + user_ = value; + } + /** + * string user = 2; + */ + private void clearUser() { + + user_ = getDefaultInstance().getUser(); + } + /** + * string user = 2; + * @param value The bytes for user to set. + */ + private void setUserBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + user_ = value.toStringUtf8(); + + } + + public static final int MQTT_PASSWORD_FIELD_NUMBER = 3; + private java.lang.String mqttPassword_; + /** + * string mqtt_password = 3; + * @return The mqttPassword. + */ + @java.lang.Override + public java.lang.String getMqttPassword() { + return mqttPassword_; + } + /** + * string mqtt_password = 3; + * @return The bytes for mqttPassword. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMqttPasswordBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(mqttPassword_); + } + /** + * string mqtt_password = 3; + * @param value The mqttPassword to set. + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setMqttPassword( + java.lang.String value) { + value.getClass(); // minimal bytecode null check + + mqttPassword_ = value; + } + /** + * string mqtt_password = 3; + */ + private void clearMqttPassword() { + + mqttPassword_ = getDefaultInstance().getMqttPassword(); + } + /** + * string mqtt_password = 3; + * @param value The bytes for mqttPassword to set. + */ + private void setMqttPasswordBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + mqttPassword_ = value.toStringUtf8(); + + } + + public static final int REALM_FIELD_NUMBER = 4; + private java.lang.String realm_; + /** + * string realm = 4; + * @return The realm. + */ + @java.lang.Override + public java.lang.String getRealm() { + return realm_; + } + /** + * string realm = 4; + * @return The bytes for realm. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRealmBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(realm_); + } + /** + * string realm = 4; + * @param value The realm to set. + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setRealm( + java.lang.String value) { + value.getClass(); // minimal bytecode null check + + realm_ = value; + } + /** + * string realm = 4; + */ + private void clearRealm() { + + realm_ = getDefaultInstance().getRealm(); + } + /** + * string realm = 4; + * @param value The bytes for realm to set. + */ + private void setRealmBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + realm_ = value.toStringUtf8(); + + } + + public static final int ASSET_ID_FIELD_NUMBER = 5; + private java.lang.String assetId_; + /** + * string asset_id = 5; + * @return The assetId. + */ + @java.lang.Override + public java.lang.String getAssetId() { + return assetId_; + } + /** + * string asset_id = 5; + * @return The bytes for assetId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getAssetIdBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(assetId_); + } + /** + * string asset_id = 5; + * @param value The assetId to set. + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setAssetId( + java.lang.String value) { + value.getClass(); // minimal bytecode null check + + assetId_ = value; + } + /** + * string asset_id = 5; + */ + private void clearAssetId() { + + assetId_ = getDefaultInstance().getAssetId(); + } + /** + * string asset_id = 5; + * @param value The bytes for assetId to set. + */ + private void setAssetIdBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + assetId_ = value.toStringUtf8(); + + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfigOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * string mqtt_broker_url = 1; + * @return The mqttBrokerUrl. + */ + @java.lang.Override + public java.lang.String getMqttBrokerUrl() { + return instance.getMqttBrokerUrl(); + } + /** + * string mqtt_broker_url = 1; + * @return The bytes for mqttBrokerUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMqttBrokerUrlBytes() { + return instance.getMqttBrokerUrlBytes(); + } + /** + * string mqtt_broker_url = 1; + * @param value The mqttBrokerUrl to set. + * @return This builder for chaining. + */ + public Builder setMqttBrokerUrl( + java.lang.String value) { + copyOnWrite(); + instance.setMqttBrokerUrl(value); + return this; + } + /** + * string mqtt_broker_url = 1; + * @return This builder for chaining. + */ + public Builder clearMqttBrokerUrl() { + copyOnWrite(); + instance.clearMqttBrokerUrl(); + return this; + } + /** + * string mqtt_broker_url = 1; + * @param value The bytes for mqttBrokerUrl to set. + * @return This builder for chaining. + */ + public Builder setMqttBrokerUrlBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setMqttBrokerUrlBytes(value); + return this; + } + + /** + * string user = 2; + * @return The user. + */ + @java.lang.Override + public java.lang.String getUser() { + return instance.getUser(); + } + /** + * string user = 2; + * @return The bytes for user. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUserBytes() { + return instance.getUserBytes(); + } + /** + * string user = 2; + * @param value The user to set. + * @return This builder for chaining. + */ + public Builder setUser( + java.lang.String value) { + copyOnWrite(); + instance.setUser(value); + return this; + } + /** + * string user = 2; + * @return This builder for chaining. + */ + public Builder clearUser() { + copyOnWrite(); + instance.clearUser(); + return this; + } + /** + * string user = 2; + * @param value The bytes for user to set. + * @return This builder for chaining. + */ + public Builder setUserBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setUserBytes(value); + return this; + } + + /** + * string mqtt_password = 3; + * @return The mqttPassword. + */ + @java.lang.Override + public java.lang.String getMqttPassword() { + return instance.getMqttPassword(); + } + /** + * string mqtt_password = 3; + * @return The bytes for mqttPassword. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMqttPasswordBytes() { + return instance.getMqttPasswordBytes(); + } + /** + * string mqtt_password = 3; + * @param value The mqttPassword to set. + * @return This builder for chaining. + */ + public Builder setMqttPassword( + java.lang.String value) { + copyOnWrite(); + instance.setMqttPassword(value); + return this; + } + /** + * string mqtt_password = 3; + * @return This builder for chaining. + */ + public Builder clearMqttPassword() { + copyOnWrite(); + instance.clearMqttPassword(); + return this; + } + /** + * string mqtt_password = 3; + * @param value The bytes for mqttPassword to set. + * @return This builder for chaining. + */ + public Builder setMqttPasswordBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setMqttPasswordBytes(value); + return this; + } + + /** + * string realm = 4; + * @return The realm. + */ + @java.lang.Override + public java.lang.String getRealm() { + return instance.getRealm(); + } + /** + * string realm = 4; + * @return The bytes for realm. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRealmBytes() { + return instance.getRealmBytes(); + } + /** + * string realm = 4; + * @param value The realm to set. + * @return This builder for chaining. + */ + public Builder setRealm( + java.lang.String value) { + copyOnWrite(); + instance.setRealm(value); + return this; + } + /** + * string realm = 4; + * @return This builder for chaining. + */ + public Builder clearRealm() { + copyOnWrite(); + instance.clearRealm(); + return this; + } + /** + * string realm = 4; + * @param value The bytes for realm to set. + * @return This builder for chaining. + */ + public Builder setRealmBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setRealmBytes(value); + return this; + } + + /** + * string asset_id = 5; + * @return The assetId. + */ + @java.lang.Override + public java.lang.String getAssetId() { + return instance.getAssetId(); + } + /** + * string asset_id = 5; + * @return The bytes for assetId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getAssetIdBytes() { + return instance.getAssetIdBytes(); + } + /** + * string asset_id = 5; + * @param value The assetId to set. + * @return This builder for chaining. + */ + public Builder setAssetId( + java.lang.String value) { + copyOnWrite(); + instance.setAssetId(value); + return this; + } + /** + * string asset_id = 5; + * @return This builder for chaining. + */ + public Builder clearAssetId() { + copyOnWrite(); + instance.clearAssetId(); + return this; + } + /** + * string asset_id = 5; + * @param value The bytes for assetId to set. + * @return This builder for chaining. + */ + public Builder setAssetIdBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setAssetIdBytes(value); + return this; + } + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "mqttBrokerUrl_", + "user_", + "mqttPassword_", + "realm_", + "assetId_", + }; + java.lang.String info = + "\u0000\u0005\u0000\u0000\u0001\u0005\u0005\u0000\u0000\u0000\u0001\u0208\u0002\u0208" + + "\u0003\u0208\u0004\u0208\u0005\u0208"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig DEFAULT_INSTANCE; + static { + OpenRemoteConfig defaultInstance = new OpenRemoteConfig(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + OpenRemoteConfig.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface ExitProvisioningOrBuilder extends + // @@protoc_insertion_point(interface_extends:io.openremote.orlib.service.espprovision.Request.ExitProvisioning) + com.google.protobuf.MessageLiteOrBuilder { + } + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Request.ExitProvisioning} + */ + public static final class ExitProvisioning extends + com.google.protobuf.GeneratedMessageLite< + ExitProvisioning, ExitProvisioning.Builder> implements + // @@protoc_insertion_point(message_implements:io.openremote.orlib.service.espprovision.Request.ExitProvisioning) + ExitProvisioningOrBuilder { + private ExitProvisioning() { + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Request.ExitProvisioning} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Request.ExitProvisioning) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioningOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Request.ExitProvisioning) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = null;java.lang.String info = + "\u0000\u0000"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Request.ExitProvisioning) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning DEFAULT_INSTANCE; + static { + ExitProvisioning defaultInstance = new ExitProvisioning(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + ExitProvisioning.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + private int bodyCase_ = 0; + private java.lang.Object body_; + public enum BodyCase { + DEVICE_INFO(6), + BACKEND_CONNECTION_STATUS(7), + OPEN_REMOTE_CONFIG(8), + EXIT_PROVISIONING(9), + BODY_NOT_SET(0); + private final int value; + private BodyCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static BodyCase valueOf(int value) { + return forNumber(value); + } + + public static BodyCase forNumber(int value) { + switch (value) { + case 6: return DEVICE_INFO; + case 7: return BACKEND_CONNECTION_STATUS; + case 8: return OPEN_REMOTE_CONFIG; + case 9: return EXIT_PROVISIONING; + case 0: return BODY_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + @java.lang.Override + public BodyCase + getBodyCase() { + return BodyCase.forNumber( + bodyCase_); + } + + private void clearBody() { + bodyCase_ = 0; + body_ = null; + } + + public static final int ID_FIELD_NUMBER = 1; + private java.lang.String id_; + /** + * string id = 1; + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + return id_; + } + /** + * string id = 1; + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getIdBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(id_); + } + /** + * string id = 1; + * @param value The id to set. + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setId( + java.lang.String value) { + value.getClass(); // minimal bytecode null check + + id_ = value; + } + /** + * string id = 1; + */ + private void clearId() { + + id_ = getDefaultInstance().getId(); + } + /** + * string id = 1; + * @param value The bytes for id to set. + */ + private void setIdBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + id_ = value.toStringUtf8(); + + } + + public static final int DEVICE_INFO_FIELD_NUMBER = 6; + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + @java.lang.Override + public boolean hasDeviceInfo() { + return bodyCase_ == 6; + } + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo getDeviceInfo() { + if (bodyCase_ == 6) { + return (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo) body_; + } + return io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo.getDefaultInstance(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setDeviceInfo(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo value) { + value.getClass(); // minimal bytecode null check + body_ = value; + bodyCase_ = 6; + } + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void mergeDeviceInfo(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo value) { + value.getClass(); // minimal bytecode null check + if (bodyCase_ == 6 && + body_ != io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo.getDefaultInstance()) { + body_ = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo.newBuilder((io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo) body_) + .mergeFrom(value).buildPartial(); + } else { + body_ = value; + } + bodyCase_ = 6; + } + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + private void clearDeviceInfo() { + if (bodyCase_ == 6) { + bodyCase_ = 0; + body_ = null; + } + } + + public static final int BACKEND_CONNECTION_STATUS_FIELD_NUMBER = 7; + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.Override + public boolean hasBackendConnectionStatus() { + return bodyCase_ == 7; + } + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus getBackendConnectionStatus() { + if (bodyCase_ == 7) { + return (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus) body_; + } + return io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus.getDefaultInstance(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setBackendConnectionStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus value) { + value.getClass(); // minimal bytecode null check + body_ = value; + bodyCase_ = 7; + } + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void mergeBackendConnectionStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus value) { + value.getClass(); // minimal bytecode null check + if (bodyCase_ == 7 && + body_ != io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus.getDefaultInstance()) { + body_ = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus.newBuilder((io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus) body_) + .mergeFrom(value).buildPartial(); + } else { + body_ = value; + } + bodyCase_ = 7; + } + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + private void clearBackendConnectionStatus() { + if (bodyCase_ == 7) { + bodyCase_ = 0; + body_ = null; + } + } + + public static final int OPEN_REMOTE_CONFIG_FIELD_NUMBER = 8; + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.Override + public boolean hasOpenRemoteConfig() { + return bodyCase_ == 8; + } + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig getOpenRemoteConfig() { + if (bodyCase_ == 8) { + return (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig) body_; + } + return io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig.getDefaultInstance(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setOpenRemoteConfig(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig value) { + value.getClass(); // minimal bytecode null check + body_ = value; + bodyCase_ = 8; + } + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void mergeOpenRemoteConfig(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig value) { + value.getClass(); // minimal bytecode null check + if (bodyCase_ == 8 && + body_ != io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig.getDefaultInstance()) { + body_ = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig.newBuilder((io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig) body_) + .mergeFrom(value).buildPartial(); + } else { + body_ = value; + } + bodyCase_ = 8; + } + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + private void clearOpenRemoteConfig() { + if (bodyCase_ == 8) { + bodyCase_ = 0; + body_ = null; + } + } + + public static final int EXIT_PROVISIONING_FIELD_NUMBER = 9; + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.Override + public boolean hasExitProvisioning() { + return bodyCase_ == 9; + } + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning getExitProvisioning() { + if (bodyCase_ == 9) { + return (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning) body_; + } + return io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning.getDefaultInstance(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void setExitProvisioning(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning value) { + value.getClass(); // minimal bytecode null check + body_ = value; + bodyCase_ = 9; + } + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.SuppressWarnings("ReturnValueIgnored") + private void mergeExitProvisioning(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning value) { + value.getClass(); // minimal bytecode null check + if (bodyCase_ == 9 && + body_ != io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning.getDefaultInstance()) { + body_ = io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning.newBuilder((io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning) body_) + .mergeFrom(value).buildPartial(); + } else { + body_ = value; + } + bodyCase_ = 9; + } + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + private void clearExitProvisioning() { + if (bodyCase_ == 9) { + bodyCase_ = 0; + body_ = null; + } + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code io.openremote.orlib.service.espprovision.Request} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request, Builder> implements + // @@protoc_insertion_point(builder_implements:io.openremote.orlib.service.espprovision.Request) + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.RequestOrBuilder { + // Construct using io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + @java.lang.Override + public BodyCase + getBodyCase() { + return instance.getBodyCase(); + } + + public Builder clearBody() { + copyOnWrite(); + instance.clearBody(); + return this; + } + + + /** + * string id = 1; + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + return instance.getId(); + } + /** + * string id = 1; + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getIdBytes() { + return instance.getIdBytes(); + } + /** + * string id = 1; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId( + java.lang.String value) { + copyOnWrite(); + instance.setId(value); + return this; + } + /** + * string id = 1; + * @return This builder for chaining. + */ + public Builder clearId() { + copyOnWrite(); + instance.clearId(); + return this; + } + /** + * string id = 1; + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setIdBytes(value); + return this; + } + + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + @java.lang.Override + public boolean hasDeviceInfo() { + return instance.hasDeviceInfo(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo getDeviceInfo() { + return instance.getDeviceInfo(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + public Builder setDeviceInfo(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo value) { + copyOnWrite(); + instance.setDeviceInfo(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + public Builder setDeviceInfo( + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo.Builder builderForValue) { + copyOnWrite(); + instance.setDeviceInfo(builderForValue.build()); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + public Builder mergeDeviceInfo(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo value) { + copyOnWrite(); + instance.mergeDeviceInfo(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.DeviceInfo device_info = 6; + */ + public Builder clearDeviceInfo() { + copyOnWrite(); + instance.clearDeviceInfo(); + return this; + } + + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.Override + public boolean hasBackendConnectionStatus() { + return instance.hasBackendConnectionStatus(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus getBackendConnectionStatus() { + return instance.getBackendConnectionStatus(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + public Builder setBackendConnectionStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus value) { + copyOnWrite(); + instance.setBackendConnectionStatus(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + public Builder setBackendConnectionStatus( + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus.Builder builderForValue) { + copyOnWrite(); + instance.setBackendConnectionStatus(builderForValue.build()); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + public Builder mergeBackendConnectionStatus(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus value) { + copyOnWrite(); + instance.mergeBackendConnectionStatus(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.BackendConnectionStatus backend_connection_status = 7; + */ + public Builder clearBackendConnectionStatus() { + copyOnWrite(); + instance.clearBackendConnectionStatus(); + return this; + } + + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.Override + public boolean hasOpenRemoteConfig() { + return instance.hasOpenRemoteConfig(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig getOpenRemoteConfig() { + return instance.getOpenRemoteConfig(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + public Builder setOpenRemoteConfig(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig value) { + copyOnWrite(); + instance.setOpenRemoteConfig(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + public Builder setOpenRemoteConfig( + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig.Builder builderForValue) { + copyOnWrite(); + instance.setOpenRemoteConfig(builderForValue.build()); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + public Builder mergeOpenRemoteConfig(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig value) { + copyOnWrite(); + instance.mergeOpenRemoteConfig(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.OpenRemoteConfig open_remote_config = 8; + */ + public Builder clearOpenRemoteConfig() { + copyOnWrite(); + instance.clearOpenRemoteConfig(); + return this; + } + + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.Override + public boolean hasExitProvisioning() { + return instance.hasExitProvisioning(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + @java.lang.Override + public io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning getExitProvisioning() { + return instance.getExitProvisioning(); + } + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + public Builder setExitProvisioning(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning value) { + copyOnWrite(); + instance.setExitProvisioning(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + public Builder setExitProvisioning( + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning.Builder builderForValue) { + copyOnWrite(); + instance.setExitProvisioning(builderForValue.build()); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + public Builder mergeExitProvisioning(io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning value) { + copyOnWrite(); + instance.mergeExitProvisioning(value); + return this; + } + /** + * .io.openremote.orlib.service.espprovision.Request.ExitProvisioning exit_provisioning = 9; + */ + public Builder clearExitProvisioning() { + copyOnWrite(); + instance.clearExitProvisioning(); + return this; + } + + // @@protoc_insertion_point(builder_scope:io.openremote.orlib.service.espprovision.Request) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "body_", + "bodyCase_", + "id_", + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.DeviceInfo.class, + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.BackendConnectionStatus.class, + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.OpenRemoteConfig.class, + io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.ExitProvisioning.class, + }; + java.lang.String info = + "\u0000\u0005\u0001\u0000\u0001\t\u0005\u0000\u0000\u0000\u0001\u0208\u0006<\u0000" + + "\u0007<\u0000\b<\u0000\t<\u0000"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:io.openremote.orlib.service.espprovision.Request) + private static final io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request DEFAULT_INSTANCE; + static { + Request defaultInstance = new Request(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + Request.class, defaultInstance); + } + + public static io.openremote.orlib.service.espprovision.ORConfigChannelProtocol.Request getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + + static { + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt b/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt index 9b4d569..ff38b40 100644 --- a/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt +++ b/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt @@ -43,6 +43,7 @@ import io.openremote.orlib.service.SecureStorageProvider import io.openremote.orlib.shared.SharedData.offlineActivity import org.json.JSONException import org.json.JSONObject +import java.net.URL import java.util.logging.Level import java.util.logging.Logger @@ -965,7 +966,11 @@ open class OrMainActivity : Activity() { private fun handleESPProvisionProviderMessage(data: JSONObject) { val action = data.getString("action") if (espProvisionProvider == null) { - espProvisionProvider = ESPProvisionProvider(activity) + if (baseUrl != null) { + espProvisionProvider = ESPProvisionProvider(activity, URL(URL(baseUrl), "/api/master")) + } else { + espProvisionProvider = ESPProvisionProvider(activity) + } } when { action.equals(ESPProvisionProviderActions.PROVIDER_INIT, ignoreCase = true) -> { @@ -1027,7 +1032,13 @@ open class OrMainActivity : Activity() { } } action.equals(ESPProvisionProviderActions.PROVISION_DEVICE) -> { - // handle provision device + val userToken = data.optString("userToken") + if (!userToken.isNullOrEmpty()) { + espProvisionProvider?.provisionDevice(userToken) + } else { + // TODO + // Handle null or empty case here + } } action.equals(ESPProvisionProviderActions.EXIT_PROVISIONING) -> { // handle exit provisioning From 74a76d18ec2ac819d08073851a141aa870620415 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Fri, 11 Apr 2025 15:22:37 +0200 Subject: [PATCH 04/16] Error handling in case of missing keys from webapp messages --- .../orlib/service/ESPProvisionProvider.kt | 7 +-- .../io/openremote/orlib/ui/OrMainActivity.kt | 46 +++++++++++-------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt index 689783d..d787b53 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt @@ -33,6 +33,7 @@ object ESPProvisionProviderActions { const val START_BLE_SCAN = "START_BLE_SCAN" const val STOP_BLE_SCAN = "STOP_BLE_SCAN" const val CONNECT_TO_DEVICE = "CONNECT_TO_DEVICE" + const val DISCONNECT_FROM_DEVICE = "DISCONNECT_FROM_DEVICE" const val START_WIFI_SCAN = "START_WIFI_SCAN" const val STOP_WIFI_SCAN = "STOP_WIFI_SCAN" const val SEND_WIFI_CONFIGURATION = "SEND_WIFI_CONFIGURATION" @@ -148,7 +149,7 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l fun onRequestPermissionsResult( activity: Activity, requestCode: Int, - prefix: String + prefix: String? ) { if (requestCode == BLUETOOTH_PERMISSION_ESPPROVISION_REQUEST_CODE) { val hasPermission = hasPermission() @@ -157,12 +158,12 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) activity.startActivityForResult(enableBtIntent, ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE) } else { -// deviceRegistry.startDevicesScan(prefix) + deviceRegistry.startDevicesScan(prefix) } } } else if (requestCode == ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE) { if (bluetoothAdapter.isEnabled) { -// deviceRegistry.startDevicesScan(prefix) + deviceRegistry.startDevicesScan(prefix) } } } diff --git a/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt b/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt index ff38b40..00ebb91 100644 --- a/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt +++ b/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt @@ -35,6 +35,7 @@ import io.openremote.orlib.R import io.openremote.orlib.databinding.ActivityOrMainBinding import io.openremote.orlib.service.BleProvider import io.openremote.orlib.service.ConnectivityChangeReceiver +import io.openremote.orlib.service.ESPProviderErrorCode import io.openremote.orlib.service.ESPProvisionProvider import io.openremote.orlib.service.ESPProvisionProviderActions import io.openremote.orlib.service.GeofenceProvider @@ -77,6 +78,7 @@ open class OrMainActivity : Activity() { private var qrScannerProvider: QrScannerProvider? = null private var bleProvider: BleProvider? = null private var espProvisionProvider: ESPProvisionProvider? = null + private var prefix: String? = null private var secureStorageProvider: SecureStorageProvider? = null private var consoleId: String? = null private var connectFailCount: Int = 0 @@ -508,13 +510,7 @@ open class OrMainActivity : Activity() { } else if (requestCode == ESPProvisionProvider.BLUETOOTH_PERMISSION_ESPPROVISION_REQUEST_CODE || requestCode == ESPProvisionProvider.ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE) { - espProvisionProvider?.onRequestPermissionsResult( - this, - requestCode, - "moduleone-") -// TODO: should retrieve prefix from somewhere - - + espProvisionProvider?.onRequestPermissionsResult(this, requestCode, prefix) } else if (requestCode == pushResponseCode) { if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { notifyClient( @@ -991,9 +987,7 @@ open class OrMainActivity : Activity() { } action.equals(ESPProvisionProviderActions.START_BLE_SCAN, ignoreCase = true) -> { - val prefix = data.optString("prefix", "") - // TODO: store in variable so I can re-use when BLE permissions are received - + prefix = data.optString("prefix", "") espProvisionProvider?.startDevicesScan(prefix, this@OrMainActivity, object : ESPProvisionProvider.ESPProvisionCallback { @@ -1011,11 +1005,18 @@ open class OrMainActivity : Activity() { if (!deviceId.isNullOrEmpty()) { espProvisionProvider?.connectTo(deviceId) } else { - // TODO - // Handle null or empty case here + val payload: Map = hashMapOf( + "action" to action, + "provider" to "espprovision", + "errorCode" to ESPProviderErrorCode.UNKNOWN_DEVICE.code, + "errorMessage" to "Missing id parameter" + ) } } + action.equals(ESPProvisionProviderActions.DISCONNECT_FROM_DEVICE) -> { + espProvisionProvider?.disconnectFromDevice() + } action.equals(ESPProvisionProviderActions.START_WIFI_SCAN) -> { espProvisionProvider?.startWifiScan() } @@ -1028,21 +1029,30 @@ open class OrMainActivity : Activity() { if (!ssid.isNullOrEmpty() && !password.isNullOrEmpty()) { espProvisionProvider?.sendWifiConfiguration(ssid, password) } else { - // TODO + val payload: Map = hashMapOf( + "action" to action, + "provider" to "espprovision", + "errorCode" to ESPProviderErrorCode.WIFI_AUTHENTICATION_ERROR.code, + "errorMessage" to "Missing ssid or password parameter" + ) } } + action.equals(ESPProvisionProviderActions.EXIT_PROVISIONING) -> { + espProvisionProvider?.exitProvisioning() + } action.equals(ESPProvisionProviderActions.PROVISION_DEVICE) -> { val userToken = data.optString("userToken") if (!userToken.isNullOrEmpty()) { espProvisionProvider?.provisionDevice(userToken) } else { - // TODO - // Handle null or empty case here + val payload: Map = hashMapOf( + "action" to action, + "provider" to "espprovision", + "errorCode" to ESPProviderErrorCode.SECURITY_ERROR.code, + "errorMessage" to "Missing userToken parameter" + ) } } - action.equals(ESPProvisionProviderActions.EXIT_PROVISIONING) -> { - // handle exit provisioning - } } } } From 781ae0294fecd3533be4143f09d429bddbfac146 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Thu, 24 Apr 2025 15:29:15 +0200 Subject: [PATCH 05/16] Handle error during Wifi scan --- .../service/espprovision/WifiProvisioner.kt | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt index be10daf..55022da 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt @@ -57,21 +57,8 @@ class WifiProvisioner(private var deviceConnection: DeviceConnection? = null, va } override fun onWiFiScanFailed(e: Exception) { - // TODO -/* - Log.e(com.espressif.ui.activities.WiFiScanActivity.TAG, "onWiFiScanFailed") - e.printStackTrace() - runOnUiThread(object : Runnable { - override fun run() { - updateProgressAndScanBtn(false) - Toast.makeText( - this@WiFiScanActivity, - "Failed to get Wi-Fi scan list", - Toast.LENGTH_LONG - ).show() - } - }) - */ + stopWifiScan(false) + sendWifiScanError(ESPProviderErrorCode.COMMUNICATION_ERROR, e.toString()) } }) } From 44cc42184a42dd866e01ae928007447b276dc8ea Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Thu, 24 Apr 2025 15:31:06 +0200 Subject: [PATCH 06/16] Some better error handling --- .../orlib/service/ESPProvisionProvider.kt | 17 +++++-- .../service/espprovision/BatteryProvision.kt | 3 ++ .../service/espprovision/DeviceConnection.kt | 44 +++++++++++-------- 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt index d787b53..c1fb893 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt @@ -210,15 +210,24 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l fun exitProvisioning() { if (deviceConnection == null) { - // TODO return } if (!deviceConnection!!.isConnected) { - // TODO + sendExitProvisioningError(ESPProviderErrorCode.NOT_CONNECTED, "No connection established to device") return } deviceConnection!!.exitProvisioning() - // TODO + } + + private fun sendExitProvisioningError(error: ESPProviderErrorCode, errorMessage: String?) { + val data = mutableMapOf() + + data["errorCode"] = error.code + errorMessage?.let { + data["errorMessage"] = it + } + + deviceRegistry?.callbackChannel?.sendMessage(ESPProvisionProviderActions.EXIT_PROVISIONING, data) } // Wifi scan @@ -280,6 +289,8 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l } +data class ESPProviderException(val errorCode: ESPProviderErrorCode, val errorMessage: String) : Exception() + enum class ESPProviderErrorCode(val code: Int) { UNKNOWN_DEVICE(100), diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt index 463ad8a..ce7eb42 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt @@ -3,6 +3,7 @@ package io.openremote.orlib.service.espprovision import android.util.Log import data.entity.Response import io.openremote.orlib.service.ESPProviderErrorCode +import io.openremote.orlib.service.ESPProviderException import io.openremote.orlib.service.ESPProvisionProvider import io.openremote.orlib.service.ESPProvisionProviderActions import utils.PasswordType @@ -58,6 +59,8 @@ class BatteryProvision(var deviceConnection: DeviceConnection?, var callbackChan ?: BackendConnectionStatus.DISCONNECTED } sendProvisionDeviceStatus(true) + } catch (e: ESPProviderException) { + sendProvisionDeviceStatus(false, e.errorCode, e.errorMessage) } catch (e: BatteryProvisionAPIError) { val (errorCode, errorMessage) = mapBatteryProvisionAPIError(e) sendProvisionDeviceStatus(false, errorCode, errorMessage) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt index b49ba9a..87b45a3 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt @@ -8,6 +8,7 @@ import com.espressif.provisioning.DeviceConnectionEvent import com.espressif.provisioning.ESPConstants import com.espressif.provisioning.ESPDevice import io.openremote.orlib.service.ESPProviderErrorCode +import io.openremote.orlib.service.ESPProviderException import io.openremote.orlib.service.ESPProvisionProvider import io.openremote.orlib.service.ESPProvisionProviderActions import kotlinx.coroutines.CoroutineScope @@ -68,20 +69,32 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: fun exitProvisioning() { if (!isConnected) { - // TODO + throw ESPProviderException( + errorCode = ESPProviderErrorCode.NOT_CONNECTED, + errorMessage = "No connection established to device" + ) } - // Is IO OK ? + + // TODO: Is IO OK ? CoroutineScope(Dispatchers.IO).launch { try { configChannel?.exitProvisioning() + } catch (e: ORConfigChannelError) { + throw ESPProviderException(ESPProviderErrorCode.COMMUNICATION_ERROR, e.message ?: e.toString()) } catch (e: Exception) { - // Handle error (log or show UI feedback) + throw ESPProviderException(ESPProviderErrorCode.GENERIC_ERROR, e.toString()) } } } fun getDeviceInfo(): DeviceInfo { - // TODO: should check if connected + if (!isConnected) { + throw ESPProviderException( + errorCode = ESPProviderErrorCode.NOT_CONNECTED, + errorMessage = "No connection established to device" + ) + } + // TODO: should not block return runBlocking { configChannel!!.getDeviceInfo() @@ -94,12 +107,12 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: mqttPassword: String, assetId: String ) { -/* if (!isConnected) { + if (!isConnected) { throw ESPProviderException( errorCode = ESPProviderErrorCode.NOT_CONNECTED, errorMessage = "No connection established to device" ) - }*/ + } try { configChannel?.sendOpenRemoteConfig( mqttBrokerUrl = mqttBrokerUrl, @@ -108,36 +121,31 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: assetId = assetId ) } catch (e: Exception) { - /* throw ESPProviderException( errorCode = ESPProviderErrorCode.COMMUNICATION_ERROR, errorMessage = e.localizedMessage ?: "Unknown error" ) - - */ } } suspend fun getBackendConnectionStatus(): BackendConnectionStatus { - /* if (!isConnected) { throw ESPProviderException( errorCode = ESPProviderErrorCode.NOT_CONNECTED, errorMessage = "No connection established to device" ) - }*/ + } return try { configChannel?.getBackendConnectionStatus() - ?: BackendConnectionStatus.DISCONNECTED /*throw ESPProviderException( + ?: throw ESPProviderException( errorCode = ESPProviderErrorCode.COMMUNICATION_ERROR, errorMessage = "Channel returned null status" - )*/ + ) } catch (e: Exception) { - /* - throw ESPProviderException( - errorCode = ESPProviderErrorCode.COMMUNICATION_ERROR, - errorMessage = e.localizedMessage ?: "Unknown error" - )*/ + throw ESPProviderException( + errorCode = ESPProviderErrorCode.COMMUNICATION_ERROR, + errorMessage = e.localizedMessage ?: "Unknown error" + ) } as BackendConnectionStatus } From f39ef1326f060c3ab9516ec7917d52bce0b1c673 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Thu, 24 Apr 2025 15:33:50 +0200 Subject: [PATCH 07/16] M1V1-55: Properly handle list of discovered network, avoiding duplicates, taking changing RSSI into account and continuing scan until explicitly stopped. --- .../service/espprovision/WifiProvisioner.kt | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt index 55022da..24d077f 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/WifiProvisioner.kt @@ -1,14 +1,11 @@ package io.openremote.orlib.service.espprovision -import android.util.Log -import android.widget.Toast import com.espressif.provisioning.ESPConstants import com.espressif.provisioning.ESPConstants.ProvisionFailureReason import com.espressif.provisioning.WiFiAccessPoint import com.espressif.provisioning.listeners.ProvisionListener import com.espressif.provisioning.listeners.WiFiScanListener import io.openremote.orlib.service.ESPProviderErrorCode -import io.openremote.orlib.service.ESPProvisionProvider import io.openremote.orlib.service.ESPProvisionProviderActions class WifiProvisioner(private var deviceConnection: DeviceConnection? = null, var callbackChannel: CallbackChannel? = null, searchWifiTimeout: Long, searchWifiMaxIterations: Int) { @@ -43,17 +40,38 @@ class WifiProvisioner(private var deviceConnection: DeviceConnection? = null, va return } - deviceConnection?.espDevice?.scanNetworks(object : WiFiScanListener { override fun onWifiListReceived(wifiList: ArrayList?) { - wifiList?.let { wifiNetworks.addAll(it.mapNotNull { network -> network }) } - callbackChannel?.sendMessage(ESPProvisionProviderActions.START_WIFI_SCAN, hashMapOf( - "networks" to wifiNetworks.map { network -> - hashMapOf( - "ssid" to network.wifiName, - "signalStrength" to network.rssi) + wifiList?.let { + if (wifiScanning) { + var wifiNetworksChanged = false + it.forEach { wifiAP -> + wifiAP?.let { discoveredAP -> + val ap = wifiNetworks.firstOrNull() { ap -> discoveredAP.wifiName == ap.wifiName } + if (ap != null) { + if (ap.rssi != discoveredAP.rssi) { + wifiNetworksChanged = true + wifiNetworks.remove(ap) + wifiNetworks.add(discoveredAP) + } + } else { + wifiNetworksChanged = true + wifiNetworks.add(discoveredAP) + } + } + } + if (wifiNetworks.isNotEmpty() && wifiNetworksChanged) { + callbackChannel?.sendMessage(ESPProvisionProviderActions.START_WIFI_SCAN, hashMapOf( + "networks" to wifiNetworks.map { network -> + hashMapOf( + "ssid" to network.wifiName, + "signalStrength" to network.rssi) + } + )) + } + scanWifi() } - )) + } } override fun onWiFiScanFailed(e: Exception) { @@ -111,7 +129,6 @@ class WifiProvisioner(private var deviceConnection: DeviceConnection? = null, va override fun onProvisioningFailed(e: java.lang.Exception?) { sendWifiConfigurationStatus(false, ESPProviderErrorCode.GENERIC_ERROR, e.toString()) } - }) } From 9daf3b74f94143315fbcd6dea28cb99efda18ed1 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Tue, 13 May 2025 17:12:48 +0200 Subject: [PATCH 08/16] M1V1-61: on permissions granted, only start a scan if prefix is set (= when scan has been asked explicitly) --- .../io/openremote/orlib/service/ESPProvisionProvider.kt | 9 +++++++-- .../orlib/service/espprovision/DeviceRegistry.kt | 1 + .../main/java/io/openremote/orlib/ui/OrMainActivity.kt | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt index c1fb893..6e65854 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt @@ -151,6 +151,7 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l requestCode: Int, prefix: String? ) { + Log.d("espprovision", "onRequestPermissionsResult called with prefix >" + prefix + "<") if (requestCode == BLUETOOTH_PERMISSION_ESPPROVISION_REQUEST_CODE) { val hasPermission = hasPermission() if (hasPermission) { @@ -158,12 +159,16 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) activity.startActivityForResult(enableBtIntent, ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE) } else { - deviceRegistry.startDevicesScan(prefix) + if (prefix != null) { + deviceRegistry.startDevicesScan(prefix) + } } } } else if (requestCode == ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE) { if (bluetoothAdapter.isEnabled) { - deviceRegistry.startDevicesScan(prefix) + if (prefix != null) { + deviceRegistry.startDevicesScan(prefix) + } } } } diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt index a2e4a08..fde7590 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt @@ -129,6 +129,7 @@ class DeviceRegistry(private val context: Context, searchDeviceTimeout: Long, se @RequiresPermission(allOf = [Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH]) fun startDevicesScan(prefix: String? = "") { + Log.d("espprovision", "startDevicesScan called with prefix >" + prefix + "<") bleScanning = true resetDevicesList() loopDetector.reset() diff --git a/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt b/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt index 00ebb91..e9cd5b7 100644 --- a/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt +++ b/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt @@ -77,8 +77,12 @@ open class OrMainActivity : Activity() { private var geofenceProvider: GeofenceProvider? = null private var qrScannerProvider: QrScannerProvider? = null private var bleProvider: BleProvider? = null + private var espProvisionProvider: ESPProvisionProvider? = null + // We store the prefix here so it can be used to start a scan after permissions request + // A scan is only started if the prefix is NOT null private var prefix: String? = null + private var secureStorageProvider: SecureStorageProvider? = null private var consoleId: String? = null private var connectFailCount: Int = 0 @@ -987,6 +991,7 @@ open class OrMainActivity : Activity() { } action.equals(ESPProvisionProviderActions.START_BLE_SCAN, ignoreCase = true) -> { + // Must define a value for prefix, to ensure scan is started in case we need to request BLE permissions (though it should not happen here) prefix = data.optString("prefix", "") espProvisionProvider?.startDevicesScan(prefix, this@OrMainActivity, From bc5c0ef594f99ea5a2675910be625afb92b73cab Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Tue, 13 May 2025 17:57:24 +0200 Subject: [PATCH 09/16] M1V1-64: Add indication whether exit provisioning was successful or not --- .../java/io/openremote/orlib/service/ESPProvisionProvider.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt index 6e65854..e3b198d 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt @@ -222,11 +222,16 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l return } deviceConnection!!.exitProvisioning() + deviceRegistry?.callbackChannel?.sendMessage( + ESPProvisionProviderActions.EXIT_PROVISIONING, + mapOf("exit" to true) + ) } private fun sendExitProvisioningError(error: ESPProviderErrorCode, errorMessage: String?) { val data = mutableMapOf() + data["exit"] = false data["errorCode"] = error.code errorMessage?.let { data["errorMessage"] = it From 010cbd28e26e17a4d7a397aafabd8d39dfddd754 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Thu, 29 May 2025 18:08:34 +0200 Subject: [PATCH 10/16] Improve check for BLE permissions and only report back to webapp when permissions have been requested to user (if required) (GitHub issue #40) --- .../orlib/service/ESPProvisionProvider.kt | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt index e3b198d..b809e23 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt @@ -94,7 +94,10 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l } @SuppressLint("MissingPermission") - fun enable(callback: ESPProvisionCallback?, activity: Activity) { + fun enable(callback: ESPProvisionCallback, activity: Activity) { + deviceRegistry.callbackChannel = CallbackChannel(callback, "espprovision") + deviceRegistry.enable() + if (!bluetoothAdapter.isEnabled) { Log.d("ESP", "BLE not enabled") val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) @@ -106,19 +109,25 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l requestPermissions(activity) } - deviceRegistry.enable() + if (bluetoothAdapter.isEnabled && hasPermission()) { + providerEnabled(deviceRegistry.callbackChannel) + } + } + + fun providerEnabled(callbackChannel: CallbackChannel?) { val sharedPreferences = - context.getSharedPreferences(context.getString(R.string.app_name), Context.MODE_PRIVATE) + context.getSharedPreferences( + context.getString(R.string.app_name), + Context.MODE_PRIVATE + ) sharedPreferences.edit() .remove(espProvisionDisabledKey) .apply() - callback?.accept( + callbackChannel?.sendMessage(ESPProvisionProviderActions.PROVIDER_ENABLE, hashMapOf( - "action" to ESPProvisionProviderActions.PROVIDER_ENABLE, - "provider" to "espprovision", "hasPermission" to hasPermission(), "success" to true, "enabled" to true, @@ -159,6 +168,7 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) activity.startActivityForResult(enableBtIntent, ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE) } else { + providerEnabled(deviceRegistry.callbackChannel) if (prefix != null) { deviceRegistry.startDevicesScan(prefix) } @@ -166,6 +176,7 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l } } else if (requestCode == ENABLE_BLUETOOTH_ESPPROVISION_REQUEST_CODE) { if (bluetoothAdapter.isEnabled) { + providerEnabled(deviceRegistry.callbackChannel) if (prefix != null) { deviceRegistry.startDevicesScan(prefix) } @@ -177,7 +188,6 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l @SuppressLint("MissingPermission") fun startDevicesScan(prefix: String?, activity: Activity, callback: ESPProvisionCallback) { - // TODO: check in BLE provider what activity is used for deviceRegistry.callbackChannel = CallbackChannel(callback, "espprovision") if (!bluetoothAdapter.isEnabled) { Log.d("ESP", "BLE not enabled") From 5d75d11cea8e19e7a5f3fa949521fb0aee2b8cc3 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Mon, 2 Jun 2025 09:27:05 +0200 Subject: [PATCH 11/16] Make function suspend to not block the main thread --- .../orlib/service/espprovision/DeviceConnection.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt index 87b45a3..d137a4f 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceConnection.kt @@ -28,8 +28,8 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: private const val SEC_TYPE_0: Int = 0 private const val SEC_TYPE_1: Int = 1 private const val SEC_TYPE_2: Int = 2 - } + init { EventBus.getDefault().register(this) } @@ -75,7 +75,6 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: ) } - // TODO: Is IO OK ? CoroutineScope(Dispatchers.IO).launch { try { configChannel?.exitProvisioning() @@ -87,7 +86,7 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: } } - fun getDeviceInfo(): DeviceInfo { + suspend fun getDeviceInfo(): DeviceInfo { if (!isConnected) { throw ESPProviderException( errorCode = ESPProviderErrorCode.NOT_CONNECTED, @@ -95,10 +94,7 @@ class DeviceConnection(val deviceRegistry: DeviceRegistry, var callbackChannel: ) } - // TODO: should not block - return runBlocking { - configChannel!!.getDeviceInfo() - } + return configChannel!!.getDeviceInfo() } suspend fun sendOpenRemoteConfig( From 174f95f5fad6f5b7b0cf366b0284ee069133ca0c Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Mon, 2 Jun 2025 09:31:50 +0200 Subject: [PATCH 12/16] Comment on usage of Main context --- .../openremote/orlib/service/espprovision/DeviceRegistry.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt index fde7590..42ac907 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt @@ -35,10 +35,8 @@ class EspressifProvisionManager(private val provisionManager: ESPProvisionManage @androidx.annotation.RequiresPermission(allOf = [android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.BLUETOOTH]) suspend fun searchESPDevices(devicePrefix: String): List { return withContext(Dispatchers.Main) { - - // Was Dispatchers.IO - - + // If on IO: Error during device scan: Can't create handler inside thread Thread[DefaultDispatcher-worker-2,5,main] that has not called Looper.prepare() + // But I don't see any warnings that the main thread is getting blocked suspendCancellableCoroutine { continuation -> var alreadyResumed = false // TODO: does it behave same as iOS ? will we receive 2 times the call ? var devices: MutableList = mutableListOf() From 4e254529cfb497024266e95e535862512b752c7a Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Mon, 2 Jun 2025 09:33:38 +0200 Subject: [PATCH 13/16] Clean-up comments --- .../service/espprovision/DeviceRegistry.kt | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt index 42ac907..f375157 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt @@ -18,15 +18,6 @@ import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.withContext import java.util.UUID -/* -// TODO: do we really need to for Android ? -interface ORESPProvisionManager { - suspend fun searchESPDevices(devicePrefix: String, transport: ESPConstants.TransportType, security: ESPConstants.SecurityType): List< - DeviceRegistry.DiscoveredDevice> - fun stopESPDevicesSearch() -} - */ - class EspressifProvisionManager(private val provisionManager: ESPProvisionManager) { init { provisionManager.createESPDevice(ESPConstants.TransportType.TRANSPORT_BLE, ESPConstants.SecurityType.SECURITY_1) @@ -38,7 +29,6 @@ class EspressifProvisionManager(private val provisionManager: ESPProvisionManage // If on IO: Error during device scan: Can't create handler inside thread Thread[DefaultDispatcher-worker-2,5,main] that has not called Looper.prepare() // But I don't see any warnings that the main thread is getting blocked suspendCancellableCoroutine { continuation -> - var alreadyResumed = false // TODO: does it behave same as iOS ? will we receive 2 times the call ? var devices: MutableList = mutableListOf() provisionManager.searchBleEspDevices(devicePrefix, object: BleScanListener { @@ -47,17 +37,12 @@ class EspressifProvisionManager(private val provisionManager: ESPProvisionManage } override fun onPeripheralFound(device: BluetoothDevice, scanResult: ScanResult) { -// Log.d("espprovision", "Found peripheral") if (!scanResult.scanRecord?.deviceName.isNullOrEmpty()) { -// Log.d("espprovision", "Device name ${scanResult.scanRecord?.deviceName}") - var serviceUuid = "" scanResult.scanRecord?.serviceUuids?.firstOrNull()?.toString()?.let { uuid -> serviceUuid = uuid } -// Log.d("espprovision", "Service UUID $serviceUuid") scanResult.scanRecord!!.deviceName?.let { deviceName -> - // TODO: should only add device if it doesn't exist yet if (devices.find { it.name == deviceName } == null) { devices.add(DeviceRegistry.DiscoveredDevice(deviceName, serviceUuid, device)) Log.d("espprovision", "Added device, list is now $devices") @@ -77,18 +62,6 @@ class EspressifProvisionManager(private val provisionManager: ESPProvisionManage } }) - /* - provisionManager.searchESPDevices(devicePrefix, transport, security) { deviceList, error -> - if (error != null) { - if (!alreadyResumed) { - alreadyResumed = true - continuation.resumeWith(Result.failure(error)) - } - } else { - alreadyResumed = true - continuation.resumeWith(Result.success(deviceList ?: emptyList())) - } - }*/ } } } @@ -107,9 +80,6 @@ class DeviceRegistry(private val context: Context, searchDeviceTimeout: Long, se private var loopDetector = LoopDetector(searchDeviceTimeout, searchDeviceMaxIterations) var provisionManager: EspressifProvisionManager? = null - // var callbackChannel: CallbackChannel? = null -// private var devices = mutableListOf() -// private val devicesIndex = mutableMapOf() var bleScanning = false private var devices: MutableList = mutableListOf() @@ -153,9 +123,6 @@ class DeviceRegistry(private val context: Context, searchDeviceTimeout: Long, se } CoroutineScope(Dispatchers.IO).launch { - -// Log.d("DeviceRegistry", "Starting BLE scan") - try { val deviceList = manager.searchESPDevices(prefix) Log.d("espprovision", "I got a list of devices $deviceList") From fc01360c9df147209c51a60d7c814be84bf2e594 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Mon, 2 Jun 2025 09:34:27 +0200 Subject: [PATCH 14/16] Don't need full package prefix --- .../openremote/orlib/service/espprovision/DeviceRegistry.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt index f375157..d66ac30 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/DeviceRegistry.kt @@ -23,7 +23,7 @@ class EspressifProvisionManager(private val provisionManager: ESPProvisionManage provisionManager.createESPDevice(ESPConstants.TransportType.TRANSPORT_BLE, ESPConstants.SecurityType.SECURITY_1) } - @androidx.annotation.RequiresPermission(allOf = [android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.BLUETOOTH]) + @RequiresPermission(allOf = [android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.BLUETOOTH]) suspend fun searchESPDevices(devicePrefix: String): List { return withContext(Dispatchers.Main) { // If on IO: Error during device scan: Can't create handler inside thread Thread[DefaultDispatcher-worker-2,5,main] that has not called Looper.prepare() @@ -113,7 +113,7 @@ class DeviceRegistry(private val context: Context, searchDeviceTimeout: Long, se } } - @androidx.annotation.RequiresPermission(allOf = [android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.BLUETOOTH]) + @RequiresPermission(allOf = [android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.BLUETOOTH_ADMIN, android.Manifest.permission.BLUETOOTH]) private fun devicesScan(prefix: String) { provisionManager?.let { manager -> if (loopDetector.detectLoop()) { From 258da484d73f73288b703291f8037c446ec9cdd6 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Mon, 2 Jun 2025 09:51:15 +0200 Subject: [PATCH 15/16] Some improvements on coroutine contexts usage --- .../io/openremote/orlib/service/ESPProvisionProvider.kt | 4 +--- .../orlib/service/espprovision/BatteryProvision.kt | 9 +++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt index b809e23..9a33440 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/ESPProvisionProvider.kt @@ -273,10 +273,8 @@ class ESPProvisionProvider(val context: Context, val apiURL: URL = URL("http://l // OR Configuration fun provisionDevice(userToken: String) { - // TODO - val batteryProvision = BatteryProvision(deviceConnection, deviceRegistry.callbackChannel, apiURL) - CoroutineScope(Dispatchers.Main).launch { // TODO: what's the appropriate dispatcher ? and should this be here or further down the call chain ? + CoroutineScope(Dispatchers.IO).launch { batteryProvision.provision(userToken) } } diff --git a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt index ce7eb42..05eff9c 100644 --- a/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt +++ b/ORLib/src/main/java/io/openremote/orlib/service/espprovision/BatteryProvision.kt @@ -6,6 +6,8 @@ import io.openremote.orlib.service.ESPProviderErrorCode import io.openremote.orlib.service.ESPProviderException import io.openremote.orlib.service.ESPProvisionProvider import io.openremote.orlib.service.ESPProvisionProviderActions +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext import utils.PasswordType import java.net.URL import java.util.Locale @@ -67,7 +69,7 @@ class BatteryProvision(var deviceConnection: DeviceConnection?, var callbackChan } } - private fun sendProvisionDeviceStatus(connected: Boolean, error: ESPProviderErrorCode? = null, errorMessage: String? = null) { + private suspend fun sendProvisionDeviceStatus(connected: Boolean, error: ESPProviderErrorCode? = null, errorMessage: String? = null) { val data = mutableMapOf("connected" to connected) error?.let { @@ -77,7 +79,10 @@ class BatteryProvision(var deviceConnection: DeviceConnection?, var callbackChan data["errorMessage"] = it } - callbackChannel?.sendMessage(ESPProvisionProviderActions.PROVISION_DEVICE, data) + // We bring it back to main context as this eventually is a message to the Web view + withContext(Dispatchers.Main) { + callbackChannel?.sendMessage(ESPProvisionProviderActions.PROVISION_DEVICE, data) + } } private fun mapBatteryProvisionAPIError(error: BatteryProvisionAPIError): Pair { From 20c739a88e3b1598b6949c4a5aae452c0273537c Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Thu, 14 Aug 2025 09:25:52 +0200 Subject: [PATCH 16/16] Properly pass pop received from web app to provider --- ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt b/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt index e9cd5b7..f707a6e 100644 --- a/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt +++ b/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt @@ -1007,8 +1007,9 @@ open class OrMainActivity : Activity() { action.equals(ESPProvisionProviderActions.CONNECT_TO_DEVICE) -> { val deviceId = data.optString("id") + val pop = data.optString("pop") if (!deviceId.isNullOrEmpty()) { - espProvisionProvider?.connectTo(deviceId) + espProvisionProvider?.connectTo(deviceId, pop) } else { val payload: Map = hashMapOf( "action" to action,