Skip to content
This repository was archived by the owner on Mar 9, 2025. It is now read-only.

How to add a new vendor

Guy Luz edited this page Feb 17, 2025 · 2 revisions

Instructions for adding support for a new vendor

  1. Under lib/src/infrastructure/devices create a folder with the name of the vendor.
  2. Create a connector class that extends VendorConnectorConjectureService with instance. Here is an example with Google
class GoogleConnectorConjecture extends VendorConnectorConjectureService {
  factory GoogleConnectorConjecture() {
    return _instance;
  }

  GoogleConnectorConjecture._singletonContractor()
      : super(
          /// Needed for the software to connect actions to the specific vendor 
          VendorsAndServices.google,
          /// How the vendor should look to the user in the app
          displayName: 'Google',
          /// Icon of the vendor to show the user in the app
          imageUrl:
              'https://play-lh.googleusercontent.com/aFWiT2lTa9CYBpyPjfgfNHd0r5puwKRGj2rHpdPTNrz2N9LXgN_MbLjePd1OTc0E8Rl1=s180',
          /// Mdns of devices that are unique to this vendor
          uniqeMdnsList: ['_googlecast._tcp', '_androidtvremote2._tcp'],
          /// Mdns of the devices that are not unique to this vendor and will require additional params to distinguish that this is the device from this vendor
          mdnsList: ['_rc._tcp'],
          uniqueIdentifierNameInMdns: ['google', 'android', 'chrome'],
        );
  /// For creating a single instance for handling each vendor
  static final GoogleConnectorConjecture _instance =
      GoogleConnectorConjecture._singletonContractor();
  
  /// What to do when a new device got discovered. Should return each entity of the device separately.
  @override
  Future<HashMap<String, DeviceEntityBase>> newEntityToVendorDevice(
    DeviceEntityBase entity, {
    bool fromDb = false,
  }) =>
      GoogleHelpers.addDiscoveredDevice(entity);
}
  1. Call your class in VendorsConnectorConjecture under _singletonConstructor
Clone this wiki locally