lb_discovery

Last updated:

0 purchases

lb_discovery Image
lb_discovery Images
Add to Cart

Description:

lb discovery

Logbot Discovery SDK for Flutter #
This is a package that provides an MDNS service to scan and find nearby IoTs.
Requirements #
Dart 2.17 or later
Installation & Usage #
Add the dependencies from pub.dev:
dependencies:
lb_auth:
lb_discovery:
copied to clipboard
lb_auth is always required to make authorized calls to the APIs.
To use the SDK on you application see the example below:
For Android, add the following properties to your Android Manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
copied to clipboard
For iOS, add the following properties to Info.plist:
<key>NSLocalNetworkUsageDescription</key>
<string>Required to discover local network devices</string>
<key>NSBonjourServices</key>
<array>
<string>_http._tcp</string>
</array>
copied to clipboard
To use the SDK on you application see the example below:
import 'package:lb_auth/lb_auth.dart';
import 'package:lb_discovery/lb_discovery.dart';

class Example {

Future<void> run() async {
/// Initialize Logbot SDK by logging in with Logbot Credentials
await LogbotAuth.init(LogbotCredentials(
username: username,
password: password,
clientId: clientId,
clientSecret: clientSecret,
));
/// Now you can use every API included on the SDK
/// for example:
await LogbotDiscovery.startDiscovery();
List<Device> response = await LogbotDiscovery.discovery.discoverLocal();
}
}
copied to clipboard

discover(): shows all devices, both locally and remote. Will also show devices that the user do not own. Requires authentication.
discover(DiscoveryFilter.OWNED): shows all devices that the user owns, both locally and remote. Requires authentication.
discover(DiscoveryFilter.NOT_CONFIG): shows devices that are not configured. These devices will surely be on the local network. No authentication required. same as discoverLocal(DiscoveryFilter.NOT_CONFIG).
discoverLocal(): shows all devices in the local network, included not configured. No authentication required.
discoverLocal(DiscoveryFilter.OWNED): shows only local devices that the user owns, skipping not configured devices. Requires authentication.
discoverLocal(DiscoveryFilter.NOT_CONFIG): shows only local devices that are not configured. No authentication required.
discoverRemote(): shows only the remote devices that the user owns and registered to the platform. Requires authentication.

Note: owned flag should not be considered when using discoverLocal() API.
Tests #
To run all tests:
flutter test
copied to clipboard
Documentation for API Endpoints #



Class
Method
Description




DiscoveryApi
discover
GET /discovery


DiscoveryApi
discoverDevice
GET /discovery/{deviceId}


DiscoveryApi
discoverLocal
GET /discovery/local


DiscoveryApi
discoverRemote
GET /discovery/remote



Documentation For Models #

Device

Author #
Logbot SRL [email protected]

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.