toArguments method

Map<String, dynamic> toArguments()

Converts the service to a map of arguments.

This method is useful for passing the service as arguments to the Faketooth simulator.

Example usage:

FaketoothService service = FaketoothService(
  uuid: '0000180f-0000-1000-8000-00805f9b34fb',
  isPrimary: true,
  characteristics: [
    FaketoothCharacteristic(
      uuid: '00002a19-0000-1000-8000-00805f9b34fb',
      properties: {FaketoothCharacteristicProperties.read},
    ),
  ],
);

Map<String, dynamic> arguments = service.toArguments();
print(arguments);
// Output: {uuid: '0000180f-0000-1000-8000-00805f9b34fb', isPrimary: true, characteristics: [...]}

Implementation

Map<String, dynamic> toArguments() {
  return {
    'uuid'             : uuid,
    'isPrimary'        : isPrimary,
    'characteristics'  : characteristics?.map((e) => e.toArguments()).toList(),
    'includedServices' : includedServices?.map((e) => e.toArguments()).toList(),
  };
}