Class ID Registry¶
Every Externalizable class in BM has a fixed class ID (i16). The class ID appears in the object envelope and tells the deserializer which class to instantiate.
How It Works¶
Both the sender and receiver maintain an identical registry that maps class IDs to class implementations. This registry is populated at startup and must be consistent across all SDK implementations for communication to succeed.
When deserializing, the process is:
- Read the class ID from the object envelope.
- Look up the class ID in the registry.
- Create a new instance of that class.
- Call
readExternal()on the instance to read its fields.
If a class ID is not found in the registry, deserialization fails.
Class ID Table¶
See the Class ID Reference Table for the complete mapping of class IDs to object types.
Notes¶
- Class ID 0 is used by
BMPacket. ID 256 is registered as an alias forBMPacketin the Android SDK. - Class IDs are protocol-defined constants. They are not negotiated or exchanged dynamically.
- Device subclasses (e.g.
AndroidDevice,FlashDevice) have their own class IDs (10, 18, etc.) distinct from the baseDeviceclass.