Date: 2026-02-27
Scope: Decompiled official OneControl app code and secondary Cloud Gateway code
The OneControl ecosystem does not use a single metadata discovery mechanism. The codebase contains three distinct patterns:
-
MyRvLink table-based discovery (primary BLE gateway flow)
- Devices and metadata are fetched as separate tables.
- Gateway broadcasts table identifiers and CRCs.
- App validates CRCs, merges rows by index, and materializes logical devices.
-
IDS-CAN live identity discovery (direct CAN / BLE-CAN adapter flow)
- Metadata comes from live CAN identity and status messages.
- No separate metadata table fetch step.
- Transport framing differs by BLE gateway version (V1 vs V2/V2_D).
-
Cloud IoT component-model discovery (remote cloud flow)
- Device inventory comes from cloud component APIs.
- Metadata (such as software part number) is fetched per component via command/response trackers.
The app explicitly supports multiple gateway families and encoding schemes, including legacy and newer advertisement formats and different runtime frame formats.
docs/onecontrol_plugin_docs/official_onecontrol_app_dlls_decompiled/OneControl.Direct.MyRvLink/...docs/onecontrol_plugin_docs/official_onecontrol_app_dlls_decompiled/OneControl.Direct.IdsCan/...docs/onecontrol_plugin_docs/official_onecontrol_app_dlls_decompiled/IDS.Portable.CAN/...docs/onecontrol_plugin_docs/official_onecontrol_app_dlls_decompiled/ids.portable.ble/...docs/onecontrol_plugin_docs/official_onecontrol_app_dlls_decompiled/OneControl.Direct.RvCloudIoT/...
docs/onecontrol_plugin_docs/Cloud Gateway Code/OneControl.Program/...docs/onecontrol_plugin_docs/Cloud Gateway Code/IDS.Portable.CAN/...
Key class:
MyRvLinkGatewayInformation
Fields extracted from gateway event payload:
- Protocol major version
- Options (config/production mode flags)
- Device count
- Device table id
- Device table CRC
- Device metadata table CRC
This event is decoded by MyRvLinkEventFactory and consumed by DirectConnectionMyRvLink.OnReceivedEvent(...).
When GatewayInformation arrives:
GatewayInfois set on the connection.- A
MyRvLinkDeviceTrackerinstance is created or refreshed using table id/CRC. - Metadata tracker is initialized with metadata table CRC.
- Device fetch and metadata fetch are both triggered.
Command classes:
MyRvLinkCommandGetDevicesMyRvLinkCommandGetDevicesResponseMyRvLinkCommandGetDevicesResponseCompleted
Protocol behavior:
- Request includes
(tableId, startDeviceId, maxCount). - Partial responses contain one or more serialized device entries.
- Completed response includes final
(deviceTableCrc, deviceCount). - Command marks success only if count and completion checks pass.
Decode path:
MyRvLinkCommandGetDevicesResponse.DecodeDevice(...)MyRvLinkDevice.TryDecodeFromRawBuffer(...)- dispatches by protocol byte to Host, IdsCan, or None.
Command classes:
MyRvLinkCommandGetDevicesMetadataMyRvLinkCommandGetDevicesMetadataResponseMyRvLinkCommandGetDevicesMetadataResponseCompleted
Protocol behavior mirrors device list:
- Request by table id/range.
- Partial metadata entries streamed.
- Completed response includes
(metadataTableCrc, deviceCount). - Validated for count and completion.
Decode path:
MyRvLinkCommandGetDevicesMetadataResponse.DecodeMetadata(...)MyRvLinkDeviceMetadata.TryDecodeFromRawBuffer(...)- dispatches by protocol byte to HostMetadata, IdsCanMetadata, or fallback.
Key class:
MyRvLinkDeviceTracker
Merge semantics:
- Device list and metadata list must have equal length.
- Merge occurs by index (device row i + metadata row i).
- For each merged item:
- Update physical row metadata (
MyRvLinkDeviceIdsCan.UpdateMetadataorMyRvLinkDeviceHost.UpdateMetadata). - Build/refresh
LogicalDeviceIdfrom product/device/function/capability. - Add logical device via
MyRvLinkDeviceManager.AddLogicalDevice(...). - Apply circuit id from metadata to logical device.
- Update physical row metadata (
Materialized identity fields include:
- Product ID
- Device Type
- Device Instance
- Function Name
- Function Instance
- Default capability byte
- Product MAC
- Device table and metadata table are cached separately.
- Cache lookup keyed by table CRC values.
- If cached counts mismatch current table expectations, cache is rejected.
- Fresh pulls are CRC-validated before use.
Implication: metadata in this path is intentionally table-versioned and resilient to stale data.
MyRvLinkDeviceProtocol enum values:
NoneHostIdsCan
This discriminator appears in both device and metadata rows.
MyRvLinkDeviceHost.Decode(...) supports:
- Payload size
0(legacy host row; no IDS-CAN style fields) - Payload size
10(host row carrying IDS-CAN-like identity fields)
MyRvLinkDeviceHostMetadata.Decode(...) supports:
- Payload size
0(legacy/no extra metadata) - Payload size
17(extended IDS-CAN-style metadata)
Extended fields include:
- Function Name
- Function Instance
- Raw capability
- IDS-CAN version
- Circuit ID
- Software Part Number (fixed-length string segment)
MyRvLinkDeviceIdsCanMetadata expects payload size 17 and includes:
- Function Name
- Function Instance
- Raw capability
- IDS-CAN version
- Circuit ID
- Software Part Number
This row provides the metadata needed to finalize many logical IDs and capabilities.
The app contains explicit BLE gateway-family and version handling.
BleGatewayScanResult derives gateway version from manufacturer bytes by:
- Validating Lippert manufacturer id bytes
- Decoding part number and revision nibble fields
- Mapping
(partNumber, rev)to gateway version
BleCanGatewayProtocolVersion (1-byte payload) is parsed from IDS manufacturer-specific data and consumed by:
X180TGatewayScanResultSureShadeGatewayScanResult
Both scan results expose AdvertisedGatewayVersion and alter required-advertisement validation behavior.
Observed specialized gateway scan result classes:
BleGatewayScanResult(generic/legacy)X180TGatewayScanResultSureShadeGatewayScanResult
Additional signals:
SureShadeGatewayScanResultalso parses connection-count manufacturer data.X180TandSureShadeboth use key-seed cypher fields for pairing/security logic.
In BleCommunicationsAdapter:
-
V1 behavior:
- Raw incoming payload path
- Additional synthetic messages inserted (e.g., fake circuit-id message)
-
V2/V2_D behavior:
- Decodes wrapped V2 frame types (
Packed,ElevenBit,TwentyNineBit) - Reconstructs canonical internal CAN message segments
- Uses
DeviceInstanceManageron V2 to resolve instance mapping
- Decodes wrapped V2 frame types (
Implication: identical logical CAN semantics may arrive in structurally different BLE frames depending on gateway generation.
Key class:
DirectConnectionIdsCan
Discovery characteristics:
- Uses live gateway/device inventory from CAN adapter objects.
- Device identity from
DEVICE_ID + MACand live network address. - Adds/fetches logical devices from physical devices directly (
AddLogicalDeviceForPhysicalDevice). - Handles function rename flows when function name/instance changes.
Session behavior differs by BLE gateway version:
- For BLE gateway version
V1, usesIdsCanSessionManagerAuto. - Otherwise uses standard
IdsCanSessionManager.
This path does not rely on a separate “device metadata table CRC” model.
Key class:
DirectConnectionRvCloudIoT
Discovery characteristics:
- Fetches component inventory using cloud API (
GetVehicleViewAsync). - Applies component status objects to logical devices.
- Metadata fetch is command-based per component (
RvCloudDeviceComponentCommandMetadataGet) with async tracker correlation.
Metadata operation example:
GetSoftwarePartNumberAsync(...)sends component metadata-get command.- Waits via
MetadataTrackerkeyed by component id. - Returns software part number from response payload.
This is a third model: cloud component metadata, separate from both MyRvLink table metadata and direct IDS-CAN frame metadata.
In Cloud Gateway Code, discovery is primarily IDS-CAN identity driven.
Key observations:
ProgramwiresGatewayManagedConnectionwith a CAN adapter factory.CloudGatewayCanDeviceInfodefines local host product/type/function identity for the cloud gateway node.GatewayManagedConnectionchooses transport by connection type and BLE gateway version.- Logical device lifecycle starts/stops with
LogicalDeviceService.StartCan(...)andStopCan(...).
This supports the same conclusion: non-MyRvLink flows rely on live CAN identity and adapter semantics rather than table + metadata table fetches.
You can normalize app behavior into this runtime decision tree:
-
Connection archetype selected
- MyRvLink (BLE/TCP COBS event stream)
- IDS-CAN direct (BLE/TCP adapter)
- Cloud IoT component API
-
For MyRvLink
- Consume GatewayInformation
- Pull device table
- Pull metadata table
- Validate counts + CRCs
- Merge by index
- Materialize logical devices
-
For IDS-CAN direct
- Decode transport frames based on gateway version
- Track physical devices from live CAN network data
- Build logical devices directly from
DEVICE_ID + MAC + capabilities
-
For Cloud IoT
- Enumerate components from cloud view
- Apply status and online state
- Fetch metadata by component command when needed
If your bridge needs to be robust across all observed hardware/gateway paths, it should:
- Detect and preserve connection archetype (MyRvLink vs IDS-CAN vs Cloud).
- For MyRvLink, model dual tables + CRCs (device and metadata are separate assets).
- Parse metadata rows with protocol-dependent decoding (
HostvsIdsCan, legacy vs extended payload sizes). - Keep transport decoding strategy version-aware (
V1vsV2/V2_Dwrappers). - Avoid assuming software part number exists at initial enumeration time in all paths.
- Treat metadata as mutable/versioned and support refresh on table CRC changes.
- Decompiled output may rename symbols and sometimes flatten source structure.
- Despite that, the control/data flow relationships are consistent across multiple classes and strongly corroborated.
- Confidence is high for:
- MyRvLink dual-table discovery model
- Merge-by-index + CRC validation behavior
- BLE version-specific transport decoding differences
- Distinct cloud component metadata path
Create a bridge-side “metadata normalization spec” with:
- Input source type (
myrvlink_table,idscan_live,cloud_component) - Required/optional fields per source
- Confidence flags and update semantics
- Version/source provenance for each field
This makes downstream Home Assistant entities resilient to partial metadata availability and gateway variation.
Use this as an execution checklist when implementing metadata discovery in android_ble_plugin_bridge.
- Define a top-level source discriminator for each discovered endpoint:
myrvlink_tableidscan_livecloud_component
- Define one normalized metadata DTO used by all pipelines.
- Include provenance on every field (
source,decoder,gateway_version,timestamp). - Include confidence/quality flags (
exact,derived,missing,stale).
- Parse/track
GatewayInformationevents. - Persist current
device_table_id,device_table_crc,metadata_table_crc. - Trigger
GetDeviceswhen table CRC changes or cache miss. - Trigger
GetDevicesMetadatawhen metadata CRC changes or cache miss. - Validate completion conditions:
- received count == decoded row count
- response CRC == expected CRC
- start row host constraints when start id is 0
- Merge device rows + metadata rows by index only after both pass validation.
- Reject merge when counts differ.
- Implement protocol dispatch for
None,Host,IdsCan. - Support Host device payload sizes:
-
0(legacy) -
10(IDS-CAN style identity)
-
- Support Host metadata payload sizes:
-
0(legacy) -
17(extended metadata)
-
- Support IDS-CAN metadata payload size:
-
17
-
- Decode and map fields:
- product id
- device type
- device instance
- function name
- function instance
- raw capability
- IDS-CAN version
- circuit id
- software part number
- Detect gateway family/version from advertisement:
- legacy part/rev nibble path
- IDS manufacturer-specific protocol version path
- Distinguish special scan-result families where present:
- generic BLE gateway
-
X180T -
SureShade
- Preserve gateway version in runtime context and metadata provenance.
- Implement V1 receive handling (raw + synthetic compatibility message behavior if needed for parity).
- Implement V2/V2_D wrapper decode path:
- Packed
- ElevenBit
- TwentyNineBit
- Reconstruct canonical internal message format before higher-level parsing.
- Build logical identity from live
DEVICE_ID + MACobservations. - Track online/offline by current CAN address and heartbeat/state.
- Handle rename/morph behavior when function name/instance changes.
- Keep this pipeline independent from table-CRC assumptions.
- Enumerate initial components from cloud vehicle view.
- Map each component to a logical device key.
- Support on-demand metadata command for software part number.
- Correlate async metadata responses by component id tracker key.
- Cache MyRvLink device rows keyed by
device_table_crc. - Cache MyRvLink metadata rows keyed by
metadata_table_crc. - Invalidate on CRC mismatch, count mismatch, or decode failure.
- Mark normalized metadata stale when live source disconnects.
- Log decode failures with source type, gateway version, and raw payload length.
- Emit metric counters for:
- CRC mismatch
- count mismatch
- unknown protocol/type
- partial metadata merges blocked
- Keep non-fatal fallback behavior (preserve minimal identity even when metadata is partial).
- Ensure unique/stable device identifiers do not depend on transient fields.
- Expose
software_part_numberonly when confirmed from source. - Expose
circuit_idonly when decoder confidence is exact. - Surface source/provenance in diagnostics payload.
- Include gateway type/version and parse path in diagnostics.
- MyRvLink + legacy host metadata (
payload 0) - MyRvLink + extended host metadata (
payload 17) - MyRvLink + IDS-CAN metadata (
payload 17) - BLE gateway version
V1frame path - BLE gateway version
V2frame path - BLE gateway version
V2_Dframe path -
X180Tadvertisement parsing path -
SureShadeadvertisement parsing path - IDS-CAN direct device add/rename/offline transitions
- Cloud metadata command round-trip (
software_part_number)
- All three pipelines produce the same normalized metadata schema.
- Provenance and confidence fields are present for every metadata payload.
- CRC and count guards prevent invalid merges.
- Gateway-version-specific decode branches are covered by tests.
- Diagnostics clearly explain where each metadata field came from.