pivo
Developed by Sports Visio, Inc
Usage
Initialize the plugin with your License key
String? licenseKey;
if (Platform.isAndroid) {
licenseKey =
'{"owner":"Pivo","platform":"android","plan":"pro","appIdentifier":"app.pivo.android.prosdkdemo","createdAt":1587528360,"expiredAt":2524575600,"signature":"KqyuZmlt5rOQynORymSI+o2hMRwPdWUcU/LPBqZAQQUJybEBaL7+LlWdReAcfnNyafStKjw607s2Jf79T3Nbhq/jpvTD/upGga2BqJYTOiOsUGpZe/vjDgR3iMad0IOdmEf/68hdvo70w0AObZ9xufO5rjMTXc/sXY43kQ40/KS9UQfICUzLi1zgnJNF+C08n5fKuY7vzEOFB8P6Id0UTRFrPVDTkzTpze7aUtkF0pvJ/F+8FnRMP2r004sGVsGREJYnvAAPnV76yPzy4jsBAc4qVxTY508FwL/AwtNN5n1gJAdpS9D+0HkK1bvaxwWCBZ0Kk67uqFjXSaiOBrN5vQ=="}';
} else {
licenseKey =
'{"owner":"Pivo","platform":"ios","plan":"pro","appIdentifier":"app.pivo.ios.prosdkdemo","createdAt":1589928528,"expiredAt":2537535600,"signature":"QCnY1ShAHgBRnxfkeLNesDhogCj8PtFavbeqIK/hpq0+2U1vVByvJHzYYqyD9MsqWkuhorYETmB3bGLfhQzuf1C/IYVTg6STXBu5xJJxGbchGT/YcEmnyhHMXg6kkXUUNHYQGu45iuk11olX6aaxNhVY+UatMW9V4hcBjalNoVnbQiID/Mk4jVYFw/e+lB/JX0/ALhQJb1GwsATrEbnwY4F6YNLfPyQ7AAiuf9VDa0tmf0XpV6EiRNYcuqHWta9n8Wft78iG4bxKCV7zF7VmbVI9a1wlOOXrv6bGFl85NVjtSecnai+difBqNz0QXFfD6uXoJqU9orAtc9hrI4caGg=="}';
}
await PivoPlatform.instance.unlockWithLicenseKey(licenseKey);
Connect to a device
final devicesStream = PivoPlatform.instance.scanResults;
await PivoPlatform.instance.startScan();
// Listen to the stream
devicesStream.listen((event) async {
await PivoPlatform.instance.stopScan();
// connect to a device
unawaited(PivoPlatform.instance.connect(
event.first.device,
)),
});
Turn your Pivo device
// Get supported speeds
final supportedSpeedsInSeconds =
await PivoPlatform.instance.getSupportedSpeedsInSecondsPerRound();
// Turn the device to the right, 90 degrees, at maximum speed
await PivoPlatform.instance.turnRight(90, supportedSpeedsInSeconds.first);
// Wait a bit for it to complete
await Future.delayed(Duration(seconds: 3));
// Turn the device to the right, 90 degrees, at maximum speed
await PivoPlatform.instance.turnLeft(90, supportedSpeedsInSeconds.first);
// Wait a bit for it to complete
await Future.delayed(Duration(seconds: 3));
// Turn the device to the left continuously, at maximum speed
await PivoPlatform.instance
.turnLeftContinuously(supportedSpeedsInSeconds.first);
await Future.delayed(Duration(seconds: 3));
// Stop the device
await PivoPlatform.instance.stop();
// Turn the device to the right continuously, at maximum speed
await PivoPlatform.instance
.turnRightContinuously(supportedSpeedsInSeconds.first);
await Future.delayed(Duration(seconds: 3));
// Stop the device
await PivoPlatform.instance.stop();
Disconnect from a device
await PivoPlatform.instance.disconnect();