This repository was archived by the owner on Mar 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
How to add a new vendor
Guy Luz edited this page Feb 17, 2025
·
2 revisions
- Under
lib/src/infrastructure/devicescreate a folder with the name of the vendor. - Create a connector class that
extends VendorConnectorConjectureServicewith 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);
}- Call your class in
VendorsConnectorConjectureunder_singletonConstructor