Model constructor

const Model({
  1. required String id,
  2. required String name,
  3. String? flespiId,
  4. InboundProtocol? protocol,
  5. String? protocolId,
  6. bool? isGeneric,
  7. @Default.new([]) List<CommandDefinition> commandsStructure,
  8. @Default.new([]) List<ConfigGrouping> configStructure,
  9. @Default.new(false) bool confiotCapable,
  10. @JsonKey.new(unknownEnumValue: ConfIoTLayout.standard) @Default.new(ConfIoTLayout.standard) ConfIoTLayout confiotLayout,
  11. String? confiotName,
  12. String? peripheralIdentifier,
  13. Map<String, dynamic>? peripheralParserSpec,
  14. @Default.new([]) List<FirmwareBuild> firmwares,
})

Model is the model of a device. It contains the information about the model of the device. Does not contain information of connectivity or related, only the model information like the name, the protocol and if is generic or not.

Implementation

const factory Model({
  /// [id] is the unique identifier of the model.
  required String id,

  /// [name] is the name of the model.
  required String name,

  /// [flespiId] is the ID of the device in the flespi platform.
  /// Can be null if the model is not connected to a device or is a in-house protocol.
  String? flespiId,

  /// [protocol] is the protocol of the model.
  InboundProtocol? protocol,

  /// [protocolId] is the ID of the protocol
  String? protocolId,

  /// [isGeneric] is true if the model is generic.
  bool? isGeneric,

  /// [commandsStructure] is the structure of the commands for the protocol.
  @Default([]) List<CommandDefinition> commandsStructure,

  /// [configStructure] is the structure of the configuration for the protocol.
  @Default([]) List<ConfigGrouping> configStructure,

  /// [confiotCapable] is the boolean that indicates if the protocol is capable of using the Confiot platform.
  @Default(false) bool confiotCapable,

  /// [confiotLayout] defines what kind of layout should be displayed in ConfIoT.
  @JsonKey(unknownEnumValue: ConfIoTLayout.standard) @Default(ConfIoTLayout.standard) ConfIoTLayout confiotLayout,

  /// [confiotName] is the name of the model in the ConfIoT.
  String? confiotName,

  /// [peripheralIdentifier] is the identifier of the peripheral device.
  String? peripheralIdentifier,

  /// [peripheralParserSpec] is the parser specification for the peripheral device.
  Map<String, dynamic>? peripheralParserSpec,

  /// [firmwares] is the list of firmwares for the model.
  @Default([]) List<FirmwareBuild> firmwares,
}) = _Model;