-
public final class WearDataLayerRegistryImplementation of Androidx Datastore for Proto and Preferences on top of the Wearable DataClient.
See https://developer.android.com/topic/libraries/architecture/datastore for DataStore features.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classWearDataLayerRegistry.Companion
-
Field Summary
Fields Modifier and Type Field Description private final SerializerRegistryserializersprivate final DataClientdataClientprivate final NodeClientnodeClientprivate final MessageClientmessageClientprivate final CapabilityClientcapabilityClient
-
Constructor Summary
Constructors Constructor Description WearDataLayerRegistry(DataClient dataClient, NodeClient nodeClient, MessageClient messageClient, CapabilityClient capabilityClient, CoroutineScope coroutineScope)
-
Method Summary
Modifier and Type Method Description final SerializerRegistrygetSerializers()final DataClientgetDataClient()final NodeClientgetNodeClient()final MessageClientgetMessageClient()final CapabilityClientgetCapabilityClient()final <T extends Any> DataStore<T>protoDataStore(String path, CoroutineScope coroutineScope, Serializer<T> serializer, SharingStarted started)Returns a local Proto DataStore for the given Proto structure. final <T extends Any> Flow<T>protoFlow(TargetNodeId targetNodeId, Serializer<T> serializer, String path)final <T extends Any> UnitregisterSerializer(Serializer<T> serializer)final <T extends Any> UnitregisterProtoDataListener(String path, ProtoDataListener<T> listener)final <T extends Any> UnitregisterProtoDataListener(String path, ProtoDataListener<T> listener, Serializer<T> serializer)final UnitonDataChanged(List<DataEvent> dataEvents)-
-
Method Detail
-
getSerializers
final SerializerRegistry getSerializers()
-
getDataClient
final DataClient getDataClient()
-
getNodeClient
final NodeClient getNodeClient()
-
getMessageClient
final MessageClient getMessageClient()
-
getCapabilityClient
final CapabilityClient getCapabilityClient()
-
protoDataStore
final <T extends Any> DataStore<T> protoDataStore(String path, CoroutineScope coroutineScope, Serializer<T> serializer, SharingStarted started)
Returns a local Proto DataStore for the given Proto structure.
- Parameters:
path- the path inside the data client namespace, of the form "/xyz/123"coroutineScope- the coroutine scope used for the internal SharedFlow.serializer- the data store Serializerstarted- the SharingStarted mode for the internal SharedFlow.
-
protoFlow
final <T extends Any> Flow<T> protoFlow(TargetNodeId targetNodeId, Serializer<T> serializer, String path)
-
registerSerializer
final <T extends Any> Unit registerSerializer(Serializer<T> serializer)
-
registerProtoDataListener
final <T extends Any> Unit registerProtoDataListener(String path, ProtoDataListener<T> listener)
-
registerProtoDataListener
final <T extends Any> Unit registerProtoDataListener(String path, ProtoDataListener<T> listener, Serializer<T> serializer)
-
onDataChanged
final Unit onDataChanged(List<DataEvent> dataEvents)
-
-
-
-