From 2a87b4d2e7e1ac6dec4ab9838ffcb7bd4fd072dd Mon Sep 17 00:00:00 2001 From: Sakina Boriwala Date: Thu, 9 Feb 2023 21:20:57 +0530 Subject: [PATCH 1/7] Bloc version update fixes --- example/android/app/build.gradle | 4 +- .../android/app/src/main/AndroidManifest.xml | 1 - example/lib/ble_screen/ble_bloc.dart | 49 ++- example/lib/ble_screen/ble_event.dart | 1 + example/lib/ble_screen/ble_screen.dart | 5 +- example/lib/ble_service.dart | 53 +-- example/lib/scan_list.dart | 7 +- .../lib/wifi_screen/password_form_field.dart | 5 +- example/lib/wifi_screen/wifi_bloc.dart | 61 +-- example/lib/wifi_screen/wifi_screen.dart | 71 ++-- example/pubspec.lock | 91 ++--- example/pubspec.yaml | 4 +- lib/src/crypt.dart | 8 +- lib/src/esp_prov.dart | 85 ++-- lib/src/proto/dart/constants.pb.dart | 3 +- lib/src/proto/dart/constants.pbenum.dart | 6 +- lib/src/proto/dart/constants.pbjson.dart | 3 +- lib/src/proto/dart/constants.pbserver.dart | 3 +- lib/src/proto/dart/sec0.pb.dart | 123 +++--- lib/src/proto/dart/sec0.pbenum.dart | 12 +- lib/src/proto/dart/sec0.pbjson.dart | 41 +- lib/src/proto/dart/sec0.pbserver.dart | 3 +- lib/src/proto/dart/sec1.pb.dart | 228 +++++++---- lib/src/proto/dart/sec1.pbenum.dart | 18 +- lib/src/proto/dart/sec1.pbjson.dart | 86 +++- lib/src/proto/dart/sec1.pbserver.dart | 3 +- lib/src/proto/dart/session.pb.dart | 64 +-- lib/src/proto/dart/session.pbenum.dart | 12 +- lib/src/proto/dart/session.pbjson.dart | 32 +- lib/src/proto/dart/session.pbserver.dart | 3 +- lib/src/proto/dart/wifi_config.pb.dart | 348 ++++++++++------ lib/src/proto/dart/wifi_config.pbenum.dart | 24 +- lib/src/proto/dart/wifi_config.pbjson.dart | 128 +++++- lib/src/proto/dart/wifi_config.pbserver.dart | 3 +- lib/src/proto/dart/wifi_constants.pb.dart | 64 ++- lib/src/proto/dart/wifi_constants.pbenum.dart | 35 +- lib/src/proto/dart/wifi_constants.pbjson.dart | 12 +- .../proto/dart/wifi_constants.pbserver.dart | 3 +- lib/src/proto/dart/wifi_scan.pb.dart | 372 ++++++++++++------ lib/src/proto/dart/wifi_scan.pbenum.dart | 24 +- lib/src/proto/dart/wifi_scan.pbjson.dart | 107 ++++- lib/src/proto/dart/wifi_scan.pbserver.dart | 3 +- lib/src/security.dart | 4 +- lib/src/security1.dart | 54 ++- lib/src/transport_ble.dart | 91 ++++- pubspec.lock | 50 +-- pubspec.yaml | 12 +- test/esp_provisioning_test.dart | 5 +- 48 files changed, 1621 insertions(+), 803 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 2d45003..767fa1e 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) { def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") + throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') @@ -25,7 +25,7 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 29 + compileSdkVersion 31 lintOptions { disable 'InvalidPackage' diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 8c369ef..67b99f2 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,6 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> { StreamSubscription _scanSubscription; List> bleDevices = new List>(); - BleBloc(BleState initialState) : super(initialState); - - @override - Stream mapEventToState( - BleEvent event, - ) async* { - if (event is BleEventStart) { - yield* _mapStartToState(); - } else if (event is BleEventDeviceUpdated) { - yield BleStateLoaded(List.from(event.bleDevices)); - } else if (event is BleEventSelect) { - bleService.select(event.selectedDevice['peripheral']); - } else if (event is BleEventStopScan) { + BleBloc() : super(BleStateLoading()) { + on((event, emit) async { + await for (final result in _mapStartToState()) { + emit(result); + } + }); + on((event, emit) { + emit(BleStateLoaded(List.from(event.bleDevices))); + }); + on((event, emit) async { + emit(BleStatePermissionDenied()); + }); + on((event, emit) async { await bleService.stopScanBle(); - } + }); + on((event, emit) async { + bleService.select(event.selectedDevice['peripheral']); + }); } + // @override + // Stream mapEventToState( + // BleEvent event, + // ) async* { + // if (event is BleEventStart) { + // yield* _mapStartToState(); + // } else if (event is BleEventDeviceUpdated) { + // yield BleStateLoaded(List.from(event.bleDevices)); + // } else if (event is BleEventSelect) { + // bleService.select(event.selectedDevice['peripheral']); + // } else if (event is BleEventStopScan) { + // await bleService.stopScanBle(); + // } + // } + Stream _mapStartToState() async* { var permissionIsGranted = await bleService.requestBlePermissions(); if (!permissionIsGranted) { @@ -59,7 +77,8 @@ class BleBloc extends Bloc { @override Future close() { + super.close(); _scanSubscription?.cancel(); - bleService.stopScanBle(); + return bleService.stopScanBle(); } } diff --git a/example/lib/ble_screen/ble_event.dart b/example/lib/ble_screen/ble_event.dart index 441e3d5..098b82b 100644 --- a/example/lib/ble_screen/ble_event.dart +++ b/example/lib/ble_screen/ble_event.dart @@ -10,6 +10,7 @@ abstract class BleEvent extends Equatable { class BleEventStart extends BleEvent {} class BleEventPermissionDenied extends BleEvent {} + class BleEventStopScan extends BleEvent {} class BleEventDeviceUpdated extends BleEvent { diff --git a/example/lib/ble_screen/ble_screen.dart b/example/lib/ble_screen/ble_screen.dart index 437ec96..e13f343 100644 --- a/example/lib/ble_screen/ble_screen.dart +++ b/example/lib/ble_screen/ble_screen.dart @@ -14,7 +14,6 @@ class BleScreen extends StatefulWidget { } class _BleScreenState extends State { - void _showBottomSheet(Map item, BuildContext _context) { BlocProvider.of(_context).add(BleEventStopScan()); BlocProvider.of(_context).add(BleEventSelect(item)); @@ -50,7 +49,7 @@ class _BleScreenState extends State { title: const Text('Scanning BLE devices'), ), body: BlocProvider( - create: (BuildContext context) => BleBloc(BleStateLoading())..add(BleEventStart()), + create: (BuildContext context) => BleBloc()..add(BleEventStart()), child: BlocBuilder( builder: (BuildContext context, BleState state) { if (state is BleStatePermissionDenied) { @@ -66,7 +65,7 @@ class _BleScreenState extends State { } return Center( - child: SpinKitRipple(color: Theme.of(context).textSelectionColor), + child: SpinKitRipple(color: Colors.purple), ); }, ), diff --git a/example/lib/ble_service.dart b/example/lib/ble_service.dart index b2792d1..f094e12 100644 --- a/example/lib/ble_service.dart +++ b/example/lib/ble_service.dart @@ -6,7 +6,7 @@ import 'package:esp_provisioning/esp_provisioning.dart'; import 'package:logger/logger.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:rxdart/rxdart.dart'; -import 'package:location/location.dart' as location; +// import 'package:location/location.dart' as location; // import 'package:permission_handler/permission_handler.dart'; class BleService { @@ -55,18 +55,18 @@ class BleService { // if (Platform.isAndroid) { log.v('enableRadio'); - // await _bleManager.enableRadio(); + // await _bleManager.enableRadio(); // } try { BluetoothState state = await _waitForBluetoothPoweredOn(); _isPowerOn = state == BluetoothState.POWERED_ON; - if(!_isPowerOn){ + if (!_isPowerOn) { if (Platform.isAndroid) { await _bleManager.enableRadio(); - _isPowerOn=true; + _isPowerOn = true; } - } + } return state; } catch (e) { log.e('Error ${e.toString()}'); @@ -76,7 +76,7 @@ class BleService { void select(Peripheral peripheral) async { bool _check = await selectedPeripheral?.isConnected(); - if(_check == true){ + if (_check == true) { await selectedPeripheral?.disconnectOrCancelConnection(); } selectedPeripheral = peripheral; @@ -91,7 +91,7 @@ class BleService { stopScanBle(); await _stateSubscription?.cancel(); bool _check = await selectedPeripheral?.isConnected(); - if(_check == true){ + if (_check == true) { await selectedPeripheral?.disconnectOrCancelConnection(); } @@ -114,16 +114,22 @@ class BleService { return _bleManager.stopPeripheralScan(); } - Future startProvisioning({Peripheral peripheral, String pop = 'abcd1234'}) async { + Future startProvisioning( + {Peripheral peripheral, String pop = '6953327194'}) async { if (!_isPowerOn) { await _waitForBluetoothPoweredOn(); } Peripheral p = peripheral ?? selectedPeripheral; - log.v('peripheral $p'); + log.v('peripheral here $p'); await _bleManager.stopPeripheralScan(); - EspProv prov = EspProv( - transport: TransportBLE(p), security: Security1(pop: pop)); + log.v('STOPPPED PERIPHERAL SCAN ========'); + + EspProv prov = + EspProv(transport: TransportBLE(p), security: Security1(pop: pop)); + await prov.establishSession(); + log.i("PROV ${await prov.getStatus()}"); + return prov; } @@ -141,22 +147,21 @@ class BleService { completer.complete(bluetoothState); } }); - return completer.future.timeout(Duration(seconds: 5), - onTimeout: () {}); - // => throw Exception('Wait for Bluetooth PowerOn timeout')); + return completer.future.timeout(Duration(seconds: 5), onTimeout: () {}); + // => throw Exception('Wait for Bluetooth PowerOn timeout')); } Future requestBlePermissions() async { - location.Location _location = new location.Location(); - bool _serviceEnabled; - - _serviceEnabled = await _location.serviceEnabled(); - if (!_serviceEnabled) { - _serviceEnabled = await _location.requestService(); - if (!_serviceEnabled) { - return false; - } - } + // location.Location _location = new location.Location(); + // bool _serviceEnabled; + + // _serviceEnabled = await _location.serviceEnabled(); + // if (!_serviceEnabled) { + // _serviceEnabled = await _location.requestService(); + // if (!_serviceEnabled) { + // return false; + // } + // } var isLocationGranted = await Permission.locationWhenInUse.request(); log.v('checkBlePermissions, isLocationGranted=$isLocationGranted'); return isLocationGranted == PermissionStatus.granted; diff --git a/example/lib/scan_list.dart b/example/lib/scan_list.dart index 94f9dd5..c78b21a 100644 --- a/example/lib/scan_list.dart +++ b/example/lib/scan_list.dart @@ -25,7 +25,9 @@ class ScanList extends StatelessWidget { ), title: Text( item['name'] ?? item['ssid'], - style: TextStyle(color: Theme.of(_context).accentColor), + style: TextStyle( + color: Colors.purpleAccent, + ), ), trailing: Text(item['rssi'].toString()), onTap: () { @@ -48,8 +50,7 @@ class ScanList extends StatelessWidget { height: 80, child: Align( alignment: Alignment.center, - child: SpinKitRipple( - color: Theme.of(_context).textSelectionColor)))), + child: SpinKitRipple(color: Colors.purple)))), Expanded( child: ListView.separated( shrinkWrap: true, diff --git a/example/lib/wifi_screen/password_form_field.dart b/example/lib/wifi_screen/password_form_field.dart index d18cc36..c4886f4 100644 --- a/example/lib/wifi_screen/password_form_field.dart +++ b/example/lib/wifi_screen/password_form_field.dart @@ -34,13 +34,14 @@ class _PasswordFormFieldState extends State { return null; }, decoration: InputDecoration( - suffixIcon: FlatButton( + suffixIcon: TextButton( onPressed: () { setState(() { isObscureText = !isObscureText; }); }, - child: Icon(isObscureText ? Icons.remove_red_eye : Icons.lock_outline, + child: Icon( + isObscureText ? Icons.remove_red_eye : Icons.lock_outline, color: Theme.of(context).accentColor)), border: OutlineInputBorder( borderRadius: BorderRadius.circular(5), diff --git a/example/lib/wifi_screen/wifi_bloc.dart b/example/lib/wifi_screen/wifi_bloc.dart index 232771d..beaa3f4 100644 --- a/example/lib/wifi_screen/wifi_bloc.dart +++ b/example/lib/wifi_screen/wifi_bloc.dart @@ -10,22 +10,37 @@ class WifiBloc extends Bloc { EspProv prov; Logger log = Logger(printer: PrettyPrinter()); - WifiBloc(WifiState initialState) : super(initialState); - - @override - Stream mapEventToState( - WifiEvent event, - ) async* { - if (event is WifiEventLoad) { - yield* _mapLoadToState(); - } else if (event is WifiEventStartProvisioning) { - yield* _mapProvisioningToState(event); - } + WifiBloc() : super(WifiStateLoading()) { + on((event, emit) async { + await for (final result in _mapLoadToState()) { + emit(result); + } + }); + on((event, emit) async { + await for (final result in _mapProvisioningToState(event)) { + emit(result); + } + }); } + // @override + // Stream mapEventToState( + // WifiEvent event, + // ) async* { + // if (event is WifiEventLoad) { + // yield* _mapLoadToState(); + // } else if (event is WifiEventStartProvisioning) { + // yield* _mapProvisioningToState(event); + // } + // } + Stream _mapLoadToState() async* { + log.v("MAP LOAD TO STATE"); yield WifiStateConnecting(); + log.v("CONNECTING..."); try { + log.v("START PROVISIONING..."); + prov = await bleService.startProvisioning(); } catch (e) { log.e('Error conencting to device $e'); @@ -34,18 +49,18 @@ class WifiBloc extends Bloc { yield WifiStateScanning(); try { - var listWifi = await prov.startScanWiFi(); - List> mapListWifi = []; - listWifi.forEach((element) { - mapListWifi.add({ - 'ssid': element.ssid, - 'rssi': element.rssi, - 'auth': element.private.toString() != 'Open' - }); - }); + // var listWifi = await prov.startScanWiFi(); + // List> mapListWifi = []; + // listWifi.forEach((element) { + // mapListWifi.add({ + // 'ssid': element.ssid, + // 'rssi': element.rssi, + // 'auth': element.private.toString() != 'Open' + // }); + // }); - yield WifiStateLoaded(wifiList: mapListWifi); - log.v('Wifi $listWifi'); + // yield WifiStateLoaded(wifiList: mapListWifi); + // log.v('Wifi $listWifi'); } catch (e) { log.e('Error scan WiFi network $e'); yield WifiStateError('Error scan WiFi network'); @@ -55,7 +70,7 @@ class WifiBloc extends Bloc { Stream _mapProvisioningToState( WifiEventStartProvisioning event) async* { yield WifiStateProvisioning(); - await prov?.sendWifiConfig(ssid: event.ssid, password: event.password); + await prov?.sendWifiConfig(ssid: "TP-LINK_20E4", password: "19701963"); await prov?.applyWifiConfig(); await Future.delayed(Duration(seconds: 1)); yield WifiStateProvisioned(); diff --git a/example/lib/wifi_screen/wifi_screen.dart b/example/lib/wifi_screen/wifi_screen.dart index 524ba2e..36305c8 100644 --- a/example/lib/wifi_screen/wifi_screen.dart +++ b/example/lib/wifi_screen/wifi_screen.dart @@ -33,36 +33,31 @@ class _WiFiScreenState extends State { List _statusWidget = [ Column( children: [ - FlatButton.icon( - onPressed: () {}, - icon: SpinKitThreeBounce( - color: Colors.black, - size: 20, - ), - label: Text('Connecting..')) + IconButton( + onPressed: () {}, + icon: SpinKitThreeBounce( + color: Colors.black, + size: 20, + ), + ) ], ), Column( children: [ - FlatButton.icon( - onPressed: () {}, - icon: Icon( - Icons.check, - color: Colors.green, - ), - label: Text( - 'Connected', - style: TextStyle( - color: Colors.green, - ), - )), - FlatButton.icon( - onPressed: () {}, - icon: SpinKitThreeBounce( - color: Colors.black, - size: 20, - ), - label: Text('Scanning...')) + IconButton( + onPressed: () {}, + icon: Icon( + Icons.check, + color: Colors.green, + ), + ), + IconButton( + onPressed: () {}, + icon: SpinKitThreeBounce( + color: Colors.black, + size: 20, + ), + ) ], ) ]; @@ -72,7 +67,7 @@ class _WiFiScreenState extends State { wifiList = Expanded( child: ScanList(state.wifiList, Icons.wifi, disableLoading: true, onTap: (Map item, BuildContext _context) { - _showDialog(item, _context); + _showDialog(item, _context); })); } var body = Expanded(child: Container()); @@ -80,8 +75,10 @@ class _WiFiScreenState extends State { if (step < 2) { statusWidget = Expanded(child: _statusWidget[step]); body = Expanded( - child: - SpinKitDoubleBounce(color: Theme.of(context).textSelectionColor)); + child: SpinKitDoubleBounce( + color: Colors.purple, + ), + ); } else { body = wifiList; } @@ -114,7 +111,7 @@ class _WiFiScreenState extends State { ), ), body: BlocProvider( - create: (BuildContext context) => WifiBloc(WifiStateLoading())..add(WifiEventLoad()), + create: (BuildContext context) => WifiBloc()..add(WifiEventLoad()), child: BlocBuilder( builder: (BuildContext context, WifiState state) { if (state is WifiStateConnecting) { @@ -132,7 +129,7 @@ class _WiFiScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ SpinKitThreeBounce( - color: Theme.of(context).textSelectionColor, + color: Colors.purple, size: 20, ), Text('Provisioning', @@ -144,16 +141,20 @@ class _WiFiScreenState extends State { if (state is WifiStateProvisioned) { return Container( child: Center( - child: MaterialButton(child: Text('Done'), color: Colors.redAccent, onPressed: () { - Navigator.of(context).pop(); - },), + child: MaterialButton( + child: Text('Done'), + color: Colors.redAccent, + onPressed: () { + Navigator.of(context).pop(); + }, + ), ), ); } return Container( child: Center( child: SpinKitThreeBounce( - color: Theme.of(context).textSelectionColor, + color: Colors.purple, size: 20, ), ), diff --git a/example/pubspec.lock b/example/pubspec.lock index 9f14e39..aedcd0f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,14 +7,14 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.9.0" bloc: dependency: transitive description: name: bloc url: "https://pub.dartlang.org" source: hosted - version: "7.0.0" + version: "8.1.0" boolean_selector: dependency: transitive description: @@ -28,28 +28,21 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" crypto: dependency: transitive description: @@ -91,7 +84,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" fixnum: dependency: transitive description: @@ -107,17 +100,17 @@ packages: flutter_ble_lib: dependency: transitive description: - name: flutter_ble_lib - url: "https://pub.dartlang.org" - source: hosted - version: "2.3.2" + path: "../../FlutterBleLib" + relative: true + source: path + version: "2.4.0" flutter_bloc: dependency: "direct main" description: name: flutter_bloc url: "https://pub.dartlang.org" source: hosted - version: "7.0.0" + version: "8.1.1" flutter_spinkit: dependency: "direct main" description: @@ -130,46 +123,13 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_web_plugins: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.dartlang.org" - source: hosted - version: "4.0.0" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" - location: - dependency: "direct main" - description: - name: location - url: "https://pub.dartlang.org" - source: hosted - version: "4.1.1" - location_platform_interface: - dependency: transitive - description: - name: location_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - location_web: - dependency: transitive - description: - name: location_web - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" + version: "0.6.4" logger: dependency: "direct main" description: @@ -183,14 +143,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.8.0" nested: dependency: transitive description: @@ -204,7 +171,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" permission_handler: dependency: "direct main" description: @@ -239,7 +206,7 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "6.0.5" rxdart: dependency: "direct main" description: @@ -258,7 +225,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -279,21 +246,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.12" typed_data: dependency: transitive description: @@ -307,7 +274,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.0.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index ee7944d..ab4d64a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -12,13 +12,13 @@ dependencies: esp_provisioning: path: ../ - flutter_bloc: ^7.0.0 + flutter_bloc: ^8.1.1 logger: ^1.0.0 permission_handler: ^7.0.0 equatable: ^2.0.0 rxdart: ^0.26.0 flutter_spinkit: ^5.0.0 - location: ^4.1.1 + # location: ^4.4.0 cupertino_icons: ^1.0.2 diff --git a/lib/src/crypt.dart b/lib/src/crypt.dart index 3d3351f..6a0572e 100644 --- a/lib/src/crypt.dart +++ b/lib/src/crypt.dart @@ -4,16 +4,16 @@ import 'dart:typed_data'; import 'package:flutter/services.dart'; class Crypt { - static const MethodChannel _channel = - const MethodChannel('esp_provisioning'); + static const MethodChannel _channel = const MethodChannel('esp_provisioning'); - Future init (Uint8List key, Uint8List iv) async { + Future init(Uint8List key, Uint8List iv) async { return await _channel.invokeMethod('init', { 'key': key, 'iv': iv, }); } - Future crypt (Uint8List data) async { + + Future crypt(dynamic data) async { return _channel.invokeMethod('crypt', { 'data': data, }); diff --git a/lib/src/esp_prov.dart b/lib/src/esp_prov.dart index 14cfffc..b3a040e 100644 --- a/lib/src/esp_prov.dart +++ b/lib/src/esp_prov.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:developer'; import 'dart:typed_data'; import 'package:esp_provisioning/src/connection_models.dart'; @@ -19,27 +20,36 @@ class EspProv { Future establishSession() async { SessionData responseData; - await transport.disconnect(); + log("TRANSPORT DISCONNECT"); + await transport?.disconnect(); + log("TRANSPORT DISCONNECTED=========="); - if(await transport.connect()){ - while (await transport.checkConnect()) { - var request = await security.securitySession(responseData); + if (await transport?.connect() ?? false) { + log("CONNECTED TRUE"); + + while (await transport?.checkConnect() ?? false) { + log("TRANSPORT CHECK CONNECT TRUE"); + var request = await security?.securitySession(responseData); if (request == null) { + log("REQUEST IS NULL"); + return; } - var response = - await transport.sendReceive('prov-session', request.writeToBuffer()); - if (response.isEmpty) { + log("WRITE TO BUFFER ${request.writeToBuffer()}"); + var response = await transport?.sendReceive( + 'prov-session', request.writeToBuffer()); + if (response?.isEmpty ?? true) { throw Exception('Empty response'); } - responseData = SessionData.fromBuffer(response); + responseData = SessionData.fromBuffer(response?.toList() ?? []); } } + log("CONNECTED FALSE"); return; } Future dispose() async { - return await transport.disconnect(); + return await transport?.disconnect(); } Future> startScanWiFi() async { @@ -47,7 +57,8 @@ class EspProv { } Future startScanResponse(Uint8List data) async { - var respPayload = WiFiScanPayload.fromBuffer(await security.decrypt(data)); + var respPayload = WiFiScanPayload.fromBuffer( + (await security?.decrypt(data))?.toList() ?? []); if (respPayload.msg != WiFiScanMsgType.TypeRespScanStart) { throw Exception('Invalid expected message type $respPayload'); } @@ -68,13 +79,14 @@ class EspProv { scanStart.groupChannels = groupChannels; scanStart.periodMs = periodMs; payload.cmdScanStart = scanStart; - var reqData = await security.encrypt(payload.writeToBuffer()); - var respData = await transport.sendReceive('prov-scan', reqData); + var reqData = await security?.encrypt(payload.writeToBuffer()); + var respData = await transport?.sendReceive('prov-scan', reqData); return await startScanResponse(respData); } Future scanStatusResponse(Uint8List data) async { - var respPayload = WiFiScanPayload.fromBuffer(await security.decrypt(data)); + var respPayload = WiFiScanPayload.fromBuffer( + (await security?.decrypt(data))?.toList() ?? []); if (respPayload.msg != WiFiScanMsgType.TypeRespScanStatus) { throw Exception('Invalid expected message type $respPayload'); } @@ -84,8 +96,8 @@ class EspProv { Future scanStatusRequest() async { WiFiScanPayload payload = WiFiScanPayload(); payload.msg = WiFiScanMsgType.TypeCmdScanStatus; - var reqData = await security.encrypt(payload.writeToBuffer()); - var respData = await transport.sendReceive('prov-scan', reqData); + var reqData = await security?.encrypt(payload.writeToBuffer()); + var respData = await transport?.sendReceive('prov-scan', reqData); return await scanStatusResponse(respData); } @@ -99,13 +111,14 @@ class EspProv { cmdScanResult.count = count; payload.cmdScanResult = cmdScanResult; - var reqData = await security.encrypt(payload.writeToBuffer()); - var respData = await transport.sendReceive('prov-scan', reqData); + var reqData = await security?.encrypt(payload.writeToBuffer()); + var respData = await transport?.sendReceive('prov-scan', reqData); return await scanResultResponse(respData); } Future> scanResultResponse(Uint8List data) async { - var respPayload = WiFiScanPayload.fromBuffer(await security.decrypt(data)); + var respPayload = WiFiScanPayload.fromBuffer( + (await security?.decrypt(data))?.toList() ?? []); if (respPayload.msg != WiFiScanMsgType.TypeRespScanResult) { throw Exception('Invalid expected message type $respPayload'); } @@ -154,20 +167,20 @@ class EspProv { cmdSetConfig.ssid = utf8.encode(ssid ?? ''); cmdSetConfig.passphrase = utf8.encode(password ?? ''); payload.cmdSetConfig = cmdSetConfig; - var reqData = await security.encrypt(payload.writeToBuffer()); - var respData = await transport.sendReceive('prov-config', reqData); - var respRaw = await security.decrypt(respData); - var respPayload = WiFiConfigPayload.fromBuffer(respRaw); + var reqData = await security?.encrypt(payload.writeToBuffer()); + var respData = await transport?.sendReceive('prov-config', reqData); + var respRaw = await security?.decrypt(respData); + var respPayload = WiFiConfigPayload.fromBuffer(respRaw?.toList() ?? []); return (respPayload.respSetConfig.status == Status.Success); } Future applyWifiConfig() async { var payload = WiFiConfigPayload(); payload.msg = WiFiConfigMsgType.TypeCmdApplyConfig; - var reqData = await security.encrypt(payload.writeToBuffer()); - var respData = await transport.sendReceive('prov-config', reqData); - var respRaw = await security.decrypt(respData); - var respPayload = WiFiConfigPayload.fromBuffer(respRaw); + var reqData = await security?.encrypt(payload.writeToBuffer()); + var respData = await transport?.sendReceive('prov-config', reqData); + var respRaw = await security?.decrypt(respData); + var respPayload = WiFiConfigPayload.fromBuffer(respRaw?.toList() ?? []); return (respPayload.respApplyConfig.status == Status.Success); } @@ -178,10 +191,10 @@ class EspProv { var cmdGetStatus = CmdGetStatus(); payload.cmdGetStatus = cmdGetStatus; - var reqData = await security.encrypt(payload.writeToBuffer()); - var respData = await transport.sendReceive('prov-config', reqData); - var respRaw = await security.decrypt(respData); - var respPayload = WiFiConfigPayload.fromBuffer(respRaw); + var reqData = await security?.encrypt(payload.writeToBuffer()); + var respData = await transport?.sendReceive('prov-config', reqData); + var respRaw = await security?.decrypt(respData); + var respPayload = WiFiConfigPayload.fromBuffer(respRaw?.toList() ?? []); if (respPayload.respGetStatus.staState.value == 0) { return ConnectionStatus( @@ -213,15 +226,15 @@ class EspProv { {int packageSize = 256}) async { var i = data.length; var offset = 0; - List ret = new List(0); + List ret = []; while (i > 0) { var needToSend = data.sublist(offset, i < packageSize ? i : packageSize); - var encrypted = await security.encrypt(needToSend); - var newData = await transport.sendReceive('custom-data', encrypted); + var encrypted = await security?.encrypt(needToSend); + var newData = await transport?.sendReceive('custom-data', encrypted); - if (newData.length > 0) { - var decrypted = await security.decrypt(newData); - ret += List.from(decrypted); + if (newData != null && newData.length > 0) { + var decrypted = await security?.decrypt(newData); + ret += decrypted?.toList() ?? []; } i -= packageSize; } diff --git a/lib/src/proto/dart/constants.pb.dart b/lib/src/proto/dart/constants.pb.dart index 2f36736..cf7272d 100644 --- a/lib/src/proto/dart/constants.pb.dart +++ b/lib/src/proto/dart/constants.pb.dart @@ -2,10 +2,9 @@ // Generated code. Do not modify. // source: constants.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type import 'dart:core' as $core; export 'constants.pbenum.dart'; - diff --git a/lib/src/proto/dart/constants.pbenum.dart b/lib/src/proto/dart/constants.pbenum.dart index ddeeff7..04ef584 100644 --- a/lib/src/proto/dart/constants.pbenum.dart +++ b/lib/src/proto/dart/constants.pbenum.dart @@ -19,7 +19,7 @@ class Status extends $pb.ProtobufEnum { static const Status CryptoError = Status._(6, 'CryptoError'); static const Status InvalidSession = Status._(7, 'InvalidSession'); - static const $core.List values = [ + static const $core.List values = [ Success, InvalidSecScheme, InvalidProto, @@ -30,9 +30,9 @@ class Status extends $pb.ProtobufEnum { InvalidSession, ]; - static final $core.Map<$core.int, Status> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, Status> _byValue = + $pb.ProtobufEnum.initByValue(values); static Status valueOf($core.int value) => _byValue[value]; const Status._($core.int v, $core.String n) : super(v, n); } - diff --git a/lib/src/proto/dart/constants.pbjson.dart b/lib/src/proto/dart/constants.pbjson.dart index 6621b60..22ac40c 100644 --- a/lib/src/proto/dart/constants.pbjson.dart +++ b/lib/src/proto/dart/constants.pbjson.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: constants.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type const Status$json = const { @@ -18,4 +18,3 @@ const Status$json = const { const {'1': 'InvalidSession', '2': 7}, ], }; - diff --git a/lib/src/proto/dart/constants.pbserver.dart b/lib/src/proto/dart/constants.pbserver.dart index 6e23e20..735d823 100644 --- a/lib/src/proto/dart/constants.pbserver.dart +++ b/lib/src/proto/dart/constants.pbserver.dart @@ -2,8 +2,7 @@ // Generated code. Do not modify. // source: constants.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type export 'constants.pb.dart'; - diff --git a/lib/src/proto/dart/sec0.pb.dart b/lib/src/proto/dart/sec0.pb.dart index ae4fe04..bfa5d12 100644 --- a/lib/src/proto/dart/sec0.pb.dart +++ b/lib/src/proto/dart/sec0.pb.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: sec0.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type import 'dart:core' as $core; @@ -15,99 +15,129 @@ import 'sec0.pbenum.dart'; export 'sec0.pbenum.dart'; class S0SessionCmd extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('S0SessionCmd', createEmptyInstance: create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('S0SessionCmd', createEmptyInstance: create) + ..hasRequiredFields = false; S0SessionCmd._() : super(); factory S0SessionCmd() => create(); - factory S0SessionCmd.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory S0SessionCmd.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory S0SessionCmd.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory S0SessionCmd.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); S0SessionCmd clone() => S0SessionCmd()..mergeFromMessage(this); - S0SessionCmd copyWith(void Function(S0SessionCmd) updates) => super.copyWith((message) => updates(message as S0SessionCmd)); + S0SessionCmd copyWith(void Function(S0SessionCmd) updates) => + super.copyWith((message) => updates(message as S0SessionCmd)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static S0SessionCmd create() => S0SessionCmd._(); S0SessionCmd createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static S0SessionCmd getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static S0SessionCmd getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static S0SessionCmd _defaultInstance; } class S0SessionResp extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('S0SessionResp', createEmptyInstance: create) - ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, defaultOrMaker: $0.Status.Success, valueOf: $0.Status.valueOf, enumValues: $0.Status.values) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('S0SessionResp', createEmptyInstance: create) + ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, + defaultOrMaker: $0.Status.Success, + valueOf: $0.Status.valueOf, + enumValues: $0.Status.values) + ..hasRequiredFields = false; S0SessionResp._() : super(); factory S0SessionResp() => create(); - factory S0SessionResp.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory S0SessionResp.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory S0SessionResp.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory S0SessionResp.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); S0SessionResp clone() => S0SessionResp()..mergeFromMessage(this); - S0SessionResp copyWith(void Function(S0SessionResp) updates) => super.copyWith((message) => updates(message as S0SessionResp)); + S0SessionResp copyWith(void Function(S0SessionResp) updates) => + super.copyWith((message) => updates(message as S0SessionResp)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static S0SessionResp create() => S0SessionResp._(); S0SessionResp createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static S0SessionResp getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static S0SessionResp getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static S0SessionResp _defaultInstance; @$pb.TagNumber(1) $0.Status get status => $_getN(0); @$pb.TagNumber(1) - set status($0.Status v) { setField(1, v); } + set status($0.Status v) { + setField(1, v); + } + @$pb.TagNumber(1) $core.bool hasStatus() => $_has(0); @$pb.TagNumber(1) void clearStatus() => clearField(1); } -enum Sec0Payload_Payload { - sc, - sr, - notSet -} +enum Sec0Payload_Payload { sc, sr, notSet } class Sec0Payload extends $pb.GeneratedMessage { - static const $core.Map<$core.int, Sec0Payload_Payload> _Sec0Payload_PayloadByTag = { - 20 : Sec0Payload_Payload.sc, - 21 : Sec0Payload_Payload.sr, - 0 : Sec0Payload_Payload.notSet + static const $core.Map<$core.int, Sec0Payload_Payload> + _Sec0Payload_PayloadByTag = { + 20: Sec0Payload_Payload.sc, + 21: Sec0Payload_Payload.sr, + 0: Sec0Payload_Payload.notSet }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo('Sec0Payload', createEmptyInstance: create) - ..oo(0, [20, 21]) - ..e(1, 'msg', $pb.PbFieldType.OE, defaultOrMaker: Sec0MsgType.S0_Session_Command, valueOf: Sec0MsgType.valueOf, enumValues: Sec0MsgType.values) - ..aOM(20, 'sc', subBuilder: S0SessionCmd.create) - ..aOM(21, 'sr', subBuilder: S0SessionResp.create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('Sec0Payload', createEmptyInstance: create) + ..oo(0, [20, 21]) + ..e(1, 'msg', $pb.PbFieldType.OE, + defaultOrMaker: Sec0MsgType.S0_Session_Command, + valueOf: Sec0MsgType.valueOf, + enumValues: Sec0MsgType.values) + ..aOM(20, 'sc', subBuilder: S0SessionCmd.create) + ..aOM(21, 'sr', subBuilder: S0SessionResp.create) + ..hasRequiredFields = false; Sec0Payload._() : super(); factory Sec0Payload() => create(); - factory Sec0Payload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Sec0Payload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory Sec0Payload.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Sec0Payload.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); Sec0Payload clone() => Sec0Payload()..mergeFromMessage(this); - Sec0Payload copyWith(void Function(Sec0Payload) updates) => super.copyWith((message) => updates(message as Sec0Payload)); + Sec0Payload copyWith(void Function(Sec0Payload) updates) => + super.copyWith((message) => updates(message as Sec0Payload)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static Sec0Payload create() => Sec0Payload._(); Sec0Payload createEmptyInstance() => create(); static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') - static Sec0Payload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Sec0Payload getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static Sec0Payload _defaultInstance; - Sec0Payload_Payload whichPayload() => _Sec0Payload_PayloadByTag[$_whichOneof(0)]; + Sec0Payload_Payload whichPayload() => + _Sec0Payload_PayloadByTag[$_whichOneof(0)]; void clearPayload() => clearField($_whichOneof(0)); @$pb.TagNumber(1) Sec0MsgType get msg => $_getN(0); @$pb.TagNumber(1) - set msg(Sec0MsgType v) { setField(1, v); } + set msg(Sec0MsgType v) { + setField(1, v); + } + @$pb.TagNumber(1) $core.bool hasMsg() => $_has(0); @$pb.TagNumber(1) @@ -116,7 +146,10 @@ class Sec0Payload extends $pb.GeneratedMessage { @$pb.TagNumber(20) S0SessionCmd get sc => $_getN(1); @$pb.TagNumber(20) - set sc(S0SessionCmd v) { setField(20, v); } + set sc(S0SessionCmd v) { + setField(20, v); + } + @$pb.TagNumber(20) $core.bool hasSc() => $_has(1); @$pb.TagNumber(20) @@ -127,7 +160,10 @@ class Sec0Payload extends $pb.GeneratedMessage { @$pb.TagNumber(21) S0SessionResp get sr => $_getN(2); @$pb.TagNumber(21) - set sr(S0SessionResp v) { setField(21, v); } + set sr(S0SessionResp v) { + setField(21, v); + } + @$pb.TagNumber(21) $core.bool hasSr() => $_has(2); @$pb.TagNumber(21) @@ -135,4 +171,3 @@ class Sec0Payload extends $pb.GeneratedMessage { @$pb.TagNumber(21) S0SessionResp ensureSr() => $_ensure(2); } - diff --git a/lib/src/proto/dart/sec0.pbenum.dart b/lib/src/proto/dart/sec0.pbenum.dart index 81de307..61f6ac7 100644 --- a/lib/src/proto/dart/sec0.pbenum.dart +++ b/lib/src/proto/dart/sec0.pbenum.dart @@ -10,17 +10,19 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; class Sec0MsgType extends $pb.ProtobufEnum { - static const Sec0MsgType S0_Session_Command = Sec0MsgType._(0, 'S0_Session_Command'); - static const Sec0MsgType S0_Session_Response = Sec0MsgType._(1, 'S0_Session_Response'); + static const Sec0MsgType S0_Session_Command = + Sec0MsgType._(0, 'S0_Session_Command'); + static const Sec0MsgType S0_Session_Response = + Sec0MsgType._(1, 'S0_Session_Response'); - static const $core.List values = [ + static const $core.List values = [ S0_Session_Command, S0_Session_Response, ]; - static final $core.Map<$core.int, Sec0MsgType> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, Sec0MsgType> _byValue = + $pb.ProtobufEnum.initByValue(values); static Sec0MsgType valueOf($core.int value) => _byValue[value]; const Sec0MsgType._($core.int v, $core.String n) : super(v, n); } - diff --git a/lib/src/proto/dart/sec0.pbjson.dart b/lib/src/proto/dart/sec0.pbjson.dart index d6e99e3..c02e99d 100644 --- a/lib/src/proto/dart/sec0.pbjson.dart +++ b/lib/src/proto/dart/sec0.pbjson.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: sec0.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type const Sec0MsgType$json = const { @@ -20,19 +20,48 @@ const S0SessionCmd$json = const { const S0SessionResp$json = const { '1': 'S0SessionResp', '2': const [ - const {'1': 'status', '3': 1, '4': 1, '5': 14, '6': '.Status', '10': 'status'}, + const { + '1': 'status', + '3': 1, + '4': 1, + '5': 14, + '6': '.Status', + '10': 'status' + }, ], }; const Sec0Payload$json = const { '1': 'Sec0Payload', '2': const [ - const {'1': 'msg', '3': 1, '4': 1, '5': 14, '6': '.Sec0MsgType', '10': 'msg'}, - const {'1': 'sc', '3': 20, '4': 1, '5': 11, '6': '.S0SessionCmd', '9': 0, '10': 'sc'}, - const {'1': 'sr', '3': 21, '4': 1, '5': 11, '6': '.S0SessionResp', '9': 0, '10': 'sr'}, + const { + '1': 'msg', + '3': 1, + '4': 1, + '5': 14, + '6': '.Sec0MsgType', + '10': 'msg' + }, + const { + '1': 'sc', + '3': 20, + '4': 1, + '5': 11, + '6': '.S0SessionCmd', + '9': 0, + '10': 'sc' + }, + const { + '1': 'sr', + '3': 21, + '4': 1, + '5': 11, + '6': '.S0SessionResp', + '9': 0, + '10': 'sr' + }, ], '8': const [ const {'1': 'payload'}, ], }; - diff --git a/lib/src/proto/dart/sec0.pbserver.dart b/lib/src/proto/dart/sec0.pbserver.dart index 6dd533e..4cef208 100644 --- a/lib/src/proto/dart/sec0.pbserver.dart +++ b/lib/src/proto/dart/sec0.pbserver.dart @@ -2,8 +2,7 @@ // Generated code. Do not modify. // source: sec0.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type export 'sec0.pb.dart'; - diff --git a/lib/src/proto/dart/sec1.pb.dart b/lib/src/proto/dart/sec1.pb.dart index 111750f..8af8cc4 100644 --- a/lib/src/proto/dart/sec1.pb.dart +++ b/lib/src/proto/dart/sec1.pb.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: sec1.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type import 'dart:core' as $core; @@ -15,30 +15,39 @@ import 'sec1.pbenum.dart'; export 'sec1.pbenum.dart'; class SessionCmd1 extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('SessionCmd1', createEmptyInstance: create) - ..a<$core.List<$core.int>>(2, 'clientVerifyData', $pb.PbFieldType.OY) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('SessionCmd1', createEmptyInstance: create) + ..a<$core.List<$core.int>>(2, 'clientVerifyData', $pb.PbFieldType.OY) + ..hasRequiredFields = false; SessionCmd1._() : super(); factory SessionCmd1() => create(); - factory SessionCmd1.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SessionCmd1.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory SessionCmd1.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory SessionCmd1.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); SessionCmd1 clone() => SessionCmd1()..mergeFromMessage(this); - SessionCmd1 copyWith(void Function(SessionCmd1) updates) => super.copyWith((message) => updates(message as SessionCmd1)); + SessionCmd1 copyWith(void Function(SessionCmd1) updates) => + super.copyWith((message) => updates(message as SessionCmd1)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static SessionCmd1 create() => SessionCmd1._(); SessionCmd1 createEmptyInstance() => create(); static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') - static SessionCmd1 getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static SessionCmd1 getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static SessionCmd1 _defaultInstance; @$pb.TagNumber(2) $core.List<$core.int> get clientVerifyData => $_getN(0); @$pb.TagNumber(2) - set clientVerifyData($core.List<$core.int> v) { $_setBytes(0, v); } + set clientVerifyData($core.List<$core.int> v) { + $_setBytes(0, v); + } + @$pb.TagNumber(2) $core.bool hasClientVerifyData() => $_has(0); @$pb.TagNumber(2) @@ -46,31 +55,44 @@ class SessionCmd1 extends $pb.GeneratedMessage { } class SessionResp1 extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('SessionResp1', createEmptyInstance: create) - ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, defaultOrMaker: $0.Status.Success, valueOf: $0.Status.valueOf, enumValues: $0.Status.values) - ..a<$core.List<$core.int>>(3, 'deviceVerifyData', $pb.PbFieldType.OY) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('SessionResp1', createEmptyInstance: create) + ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, + defaultOrMaker: $0.Status.Success, + valueOf: $0.Status.valueOf, + enumValues: $0.Status.values) + ..a<$core.List<$core.int>>(3, 'deviceVerifyData', $pb.PbFieldType.OY) + ..hasRequiredFields = false; SessionResp1._() : super(); factory SessionResp1() => create(); - factory SessionResp1.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SessionResp1.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory SessionResp1.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory SessionResp1.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); SessionResp1 clone() => SessionResp1()..mergeFromMessage(this); - SessionResp1 copyWith(void Function(SessionResp1) updates) => super.copyWith((message) => updates(message as SessionResp1)); + SessionResp1 copyWith(void Function(SessionResp1) updates) => + super.copyWith((message) => updates(message as SessionResp1)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static SessionResp1 create() => SessionResp1._(); SessionResp1 createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static SessionResp1 getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static SessionResp1 getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static SessionResp1 _defaultInstance; @$pb.TagNumber(1) $0.Status get status => $_getN(0); @$pb.TagNumber(1) - set status($0.Status v) { setField(1, v); } + set status($0.Status v) { + setField(1, v); + } + @$pb.TagNumber(1) $core.bool hasStatus() => $_has(0); @$pb.TagNumber(1) @@ -79,7 +101,10 @@ class SessionResp1 extends $pb.GeneratedMessage { @$pb.TagNumber(3) $core.List<$core.int> get deviceVerifyData => $_getN(1); @$pb.TagNumber(3) - set deviceVerifyData($core.List<$core.int> v) { $_setBytes(1, v); } + set deviceVerifyData($core.List<$core.int> v) { + $_setBytes(1, v); + } + @$pb.TagNumber(3) $core.bool hasDeviceVerifyData() => $_has(1); @$pb.TagNumber(3) @@ -87,30 +112,39 @@ class SessionResp1 extends $pb.GeneratedMessage { } class SessionCmd0 extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('SessionCmd0', createEmptyInstance: create) - ..a<$core.List<$core.int>>(1, 'clientPubkey', $pb.PbFieldType.OY) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('SessionCmd0', createEmptyInstance: create) + ..a<$core.List<$core.int>>(1, 'clientPubkey', $pb.PbFieldType.OY) + ..hasRequiredFields = false; SessionCmd0._() : super(); factory SessionCmd0() => create(); - factory SessionCmd0.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SessionCmd0.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory SessionCmd0.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory SessionCmd0.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); SessionCmd0 clone() => SessionCmd0()..mergeFromMessage(this); - SessionCmd0 copyWith(void Function(SessionCmd0) updates) => super.copyWith((message) => updates(message as SessionCmd0)); + SessionCmd0 copyWith(void Function(SessionCmd0) updates) => + super.copyWith((message) => updates(message as SessionCmd0)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static SessionCmd0 create() => SessionCmd0._(); SessionCmd0 createEmptyInstance() => create(); static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') - static SessionCmd0 getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static SessionCmd0 getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static SessionCmd0 _defaultInstance; @$pb.TagNumber(1) $core.List<$core.int> get clientPubkey => $_getN(0); @$pb.TagNumber(1) - set clientPubkey($core.List<$core.int> v) { $_setBytes(0, v); } + set clientPubkey($core.List<$core.int> v) { + $_setBytes(0, v); + } + @$pb.TagNumber(1) $core.bool hasClientPubkey() => $_has(0); @$pb.TagNumber(1) @@ -118,32 +152,45 @@ class SessionCmd0 extends $pb.GeneratedMessage { } class SessionResp0 extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('SessionResp0', createEmptyInstance: create) - ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, defaultOrMaker: $0.Status.Success, valueOf: $0.Status.valueOf, enumValues: $0.Status.values) - ..a<$core.List<$core.int>>(2, 'devicePubkey', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>(3, 'deviceRandom', $pb.PbFieldType.OY) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('SessionResp0', createEmptyInstance: create) + ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, + defaultOrMaker: $0.Status.Success, + valueOf: $0.Status.valueOf, + enumValues: $0.Status.values) + ..a<$core.List<$core.int>>(2, 'devicePubkey', $pb.PbFieldType.OY) + ..a<$core.List<$core.int>>(3, 'deviceRandom', $pb.PbFieldType.OY) + ..hasRequiredFields = false; SessionResp0._() : super(); factory SessionResp0() => create(); - factory SessionResp0.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SessionResp0.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory SessionResp0.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory SessionResp0.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); SessionResp0 clone() => SessionResp0()..mergeFromMessage(this); - SessionResp0 copyWith(void Function(SessionResp0) updates) => super.copyWith((message) => updates(message as SessionResp0)); + SessionResp0 copyWith(void Function(SessionResp0) updates) => + super.copyWith((message) => updates(message as SessionResp0)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static SessionResp0 create() => SessionResp0._(); SessionResp0 createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static SessionResp0 getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static SessionResp0 getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static SessionResp0 _defaultInstance; @$pb.TagNumber(1) $0.Status get status => $_getN(0); @$pb.TagNumber(1) - set status($0.Status v) { setField(1, v); } + set status($0.Status v) { + setField(1, v); + } + @$pb.TagNumber(1) $core.bool hasStatus() => $_has(0); @$pb.TagNumber(1) @@ -152,7 +199,10 @@ class SessionResp0 extends $pb.GeneratedMessage { @$pb.TagNumber(2) $core.List<$core.int> get devicePubkey => $_getN(1); @$pb.TagNumber(2) - set devicePubkey($core.List<$core.int> v) { $_setBytes(1, v); } + set devicePubkey($core.List<$core.int> v) { + $_setBytes(1, v); + } + @$pb.TagNumber(2) $core.bool hasDevicePubkey() => $_has(1); @$pb.TagNumber(2) @@ -161,61 +211,72 @@ class SessionResp0 extends $pb.GeneratedMessage { @$pb.TagNumber(3) $core.List<$core.int> get deviceRandom => $_getN(2); @$pb.TagNumber(3) - set deviceRandom($core.List<$core.int> v) { $_setBytes(2, v); } + set deviceRandom($core.List<$core.int> v) { + $_setBytes(2, v); + } + @$pb.TagNumber(3) $core.bool hasDeviceRandom() => $_has(2); @$pb.TagNumber(3) void clearDeviceRandom() => clearField(3); } -enum Sec1Payload_Payload { - sc0, - sr0, - sc1, - sr1, - notSet -} +enum Sec1Payload_Payload { sc0, sr0, sc1, sr1, notSet } class Sec1Payload extends $pb.GeneratedMessage { - static const $core.Map<$core.int, Sec1Payload_Payload> _Sec1Payload_PayloadByTag = { - 20 : Sec1Payload_Payload.sc0, - 21 : Sec1Payload_Payload.sr0, - 22 : Sec1Payload_Payload.sc1, - 23 : Sec1Payload_Payload.sr1, - 0 : Sec1Payload_Payload.notSet + static const $core.Map<$core.int, Sec1Payload_Payload> + _Sec1Payload_PayloadByTag = { + 20: Sec1Payload_Payload.sc0, + 21: Sec1Payload_Payload.sr0, + 22: Sec1Payload_Payload.sc1, + 23: Sec1Payload_Payload.sr1, + 0: Sec1Payload_Payload.notSet }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo('Sec1Payload', createEmptyInstance: create) - ..oo(0, [20, 21, 22, 23]) - ..e(1, 'msg', $pb.PbFieldType.OE, defaultOrMaker: Sec1MsgType.Session_Command0, valueOf: Sec1MsgType.valueOf, enumValues: Sec1MsgType.values) - ..aOM(20, 'sc0', subBuilder: SessionCmd0.create) - ..aOM(21, 'sr0', subBuilder: SessionResp0.create) - ..aOM(22, 'sc1', subBuilder: SessionCmd1.create) - ..aOM(23, 'sr1', subBuilder: SessionResp1.create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('Sec1Payload', createEmptyInstance: create) + ..oo(0, [20, 21, 22, 23]) + ..e(1, 'msg', $pb.PbFieldType.OE, + defaultOrMaker: Sec1MsgType.Session_Command0, + valueOf: Sec1MsgType.valueOf, + enumValues: Sec1MsgType.values) + ..aOM(20, 'sc0', subBuilder: SessionCmd0.create) + ..aOM(21, 'sr0', subBuilder: SessionResp0.create) + ..aOM(22, 'sc1', subBuilder: SessionCmd1.create) + ..aOM(23, 'sr1', subBuilder: SessionResp1.create) + ..hasRequiredFields = false; Sec1Payload._() : super(); factory Sec1Payload() => create(); - factory Sec1Payload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Sec1Payload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory Sec1Payload.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory Sec1Payload.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); Sec1Payload clone() => Sec1Payload()..mergeFromMessage(this); - Sec1Payload copyWith(void Function(Sec1Payload) updates) => super.copyWith((message) => updates(message as Sec1Payload)); + Sec1Payload copyWith(void Function(Sec1Payload) updates) => + super.copyWith((message) => updates(message as Sec1Payload)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static Sec1Payload create() => Sec1Payload._(); Sec1Payload createEmptyInstance() => create(); static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') - static Sec1Payload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Sec1Payload getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static Sec1Payload _defaultInstance; - Sec1Payload_Payload whichPayload() => _Sec1Payload_PayloadByTag[$_whichOneof(0)]; + Sec1Payload_Payload whichPayload() => + _Sec1Payload_PayloadByTag[$_whichOneof(0)]; void clearPayload() => clearField($_whichOneof(0)); @$pb.TagNumber(1) Sec1MsgType get msg => $_getN(0); @$pb.TagNumber(1) - set msg(Sec1MsgType v) { setField(1, v); } + set msg(Sec1MsgType v) { + setField(1, v); + } + @$pb.TagNumber(1) $core.bool hasMsg() => $_has(0); @$pb.TagNumber(1) @@ -224,7 +285,10 @@ class Sec1Payload extends $pb.GeneratedMessage { @$pb.TagNumber(20) SessionCmd0 get sc0 => $_getN(1); @$pb.TagNumber(20) - set sc0(SessionCmd0 v) { setField(20, v); } + set sc0(SessionCmd0 v) { + setField(20, v); + } + @$pb.TagNumber(20) $core.bool hasSc0() => $_has(1); @$pb.TagNumber(20) @@ -235,7 +299,10 @@ class Sec1Payload extends $pb.GeneratedMessage { @$pb.TagNumber(21) SessionResp0 get sr0 => $_getN(2); @$pb.TagNumber(21) - set sr0(SessionResp0 v) { setField(21, v); } + set sr0(SessionResp0 v) { + setField(21, v); + } + @$pb.TagNumber(21) $core.bool hasSr0() => $_has(2); @$pb.TagNumber(21) @@ -246,7 +313,10 @@ class Sec1Payload extends $pb.GeneratedMessage { @$pb.TagNumber(22) SessionCmd1 get sc1 => $_getN(3); @$pb.TagNumber(22) - set sc1(SessionCmd1 v) { setField(22, v); } + set sc1(SessionCmd1 v) { + setField(22, v); + } + @$pb.TagNumber(22) $core.bool hasSc1() => $_has(3); @$pb.TagNumber(22) @@ -257,7 +327,10 @@ class Sec1Payload extends $pb.GeneratedMessage { @$pb.TagNumber(23) SessionResp1 get sr1 => $_getN(4); @$pb.TagNumber(23) - set sr1(SessionResp1 v) { setField(23, v); } + set sr1(SessionResp1 v) { + setField(23, v); + } + @$pb.TagNumber(23) $core.bool hasSr1() => $_has(4); @$pb.TagNumber(23) @@ -265,4 +338,3 @@ class Sec1Payload extends $pb.GeneratedMessage { @$pb.TagNumber(23) SessionResp1 ensureSr1() => $_ensure(4); } - diff --git a/lib/src/proto/dart/sec1.pbenum.dart b/lib/src/proto/dart/sec1.pbenum.dart index 74e5f66..1a045aa 100644 --- a/lib/src/proto/dart/sec1.pbenum.dart +++ b/lib/src/proto/dart/sec1.pbenum.dart @@ -10,21 +10,25 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; class Sec1MsgType extends $pb.ProtobufEnum { - static const Sec1MsgType Session_Command0 = Sec1MsgType._(0, 'Session_Command0'); - static const Sec1MsgType Session_Response0 = Sec1MsgType._(1, 'Session_Response0'); - static const Sec1MsgType Session_Command1 = Sec1MsgType._(2, 'Session_Command1'); - static const Sec1MsgType Session_Response1 = Sec1MsgType._(3, 'Session_Response1'); + static const Sec1MsgType Session_Command0 = + Sec1MsgType._(0, 'Session_Command0'); + static const Sec1MsgType Session_Response0 = + Sec1MsgType._(1, 'Session_Response0'); + static const Sec1MsgType Session_Command1 = + Sec1MsgType._(2, 'Session_Command1'); + static const Sec1MsgType Session_Response1 = + Sec1MsgType._(3, 'Session_Response1'); - static const $core.List values = [ + static const $core.List values = [ Session_Command0, Session_Response0, Session_Command1, Session_Response1, ]; - static final $core.Map<$core.int, Sec1MsgType> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, Sec1MsgType> _byValue = + $pb.ProtobufEnum.initByValue(values); static Sec1MsgType valueOf($core.int value) => _byValue[value]; const Sec1MsgType._($core.int v, $core.String n) : super(v, n); } - diff --git a/lib/src/proto/dart/sec1.pbjson.dart b/lib/src/proto/dart/sec1.pbjson.dart index 0313061..8c1feac 100644 --- a/lib/src/proto/dart/sec1.pbjson.dart +++ b/lib/src/proto/dart/sec1.pbjson.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: sec1.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type const Sec1MsgType$json = const { @@ -18,15 +18,34 @@ const Sec1MsgType$json = const { const SessionCmd1$json = const { '1': 'SessionCmd1', '2': const [ - const {'1': 'client_verify_data', '3': 2, '4': 1, '5': 12, '10': 'clientVerifyData'}, + const { + '1': 'client_verify_data', + '3': 2, + '4': 1, + '5': 12, + '10': 'clientVerifyData' + }, ], }; const SessionResp1$json = const { '1': 'SessionResp1', '2': const [ - const {'1': 'status', '3': 1, '4': 1, '5': 14, '6': '.Status', '10': 'status'}, - const {'1': 'device_verify_data', '3': 3, '4': 1, '5': 12, '10': 'deviceVerifyData'}, + const { + '1': 'status', + '3': 1, + '4': 1, + '5': 14, + '6': '.Status', + '10': 'status' + }, + const { + '1': 'device_verify_data', + '3': 3, + '4': 1, + '5': 12, + '10': 'deviceVerifyData' + }, ], }; @@ -40,7 +59,14 @@ const SessionCmd0$json = const { const SessionResp0$json = const { '1': 'SessionResp0', '2': const [ - const {'1': 'status', '3': 1, '4': 1, '5': 14, '6': '.Status', '10': 'status'}, + const { + '1': 'status', + '3': 1, + '4': 1, + '5': 14, + '6': '.Status', + '10': 'status' + }, const {'1': 'device_pubkey', '3': 2, '4': 1, '5': 12, '10': 'devicePubkey'}, const {'1': 'device_random', '3': 3, '4': 1, '5': 12, '10': 'deviceRandom'}, ], @@ -49,14 +75,52 @@ const SessionResp0$json = const { const Sec1Payload$json = const { '1': 'Sec1Payload', '2': const [ - const {'1': 'msg', '3': 1, '4': 1, '5': 14, '6': '.Sec1MsgType', '10': 'msg'}, - const {'1': 'sc0', '3': 20, '4': 1, '5': 11, '6': '.SessionCmd0', '9': 0, '10': 'sc0'}, - const {'1': 'sr0', '3': 21, '4': 1, '5': 11, '6': '.SessionResp0', '9': 0, '10': 'sr0'}, - const {'1': 'sc1', '3': 22, '4': 1, '5': 11, '6': '.SessionCmd1', '9': 0, '10': 'sc1'}, - const {'1': 'sr1', '3': 23, '4': 1, '5': 11, '6': '.SessionResp1', '9': 0, '10': 'sr1'}, + const { + '1': 'msg', + '3': 1, + '4': 1, + '5': 14, + '6': '.Sec1MsgType', + '10': 'msg' + }, + const { + '1': 'sc0', + '3': 20, + '4': 1, + '5': 11, + '6': '.SessionCmd0', + '9': 0, + '10': 'sc0' + }, + const { + '1': 'sr0', + '3': 21, + '4': 1, + '5': 11, + '6': '.SessionResp0', + '9': 0, + '10': 'sr0' + }, + const { + '1': 'sc1', + '3': 22, + '4': 1, + '5': 11, + '6': '.SessionCmd1', + '9': 0, + '10': 'sc1' + }, + const { + '1': 'sr1', + '3': 23, + '4': 1, + '5': 11, + '6': '.SessionResp1', + '9': 0, + '10': 'sr1' + }, ], '8': const [ const {'1': 'payload'}, ], }; - diff --git a/lib/src/proto/dart/sec1.pbserver.dart b/lib/src/proto/dart/sec1.pbserver.dart index 7407c1f..a92f8b8 100644 --- a/lib/src/proto/dart/sec1.pbserver.dart +++ b/lib/src/proto/dart/sec1.pbserver.dart @@ -2,8 +2,7 @@ // Generated code. Do not modify. // source: sec1.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type export 'sec1.pb.dart'; - diff --git a/lib/src/proto/dart/session.pb.dart b/lib/src/proto/dart/session.pb.dart index 55d49b4..2220769 100644 --- a/lib/src/proto/dart/session.pb.dart +++ b/lib/src/proto/dart/session.pb.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: session.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type import 'dart:core' as $core; @@ -16,39 +16,45 @@ import 'session.pbenum.dart'; export 'session.pbenum.dart'; -enum SessionData_Proto { - sec0, - sec1, - notSet -} +enum SessionData_Proto { sec0, sec1, notSet } class SessionData extends $pb.GeneratedMessage { - static const $core.Map<$core.int, SessionData_Proto> _SessionData_ProtoByTag = { - 10 : SessionData_Proto.sec0, - 11 : SessionData_Proto.sec1, - 0 : SessionData_Proto.notSet + static const $core.Map<$core.int, SessionData_Proto> _SessionData_ProtoByTag = + { + 10: SessionData_Proto.sec0, + 11: SessionData_Proto.sec1, + 0: SessionData_Proto.notSet }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo('SessionData', createEmptyInstance: create) - ..oo(0, [10, 11]) - ..e(2, 'secVer', $pb.PbFieldType.OE, defaultOrMaker: SecSchemeVersion.SecScheme0, valueOf: SecSchemeVersion.valueOf, enumValues: SecSchemeVersion.values) - ..aOM<$1.Sec0Payload>(10, 'sec0', subBuilder: $1.Sec0Payload.create) - ..aOM<$2.Sec1Payload>(11, 'sec1', subBuilder: $2.Sec1Payload.create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('SessionData', createEmptyInstance: create) + ..oo(0, [10, 11]) + ..e(2, 'secVer', $pb.PbFieldType.OE, + defaultOrMaker: SecSchemeVersion.SecScheme0, + valueOf: SecSchemeVersion.valueOf, + enumValues: SecSchemeVersion.values) + ..aOM<$1.Sec0Payload>(10, 'sec0', subBuilder: $1.Sec0Payload.create) + ..aOM<$2.Sec1Payload>(11, 'sec1', subBuilder: $2.Sec1Payload.create) + ..hasRequiredFields = false; SessionData._() : super(); factory SessionData() => create(); - factory SessionData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SessionData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory SessionData.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory SessionData.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); SessionData clone() => SessionData()..mergeFromMessage(this); - SessionData copyWith(void Function(SessionData) updates) => super.copyWith((message) => updates(message as SessionData)); + SessionData copyWith(void Function(SessionData) updates) => + super.copyWith((message) => updates(message as SessionData)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static SessionData create() => SessionData._(); SessionData createEmptyInstance() => create(); static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') - static SessionData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static SessionData getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static SessionData _defaultInstance; SessionData_Proto whichProto() => _SessionData_ProtoByTag[$_whichOneof(0)]; @@ -57,7 +63,10 @@ class SessionData extends $pb.GeneratedMessage { @$pb.TagNumber(2) SecSchemeVersion get secVer => $_getN(0); @$pb.TagNumber(2) - set secVer(SecSchemeVersion v) { setField(2, v); } + set secVer(SecSchemeVersion v) { + setField(2, v); + } + @$pb.TagNumber(2) $core.bool hasSecVer() => $_has(0); @$pb.TagNumber(2) @@ -66,7 +75,10 @@ class SessionData extends $pb.GeneratedMessage { @$pb.TagNumber(10) $1.Sec0Payload get sec0 => $_getN(1); @$pb.TagNumber(10) - set sec0($1.Sec0Payload v) { setField(10, v); } + set sec0($1.Sec0Payload v) { + setField(10, v); + } + @$pb.TagNumber(10) $core.bool hasSec0() => $_has(1); @$pb.TagNumber(10) @@ -77,7 +89,10 @@ class SessionData extends $pb.GeneratedMessage { @$pb.TagNumber(11) $2.Sec1Payload get sec1 => $_getN(2); @$pb.TagNumber(11) - set sec1($2.Sec1Payload v) { setField(11, v); } + set sec1($2.Sec1Payload v) { + setField(11, v); + } + @$pb.TagNumber(11) $core.bool hasSec1() => $_has(2); @$pb.TagNumber(11) @@ -85,4 +100,3 @@ class SessionData extends $pb.GeneratedMessage { @$pb.TagNumber(11) $2.Sec1Payload ensureSec1() => $_ensure(2); } - diff --git a/lib/src/proto/dart/session.pbenum.dart b/lib/src/proto/dart/session.pbenum.dart index 5e28d22..6cae1d7 100644 --- a/lib/src/proto/dart/session.pbenum.dart +++ b/lib/src/proto/dart/session.pbenum.dart @@ -10,17 +10,19 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; class SecSchemeVersion extends $pb.ProtobufEnum { - static const SecSchemeVersion SecScheme0 = SecSchemeVersion._(0, 'SecScheme0'); - static const SecSchemeVersion SecScheme1 = SecSchemeVersion._(1, 'SecScheme1'); + static const SecSchemeVersion SecScheme0 = + SecSchemeVersion._(0, 'SecScheme0'); + static const SecSchemeVersion SecScheme1 = + SecSchemeVersion._(1, 'SecScheme1'); - static const $core.List values = [ + static const $core.List values = [ SecScheme0, SecScheme1, ]; - static final $core.Map<$core.int, SecSchemeVersion> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, SecSchemeVersion> _byValue = + $pb.ProtobufEnum.initByValue(values); static SecSchemeVersion valueOf($core.int value) => _byValue[value]; const SecSchemeVersion._($core.int v, $core.String n) : super(v, n); } - diff --git a/lib/src/proto/dart/session.pbjson.dart b/lib/src/proto/dart/session.pbjson.dart index b1edf0d..ea78a0b 100644 --- a/lib/src/proto/dart/session.pbjson.dart +++ b/lib/src/proto/dart/session.pbjson.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: session.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type const SecSchemeVersion$json = const { @@ -16,12 +16,34 @@ const SecSchemeVersion$json = const { const SessionData$json = const { '1': 'SessionData', '2': const [ - const {'1': 'sec_ver', '3': 2, '4': 1, '5': 14, '6': '.SecSchemeVersion', '10': 'secVer'}, - const {'1': 'sec0', '3': 10, '4': 1, '5': 11, '6': '.Sec0Payload', '9': 0, '10': 'sec0'}, - const {'1': 'sec1', '3': 11, '4': 1, '5': 11, '6': '.Sec1Payload', '9': 0, '10': 'sec1'}, + const { + '1': 'sec_ver', + '3': 2, + '4': 1, + '5': 14, + '6': '.SecSchemeVersion', + '10': 'secVer' + }, + const { + '1': 'sec0', + '3': 10, + '4': 1, + '5': 11, + '6': '.Sec0Payload', + '9': 0, + '10': 'sec0' + }, + const { + '1': 'sec1', + '3': 11, + '4': 1, + '5': 11, + '6': '.Sec1Payload', + '9': 0, + '10': 'sec1' + }, ], '8': const [ const {'1': 'proto'}, ], }; - diff --git a/lib/src/proto/dart/session.pbserver.dart b/lib/src/proto/dart/session.pbserver.dart index e36b0d2..22669e6 100644 --- a/lib/src/proto/dart/session.pbserver.dart +++ b/lib/src/proto/dart/session.pbserver.dart @@ -2,8 +2,7 @@ // Generated code. Do not modify. // source: session.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type export 'session.pb.dart'; - diff --git a/lib/src/proto/dart/wifi_config.pb.dart b/lib/src/proto/dart/wifi_config.pb.dart index a805206..b390018 100644 --- a/lib/src/proto/dart/wifi_config.pb.dart +++ b/lib/src/proto/dart/wifi_config.pb.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: wifi_config.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type import 'dart:core' as $core; @@ -18,69 +18,94 @@ import 'wifi_config.pbenum.dart'; export 'wifi_config.pbenum.dart'; class CmdGetStatus extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('CmdGetStatus', createEmptyInstance: create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('CmdGetStatus', createEmptyInstance: create) + ..hasRequiredFields = false; CmdGetStatus._() : super(); factory CmdGetStatus() => create(); - factory CmdGetStatus.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory CmdGetStatus.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory CmdGetStatus.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory CmdGetStatus.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); CmdGetStatus clone() => CmdGetStatus()..mergeFromMessage(this); - CmdGetStatus copyWith(void Function(CmdGetStatus) updates) => super.copyWith((message) => updates(message as CmdGetStatus)); + CmdGetStatus copyWith(void Function(CmdGetStatus) updates) => + super.copyWith((message) => updates(message as CmdGetStatus)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static CmdGetStatus create() => CmdGetStatus._(); CmdGetStatus createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static CmdGetStatus getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CmdGetStatus getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static CmdGetStatus _defaultInstance; } -enum RespGetStatus_State { - failReason, - connected, - notSet -} +enum RespGetStatus_State { failReason, connected, notSet } class RespGetStatus extends $pb.GeneratedMessage { - static const $core.Map<$core.int, RespGetStatus_State> _RespGetStatus_StateByTag = { - 10 : RespGetStatus_State.failReason, - 11 : RespGetStatus_State.connected, - 0 : RespGetStatus_State.notSet + static const $core.Map<$core.int, RespGetStatus_State> + _RespGetStatus_StateByTag = { + 10: RespGetStatus_State.failReason, + 11: RespGetStatus_State.connected, + 0: RespGetStatus_State.notSet }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo('RespGetStatus', createEmptyInstance: create) - ..oo(0, [10, 11]) - ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, defaultOrMaker: $0.Status.Success, valueOf: $0.Status.valueOf, enumValues: $0.Status.values) - ..e<$3.WifiStationState>(2, 'staState', $pb.PbFieldType.OE, defaultOrMaker: $3.WifiStationState.Connected, valueOf: $3.WifiStationState.valueOf, enumValues: $3.WifiStationState.values) - ..e<$3.WifiConnectFailedReason>(10, 'failReason', $pb.PbFieldType.OE, defaultOrMaker: $3.WifiConnectFailedReason.AuthError, valueOf: $3.WifiConnectFailedReason.valueOf, enumValues: $3.WifiConnectFailedReason.values) - ..aOM<$3.WifiConnectedState>(11, 'connected', subBuilder: $3.WifiConnectedState.create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('RespGetStatus', createEmptyInstance: create) + ..oo(0, [10, 11]) + ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, + defaultOrMaker: $0.Status.Success, + valueOf: $0.Status.valueOf, + enumValues: $0.Status.values) + ..e<$3.WifiStationState>(2, 'staState', $pb.PbFieldType.OE, + defaultOrMaker: $3.WifiStationState.Connected, + valueOf: $3.WifiStationState.valueOf, + enumValues: $3.WifiStationState.values) + ..e<$3.WifiConnectFailedReason>(10, 'failReason', $pb.PbFieldType.OE, + defaultOrMaker: $3.WifiConnectFailedReason.AuthError, + valueOf: $3.WifiConnectFailedReason.valueOf, + enumValues: $3.WifiConnectFailedReason.values) + ..aOM<$3.WifiConnectedState>(11, 'connected', + subBuilder: $3.WifiConnectedState.create) + ..hasRequiredFields = false; RespGetStatus._() : super(); factory RespGetStatus() => create(); - factory RespGetStatus.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RespGetStatus.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory RespGetStatus.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory RespGetStatus.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); RespGetStatus clone() => RespGetStatus()..mergeFromMessage(this); - RespGetStatus copyWith(void Function(RespGetStatus) updates) => super.copyWith((message) => updates(message as RespGetStatus)); + RespGetStatus copyWith(void Function(RespGetStatus) updates) => + super.copyWith((message) => updates(message as RespGetStatus)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static RespGetStatus create() => RespGetStatus._(); RespGetStatus createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static RespGetStatus getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RespGetStatus getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static RespGetStatus _defaultInstance; - RespGetStatus_State whichState() => _RespGetStatus_StateByTag[$_whichOneof(0)]; + RespGetStatus_State whichState() => + _RespGetStatus_StateByTag[$_whichOneof(0)]; void clearState() => clearField($_whichOneof(0)); @$pb.TagNumber(1) $0.Status get status => $_getN(0); @$pb.TagNumber(1) - set status($0.Status v) { setField(1, v); } + set status($0.Status v) { + setField(1, v); + } + @$pb.TagNumber(1) $core.bool hasStatus() => $_has(0); @$pb.TagNumber(1) @@ -89,7 +114,10 @@ class RespGetStatus extends $pb.GeneratedMessage { @$pb.TagNumber(2) $3.WifiStationState get staState => $_getN(1); @$pb.TagNumber(2) - set staState($3.WifiStationState v) { setField(2, v); } + set staState($3.WifiStationState v) { + setField(2, v); + } + @$pb.TagNumber(2) $core.bool hasStaState() => $_has(1); @$pb.TagNumber(2) @@ -98,7 +126,10 @@ class RespGetStatus extends $pb.GeneratedMessage { @$pb.TagNumber(10) $3.WifiConnectFailedReason get failReason => $_getN(2); @$pb.TagNumber(10) - set failReason($3.WifiConnectFailedReason v) { setField(10, v); } + set failReason($3.WifiConnectFailedReason v) { + setField(10, v); + } + @$pb.TagNumber(10) $core.bool hasFailReason() => $_has(2); @$pb.TagNumber(10) @@ -107,7 +138,10 @@ class RespGetStatus extends $pb.GeneratedMessage { @$pb.TagNumber(11) $3.WifiConnectedState get connected => $_getN(3); @$pb.TagNumber(11) - set connected($3.WifiConnectedState v) { setField(11, v); } + set connected($3.WifiConnectedState v) { + setField(11, v); + } + @$pb.TagNumber(11) $core.bool hasConnected() => $_has(3); @$pb.TagNumber(11) @@ -117,33 +151,43 @@ class RespGetStatus extends $pb.GeneratedMessage { } class CmdSetConfig extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('CmdSetConfig', createEmptyInstance: create) - ..a<$core.List<$core.int>>(1, 'ssid', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>(2, 'passphrase', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>(3, 'bssid', $pb.PbFieldType.OY) - ..a<$core.int>(4, 'channel', $pb.PbFieldType.O3) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('CmdSetConfig', createEmptyInstance: create) + ..a<$core.List<$core.int>>(1, 'ssid', $pb.PbFieldType.OY) + ..a<$core.List<$core.int>>(2, 'passphrase', $pb.PbFieldType.OY) + ..a<$core.List<$core.int>>(3, 'bssid', $pb.PbFieldType.OY) + ..a<$core.int>(4, 'channel', $pb.PbFieldType.O3) + ..hasRequiredFields = false; CmdSetConfig._() : super(); factory CmdSetConfig() => create(); - factory CmdSetConfig.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory CmdSetConfig.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory CmdSetConfig.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory CmdSetConfig.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); CmdSetConfig clone() => CmdSetConfig()..mergeFromMessage(this); - CmdSetConfig copyWith(void Function(CmdSetConfig) updates) => super.copyWith((message) => updates(message as CmdSetConfig)); + CmdSetConfig copyWith(void Function(CmdSetConfig) updates) => + super.copyWith((message) => updates(message as CmdSetConfig)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static CmdSetConfig create() => CmdSetConfig._(); CmdSetConfig createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static CmdSetConfig getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CmdSetConfig getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static CmdSetConfig _defaultInstance; @$pb.TagNumber(1) $core.List<$core.int> get ssid => $_getN(0); @$pb.TagNumber(1) - set ssid($core.List<$core.int> v) { $_setBytes(0, v); } + set ssid($core.List<$core.int> v) { + $_setBytes(0, v); + } + @$pb.TagNumber(1) $core.bool hasSsid() => $_has(0); @$pb.TagNumber(1) @@ -152,7 +196,10 @@ class CmdSetConfig extends $pb.GeneratedMessage { @$pb.TagNumber(2) $core.List<$core.int> get passphrase => $_getN(1); @$pb.TagNumber(2) - set passphrase($core.List<$core.int> v) { $_setBytes(1, v); } + set passphrase($core.List<$core.int> v) { + $_setBytes(1, v); + } + @$pb.TagNumber(2) $core.bool hasPassphrase() => $_has(1); @$pb.TagNumber(2) @@ -161,7 +208,10 @@ class CmdSetConfig extends $pb.GeneratedMessage { @$pb.TagNumber(3) $core.List<$core.int> get bssid => $_getN(2); @$pb.TagNumber(3) - set bssid($core.List<$core.int> v) { $_setBytes(2, v); } + set bssid($core.List<$core.int> v) { + $_setBytes(2, v); + } + @$pb.TagNumber(3) $core.bool hasBssid() => $_has(2); @$pb.TagNumber(3) @@ -170,7 +220,10 @@ class CmdSetConfig extends $pb.GeneratedMessage { @$pb.TagNumber(4) $core.int get channel => $_getIZ(3); @$pb.TagNumber(4) - set channel($core.int v) { $_setSignedInt32(3, v); } + set channel($core.int v) { + $_setSignedInt32(3, v); + } + @$pb.TagNumber(4) $core.bool hasChannel() => $_has(3); @$pb.TagNumber(4) @@ -178,30 +231,43 @@ class CmdSetConfig extends $pb.GeneratedMessage { } class RespSetConfig extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('RespSetConfig', createEmptyInstance: create) - ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, defaultOrMaker: $0.Status.Success, valueOf: $0.Status.valueOf, enumValues: $0.Status.values) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('RespSetConfig', createEmptyInstance: create) + ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, + defaultOrMaker: $0.Status.Success, + valueOf: $0.Status.valueOf, + enumValues: $0.Status.values) + ..hasRequiredFields = false; RespSetConfig._() : super(); factory RespSetConfig() => create(); - factory RespSetConfig.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RespSetConfig.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory RespSetConfig.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory RespSetConfig.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); RespSetConfig clone() => RespSetConfig()..mergeFromMessage(this); - RespSetConfig copyWith(void Function(RespSetConfig) updates) => super.copyWith((message) => updates(message as RespSetConfig)); + RespSetConfig copyWith(void Function(RespSetConfig) updates) => + super.copyWith((message) => updates(message as RespSetConfig)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static RespSetConfig create() => RespSetConfig._(); RespSetConfig createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static RespSetConfig getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RespSetConfig getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static RespSetConfig _defaultInstance; @$pb.TagNumber(1) $0.Status get status => $_getN(0); @$pb.TagNumber(1) - set status($0.Status v) { setField(1, v); } + set status($0.Status v) { + setField(1, v); + } + @$pb.TagNumber(1) $core.bool hasStatus() => $_has(0); @$pb.TagNumber(1) @@ -209,51 +275,71 @@ class RespSetConfig extends $pb.GeneratedMessage { } class CmdApplyConfig extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('CmdApplyConfig', createEmptyInstance: create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('CmdApplyConfig', createEmptyInstance: create) + ..hasRequiredFields = false; CmdApplyConfig._() : super(); factory CmdApplyConfig() => create(); - factory CmdApplyConfig.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory CmdApplyConfig.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory CmdApplyConfig.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory CmdApplyConfig.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); CmdApplyConfig clone() => CmdApplyConfig()..mergeFromMessage(this); - CmdApplyConfig copyWith(void Function(CmdApplyConfig) updates) => super.copyWith((message) => updates(message as CmdApplyConfig)); + CmdApplyConfig copyWith(void Function(CmdApplyConfig) updates) => + super.copyWith((message) => updates(message as CmdApplyConfig)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static CmdApplyConfig create() => CmdApplyConfig._(); CmdApplyConfig createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static CmdApplyConfig getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CmdApplyConfig getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static CmdApplyConfig _defaultInstance; } class RespApplyConfig extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('RespApplyConfig', createEmptyInstance: create) - ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, defaultOrMaker: $0.Status.Success, valueOf: $0.Status.valueOf, enumValues: $0.Status.values) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('RespApplyConfig', createEmptyInstance: create) + ..e<$0.Status>(1, 'status', $pb.PbFieldType.OE, + defaultOrMaker: $0.Status.Success, + valueOf: $0.Status.valueOf, + enumValues: $0.Status.values) + ..hasRequiredFields = false; RespApplyConfig._() : super(); factory RespApplyConfig() => create(); - factory RespApplyConfig.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RespApplyConfig.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory RespApplyConfig.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory RespApplyConfig.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); RespApplyConfig clone() => RespApplyConfig()..mergeFromMessage(this); - RespApplyConfig copyWith(void Function(RespApplyConfig) updates) => super.copyWith((message) => updates(message as RespApplyConfig)); + RespApplyConfig copyWith(void Function(RespApplyConfig) updates) => + super.copyWith((message) => updates(message as RespApplyConfig)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static RespApplyConfig create() => RespApplyConfig._(); RespApplyConfig createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static RespApplyConfig getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RespApplyConfig getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static RespApplyConfig _defaultInstance; @$pb.TagNumber(1) $0.Status get status => $_getN(0); @$pb.TagNumber(1) - set status($0.Status v) { setField(1, v); } + set status($0.Status v) { + setField(1, v); + } + @$pb.TagNumber(1) $core.bool hasStatus() => $_has(0); @$pb.TagNumber(1) @@ -261,59 +347,76 @@ class RespApplyConfig extends $pb.GeneratedMessage { } enum WiFiConfigPayload_Payload { - cmdGetStatus, - respGetStatus, - cmdSetConfig, - respSetConfig, - cmdApplyConfig, - respApplyConfig, + cmdGetStatus, + respGetStatus, + cmdSetConfig, + respSetConfig, + cmdApplyConfig, + respApplyConfig, notSet } class WiFiConfigPayload extends $pb.GeneratedMessage { - static const $core.Map<$core.int, WiFiConfigPayload_Payload> _WiFiConfigPayload_PayloadByTag = { - 10 : WiFiConfigPayload_Payload.cmdGetStatus, - 11 : WiFiConfigPayload_Payload.respGetStatus, - 12 : WiFiConfigPayload_Payload.cmdSetConfig, - 13 : WiFiConfigPayload_Payload.respSetConfig, - 14 : WiFiConfigPayload_Payload.cmdApplyConfig, - 15 : WiFiConfigPayload_Payload.respApplyConfig, - 0 : WiFiConfigPayload_Payload.notSet + static const $core.Map<$core.int, WiFiConfigPayload_Payload> + _WiFiConfigPayload_PayloadByTag = { + 10: WiFiConfigPayload_Payload.cmdGetStatus, + 11: WiFiConfigPayload_Payload.respGetStatus, + 12: WiFiConfigPayload_Payload.cmdSetConfig, + 13: WiFiConfigPayload_Payload.respSetConfig, + 14: WiFiConfigPayload_Payload.cmdApplyConfig, + 15: WiFiConfigPayload_Payload.respApplyConfig, + 0: WiFiConfigPayload_Payload.notSet }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo('WiFiConfigPayload', createEmptyInstance: create) + static final $pb.BuilderInfo _i = $pb.BuilderInfo('WiFiConfigPayload', + createEmptyInstance: create) ..oo(0, [10, 11, 12, 13, 14, 15]) - ..e(1, 'msg', $pb.PbFieldType.OE, defaultOrMaker: WiFiConfigMsgType.TypeCmdGetStatus, valueOf: WiFiConfigMsgType.valueOf, enumValues: WiFiConfigMsgType.values) + ..e(1, 'msg', $pb.PbFieldType.OE, + defaultOrMaker: WiFiConfigMsgType.TypeCmdGetStatus, + valueOf: WiFiConfigMsgType.valueOf, + enumValues: WiFiConfigMsgType.values) ..aOM(10, 'cmdGetStatus', subBuilder: CmdGetStatus.create) ..aOM(11, 'respGetStatus', subBuilder: RespGetStatus.create) ..aOM(12, 'cmdSetConfig', subBuilder: CmdSetConfig.create) ..aOM(13, 'respSetConfig', subBuilder: RespSetConfig.create) - ..aOM(14, 'cmdApplyConfig', subBuilder: CmdApplyConfig.create) - ..aOM(15, 'respApplyConfig', subBuilder: RespApplyConfig.create) - ..hasRequiredFields = false - ; + ..aOM(14, 'cmdApplyConfig', + subBuilder: CmdApplyConfig.create) + ..aOM(15, 'respApplyConfig', + subBuilder: RespApplyConfig.create) + ..hasRequiredFields = false; WiFiConfigPayload._() : super(); factory WiFiConfigPayload() => create(); - factory WiFiConfigPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory WiFiConfigPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory WiFiConfigPayload.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory WiFiConfigPayload.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); WiFiConfigPayload clone() => WiFiConfigPayload()..mergeFromMessage(this); - WiFiConfigPayload copyWith(void Function(WiFiConfigPayload) updates) => super.copyWith((message) => updates(message as WiFiConfigPayload)); + WiFiConfigPayload copyWith(void Function(WiFiConfigPayload) updates) => + super.copyWith((message) => updates(message as WiFiConfigPayload)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static WiFiConfigPayload create() => WiFiConfigPayload._(); WiFiConfigPayload createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static WiFiConfigPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static WiFiConfigPayload getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static WiFiConfigPayload _defaultInstance; - WiFiConfigPayload_Payload whichPayload() => _WiFiConfigPayload_PayloadByTag[$_whichOneof(0)]; + WiFiConfigPayload_Payload whichPayload() => + _WiFiConfigPayload_PayloadByTag[$_whichOneof(0)]; void clearPayload() => clearField($_whichOneof(0)); @$pb.TagNumber(1) WiFiConfigMsgType get msg => $_getN(0); @$pb.TagNumber(1) - set msg(WiFiConfigMsgType v) { setField(1, v); } + set msg(WiFiConfigMsgType v) { + setField(1, v); + } + @$pb.TagNumber(1) $core.bool hasMsg() => $_has(0); @$pb.TagNumber(1) @@ -322,7 +425,10 @@ class WiFiConfigPayload extends $pb.GeneratedMessage { @$pb.TagNumber(10) CmdGetStatus get cmdGetStatus => $_getN(1); @$pb.TagNumber(10) - set cmdGetStatus(CmdGetStatus v) { setField(10, v); } + set cmdGetStatus(CmdGetStatus v) { + setField(10, v); + } + @$pb.TagNumber(10) $core.bool hasCmdGetStatus() => $_has(1); @$pb.TagNumber(10) @@ -333,7 +439,10 @@ class WiFiConfigPayload extends $pb.GeneratedMessage { @$pb.TagNumber(11) RespGetStatus get respGetStatus => $_getN(2); @$pb.TagNumber(11) - set respGetStatus(RespGetStatus v) { setField(11, v); } + set respGetStatus(RespGetStatus v) { + setField(11, v); + } + @$pb.TagNumber(11) $core.bool hasRespGetStatus() => $_has(2); @$pb.TagNumber(11) @@ -344,7 +453,10 @@ class WiFiConfigPayload extends $pb.GeneratedMessage { @$pb.TagNumber(12) CmdSetConfig get cmdSetConfig => $_getN(3); @$pb.TagNumber(12) - set cmdSetConfig(CmdSetConfig v) { setField(12, v); } + set cmdSetConfig(CmdSetConfig v) { + setField(12, v); + } + @$pb.TagNumber(12) $core.bool hasCmdSetConfig() => $_has(3); @$pb.TagNumber(12) @@ -355,7 +467,10 @@ class WiFiConfigPayload extends $pb.GeneratedMessage { @$pb.TagNumber(13) RespSetConfig get respSetConfig => $_getN(4); @$pb.TagNumber(13) - set respSetConfig(RespSetConfig v) { setField(13, v); } + set respSetConfig(RespSetConfig v) { + setField(13, v); + } + @$pb.TagNumber(13) $core.bool hasRespSetConfig() => $_has(4); @$pb.TagNumber(13) @@ -366,7 +481,10 @@ class WiFiConfigPayload extends $pb.GeneratedMessage { @$pb.TagNumber(14) CmdApplyConfig get cmdApplyConfig => $_getN(5); @$pb.TagNumber(14) - set cmdApplyConfig(CmdApplyConfig v) { setField(14, v); } + set cmdApplyConfig(CmdApplyConfig v) { + setField(14, v); + } + @$pb.TagNumber(14) $core.bool hasCmdApplyConfig() => $_has(5); @$pb.TagNumber(14) @@ -377,7 +495,10 @@ class WiFiConfigPayload extends $pb.GeneratedMessage { @$pb.TagNumber(15) RespApplyConfig get respApplyConfig => $_getN(6); @$pb.TagNumber(15) - set respApplyConfig(RespApplyConfig v) { setField(15, v); } + set respApplyConfig(RespApplyConfig v) { + setField(15, v); + } + @$pb.TagNumber(15) $core.bool hasRespApplyConfig() => $_has(6); @$pb.TagNumber(15) @@ -385,4 +506,3 @@ class WiFiConfigPayload extends $pb.GeneratedMessage { @$pb.TagNumber(15) RespApplyConfig ensureRespApplyConfig() => $_ensure(6); } - diff --git a/lib/src/proto/dart/wifi_config.pbenum.dart b/lib/src/proto/dart/wifi_config.pbenum.dart index ce735af..c741090 100644 --- a/lib/src/proto/dart/wifi_config.pbenum.dart +++ b/lib/src/proto/dart/wifi_config.pbenum.dart @@ -10,14 +10,20 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; class WiFiConfigMsgType extends $pb.ProtobufEnum { - static const WiFiConfigMsgType TypeCmdGetStatus = WiFiConfigMsgType._(0, 'TypeCmdGetStatus'); - static const WiFiConfigMsgType TypeRespGetStatus = WiFiConfigMsgType._(1, 'TypeRespGetStatus'); - static const WiFiConfigMsgType TypeCmdSetConfig = WiFiConfigMsgType._(2, 'TypeCmdSetConfig'); - static const WiFiConfigMsgType TypeRespSetConfig = WiFiConfigMsgType._(3, 'TypeRespSetConfig'); - static const WiFiConfigMsgType TypeCmdApplyConfig = WiFiConfigMsgType._(4, 'TypeCmdApplyConfig'); - static const WiFiConfigMsgType TypeRespApplyConfig = WiFiConfigMsgType._(5, 'TypeRespApplyConfig'); + static const WiFiConfigMsgType TypeCmdGetStatus = + WiFiConfigMsgType._(0, 'TypeCmdGetStatus'); + static const WiFiConfigMsgType TypeRespGetStatus = + WiFiConfigMsgType._(1, 'TypeRespGetStatus'); + static const WiFiConfigMsgType TypeCmdSetConfig = + WiFiConfigMsgType._(2, 'TypeCmdSetConfig'); + static const WiFiConfigMsgType TypeRespSetConfig = + WiFiConfigMsgType._(3, 'TypeRespSetConfig'); + static const WiFiConfigMsgType TypeCmdApplyConfig = + WiFiConfigMsgType._(4, 'TypeCmdApplyConfig'); + static const WiFiConfigMsgType TypeRespApplyConfig = + WiFiConfigMsgType._(5, 'TypeRespApplyConfig'); - static const $core.List values = [ + static const $core.List values = [ TypeCmdGetStatus, TypeRespGetStatus, TypeCmdSetConfig, @@ -26,9 +32,9 @@ class WiFiConfigMsgType extends $pb.ProtobufEnum { TypeRespApplyConfig, ]; - static final $core.Map<$core.int, WiFiConfigMsgType> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, WiFiConfigMsgType> _byValue = + $pb.ProtobufEnum.initByValue(values); static WiFiConfigMsgType valueOf($core.int value) => _byValue[value]; const WiFiConfigMsgType._($core.int v, $core.String n) : super(v, n); } - diff --git a/lib/src/proto/dart/wifi_config.pbjson.dart b/lib/src/proto/dart/wifi_config.pbjson.dart index bedeaef..da45510 100644 --- a/lib/src/proto/dart/wifi_config.pbjson.dart +++ b/lib/src/proto/dart/wifi_config.pbjson.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: wifi_config.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type const WiFiConfigMsgType$json = const { @@ -24,10 +24,40 @@ const CmdGetStatus$json = const { const RespGetStatus$json = const { '1': 'RespGetStatus', '2': const [ - const {'1': 'status', '3': 1, '4': 1, '5': 14, '6': '.Status', '10': 'status'}, - const {'1': 'sta_state', '3': 2, '4': 1, '5': 14, '6': '.WifiStationState', '10': 'staState'}, - const {'1': 'fail_reason', '3': 10, '4': 1, '5': 14, '6': '.WifiConnectFailedReason', '9': 0, '10': 'failReason'}, - const {'1': 'connected', '3': 11, '4': 1, '5': 11, '6': '.WifiConnectedState', '9': 0, '10': 'connected'}, + const { + '1': 'status', + '3': 1, + '4': 1, + '5': 14, + '6': '.Status', + '10': 'status' + }, + const { + '1': 'sta_state', + '3': 2, + '4': 1, + '5': 14, + '6': '.WifiStationState', + '10': 'staState' + }, + const { + '1': 'fail_reason', + '3': 10, + '4': 1, + '5': 14, + '6': '.WifiConnectFailedReason', + '9': 0, + '10': 'failReason' + }, + const { + '1': 'connected', + '3': 11, + '4': 1, + '5': 11, + '6': '.WifiConnectedState', + '9': 0, + '10': 'connected' + }, ], '8': const [ const {'1': 'state'}, @@ -47,7 +77,14 @@ const CmdSetConfig$json = const { const RespSetConfig$json = const { '1': 'RespSetConfig', '2': const [ - const {'1': 'status', '3': 1, '4': 1, '5': 14, '6': '.Status', '10': 'status'}, + const { + '1': 'status', + '3': 1, + '4': 1, + '5': 14, + '6': '.Status', + '10': 'status' + }, ], }; @@ -58,23 +95,84 @@ const CmdApplyConfig$json = const { const RespApplyConfig$json = const { '1': 'RespApplyConfig', '2': const [ - const {'1': 'status', '3': 1, '4': 1, '5': 14, '6': '.Status', '10': 'status'}, + const { + '1': 'status', + '3': 1, + '4': 1, + '5': 14, + '6': '.Status', + '10': 'status' + }, ], }; const WiFiConfigPayload$json = const { '1': 'WiFiConfigPayload', '2': const [ - const {'1': 'msg', '3': 1, '4': 1, '5': 14, '6': '.WiFiConfigMsgType', '10': 'msg'}, - const {'1': 'cmd_get_status', '3': 10, '4': 1, '5': 11, '6': '.CmdGetStatus', '9': 0, '10': 'cmdGetStatus'}, - const {'1': 'resp_get_status', '3': 11, '4': 1, '5': 11, '6': '.RespGetStatus', '9': 0, '10': 'respGetStatus'}, - const {'1': 'cmd_set_config', '3': 12, '4': 1, '5': 11, '6': '.CmdSetConfig', '9': 0, '10': 'cmdSetConfig'}, - const {'1': 'resp_set_config', '3': 13, '4': 1, '5': 11, '6': '.RespSetConfig', '9': 0, '10': 'respSetConfig'}, - const {'1': 'cmd_apply_config', '3': 14, '4': 1, '5': 11, '6': '.CmdApplyConfig', '9': 0, '10': 'cmdApplyConfig'}, - const {'1': 'resp_apply_config', '3': 15, '4': 1, '5': 11, '6': '.RespApplyConfig', '9': 0, '10': 'respApplyConfig'}, + const { + '1': 'msg', + '3': 1, + '4': 1, + '5': 14, + '6': '.WiFiConfigMsgType', + '10': 'msg' + }, + const { + '1': 'cmd_get_status', + '3': 10, + '4': 1, + '5': 11, + '6': '.CmdGetStatus', + '9': 0, + '10': 'cmdGetStatus' + }, + const { + '1': 'resp_get_status', + '3': 11, + '4': 1, + '5': 11, + '6': '.RespGetStatus', + '9': 0, + '10': 'respGetStatus' + }, + const { + '1': 'cmd_set_config', + '3': 12, + '4': 1, + '5': 11, + '6': '.CmdSetConfig', + '9': 0, + '10': 'cmdSetConfig' + }, + const { + '1': 'resp_set_config', + '3': 13, + '4': 1, + '5': 11, + '6': '.RespSetConfig', + '9': 0, + '10': 'respSetConfig' + }, + const { + '1': 'cmd_apply_config', + '3': 14, + '4': 1, + '5': 11, + '6': '.CmdApplyConfig', + '9': 0, + '10': 'cmdApplyConfig' + }, + const { + '1': 'resp_apply_config', + '3': 15, + '4': 1, + '5': 11, + '6': '.RespApplyConfig', + '9': 0, + '10': 'respApplyConfig' + }, ], '8': const [ const {'1': 'payload'}, ], }; - diff --git a/lib/src/proto/dart/wifi_config.pbserver.dart b/lib/src/proto/dart/wifi_config.pbserver.dart index 86bd9da..dd3535a 100644 --- a/lib/src/proto/dart/wifi_config.pbserver.dart +++ b/lib/src/proto/dart/wifi_config.pbserver.dart @@ -2,8 +2,7 @@ // Generated code. Do not modify. // source: wifi_config.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type export 'wifi_config.pb.dart'; - diff --git a/lib/src/proto/dart/wifi_constants.pb.dart b/lib/src/proto/dart/wifi_constants.pb.dart index d434307..73e5854 100644 --- a/lib/src/proto/dart/wifi_constants.pb.dart +++ b/lib/src/proto/dart/wifi_constants.pb.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: wifi_constants.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type import 'dart:core' as $core; @@ -14,34 +14,47 @@ import 'wifi_constants.pbenum.dart'; export 'wifi_constants.pbenum.dart'; class WifiConnectedState extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('WifiConnectedState', createEmptyInstance: create) - ..aOS(1, 'ip4Addr') - ..e(2, 'authMode', $pb.PbFieldType.OE, defaultOrMaker: WifiAuthMode.Open, valueOf: WifiAuthMode.valueOf, enumValues: WifiAuthMode.values) - ..a<$core.List<$core.int>>(3, 'ssid', $pb.PbFieldType.OY) - ..a<$core.List<$core.int>>(4, 'bssid', $pb.PbFieldType.OY) - ..a<$core.int>(5, 'channel', $pb.PbFieldType.O3) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('WifiConnectedState', createEmptyInstance: create) + ..aOS(1, 'ip4Addr') + ..e(2, 'authMode', $pb.PbFieldType.OE, + defaultOrMaker: WifiAuthMode.Open, + valueOf: WifiAuthMode.valueOf, + enumValues: WifiAuthMode.values) + ..a<$core.List<$core.int>>(3, 'ssid', $pb.PbFieldType.OY) + ..a<$core.List<$core.int>>(4, 'bssid', $pb.PbFieldType.OY) + ..a<$core.int>(5, 'channel', $pb.PbFieldType.O3) + ..hasRequiredFields = false; WifiConnectedState._() : super(); factory WifiConnectedState() => create(); - factory WifiConnectedState.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory WifiConnectedState.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory WifiConnectedState.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory WifiConnectedState.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); WifiConnectedState clone() => WifiConnectedState()..mergeFromMessage(this); - WifiConnectedState copyWith(void Function(WifiConnectedState) updates) => super.copyWith((message) => updates(message as WifiConnectedState)); + WifiConnectedState copyWith(void Function(WifiConnectedState) updates) => + super.copyWith((message) => updates(message as WifiConnectedState)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static WifiConnectedState create() => WifiConnectedState._(); WifiConnectedState createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static WifiConnectedState getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static WifiConnectedState getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static WifiConnectedState _defaultInstance; @$pb.TagNumber(1) $core.String get ip4Addr => $_getSZ(0); @$pb.TagNumber(1) - set ip4Addr($core.String v) { $_setString(0, v); } + set ip4Addr($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasIp4Addr() => $_has(0); @$pb.TagNumber(1) @@ -50,7 +63,10 @@ class WifiConnectedState extends $pb.GeneratedMessage { @$pb.TagNumber(2) WifiAuthMode get authMode => $_getN(1); @$pb.TagNumber(2) - set authMode(WifiAuthMode v) { setField(2, v); } + set authMode(WifiAuthMode v) { + setField(2, v); + } + @$pb.TagNumber(2) $core.bool hasAuthMode() => $_has(1); @$pb.TagNumber(2) @@ -59,7 +75,10 @@ class WifiConnectedState extends $pb.GeneratedMessage { @$pb.TagNumber(3) $core.List<$core.int> get ssid => $_getN(2); @$pb.TagNumber(3) - set ssid($core.List<$core.int> v) { $_setBytes(2, v); } + set ssid($core.List<$core.int> v) { + $_setBytes(2, v); + } + @$pb.TagNumber(3) $core.bool hasSsid() => $_has(2); @$pb.TagNumber(3) @@ -68,7 +87,10 @@ class WifiConnectedState extends $pb.GeneratedMessage { @$pb.TagNumber(4) $core.List<$core.int> get bssid => $_getN(3); @$pb.TagNumber(4) - set bssid($core.List<$core.int> v) { $_setBytes(3, v); } + set bssid($core.List<$core.int> v) { + $_setBytes(3, v); + } + @$pb.TagNumber(4) $core.bool hasBssid() => $_has(3); @$pb.TagNumber(4) @@ -77,10 +99,12 @@ class WifiConnectedState extends $pb.GeneratedMessage { @$pb.TagNumber(5) $core.int get channel => $_getIZ(4); @$pb.TagNumber(5) - set channel($core.int v) { $_setSignedInt32(4, v); } + set channel($core.int v) { + $_setSignedInt32(4, v); + } + @$pb.TagNumber(5) $core.bool hasChannel() => $_has(4); @$pb.TagNumber(5) void clearChannel() => clearField(5); } - diff --git a/lib/src/proto/dart/wifi_constants.pbenum.dart b/lib/src/proto/dart/wifi_constants.pbenum.dart index 2453f6d..8204da3 100644 --- a/lib/src/proto/dart/wifi_constants.pbenum.dart +++ b/lib/src/proto/dart/wifi_constants.pbenum.dart @@ -11,33 +11,41 @@ import 'package:protobuf/protobuf.dart' as $pb; class WifiStationState extends $pb.ProtobufEnum { static const WifiStationState Connected = WifiStationState._(0, 'Connected'); - static const WifiStationState Connecting = WifiStationState._(1, 'Connecting'); - static const WifiStationState Disconnected = WifiStationState._(2, 'Disconnected'); - static const WifiStationState ConnectionFailed = WifiStationState._(3, 'ConnectionFailed'); + static const WifiStationState Connecting = + WifiStationState._(1, 'Connecting'); + static const WifiStationState Disconnected = + WifiStationState._(2, 'Disconnected'); + static const WifiStationState ConnectionFailed = + WifiStationState._(3, 'ConnectionFailed'); - static const $core.List values = [ + static const $core.List values = [ Connected, Connecting, Disconnected, ConnectionFailed, ]; - static final $core.Map<$core.int, WifiStationState> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, WifiStationState> _byValue = + $pb.ProtobufEnum.initByValue(values); static WifiStationState valueOf($core.int value) => _byValue[value]; const WifiStationState._($core.int v, $core.String n) : super(v, n); } class WifiConnectFailedReason extends $pb.ProtobufEnum { - static const WifiConnectFailedReason AuthError = WifiConnectFailedReason._(0, 'AuthError'); - static const WifiConnectFailedReason NetworkNotFound = WifiConnectFailedReason._(1, 'NetworkNotFound'); + static const WifiConnectFailedReason AuthError = + WifiConnectFailedReason._(0, 'AuthError'); + static const WifiConnectFailedReason NetworkNotFound = + WifiConnectFailedReason._(1, 'NetworkNotFound'); - static const $core.List values = [ + static const $core.List values = + [ AuthError, NetworkNotFound, ]; - static final $core.Map<$core.int, WifiConnectFailedReason> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, WifiConnectFailedReason> _byValue = + $pb.ProtobufEnum.initByValue(values); static WifiConnectFailedReason valueOf($core.int value) => _byValue[value]; const WifiConnectFailedReason._($core.int v, $core.String n) : super(v, n); @@ -49,9 +57,10 @@ class WifiAuthMode extends $pb.ProtobufEnum { static const WifiAuthMode WPA_PSK = WifiAuthMode._(2, 'WPA_PSK'); static const WifiAuthMode WPA2_PSK = WifiAuthMode._(3, 'WPA2_PSK'); static const WifiAuthMode WPA_WPA2_PSK = WifiAuthMode._(4, 'WPA_WPA2_PSK'); - static const WifiAuthMode WPA2_ENTERPRISE = WifiAuthMode._(5, 'WPA2_ENTERPRISE'); + static const WifiAuthMode WPA2_ENTERPRISE = + WifiAuthMode._(5, 'WPA2_ENTERPRISE'); - static const $core.List values = [ + static const $core.List values = [ Open, WEP, WPA_PSK, @@ -60,9 +69,9 @@ class WifiAuthMode extends $pb.ProtobufEnum { WPA2_ENTERPRISE, ]; - static final $core.Map<$core.int, WifiAuthMode> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, WifiAuthMode> _byValue = + $pb.ProtobufEnum.initByValue(values); static WifiAuthMode valueOf($core.int value) => _byValue[value]; const WifiAuthMode._($core.int v, $core.String n) : super(v, n); } - diff --git a/lib/src/proto/dart/wifi_constants.pbjson.dart b/lib/src/proto/dart/wifi_constants.pbjson.dart index 01ab12c..5bb7b9e 100644 --- a/lib/src/proto/dart/wifi_constants.pbjson.dart +++ b/lib/src/proto/dart/wifi_constants.pbjson.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: wifi_constants.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type const WifiStationState$json = const { @@ -39,10 +39,16 @@ const WifiConnectedState$json = const { '1': 'WifiConnectedState', '2': const [ const {'1': 'ip4_addr', '3': 1, '4': 1, '5': 9, '10': 'ip4Addr'}, - const {'1': 'auth_mode', '3': 2, '4': 1, '5': 14, '6': '.WifiAuthMode', '10': 'authMode'}, + const { + '1': 'auth_mode', + '3': 2, + '4': 1, + '5': 14, + '6': '.WifiAuthMode', + '10': 'authMode' + }, const {'1': 'ssid', '3': 3, '4': 1, '5': 12, '10': 'ssid'}, const {'1': 'bssid', '3': 4, '4': 1, '5': 12, '10': 'bssid'}, const {'1': 'channel', '3': 5, '4': 1, '5': 5, '10': 'channel'}, ], }; - diff --git a/lib/src/proto/dart/wifi_constants.pbserver.dart b/lib/src/proto/dart/wifi_constants.pbserver.dart index d23cffa..3841166 100644 --- a/lib/src/proto/dart/wifi_constants.pbserver.dart +++ b/lib/src/proto/dart/wifi_constants.pbserver.dart @@ -2,8 +2,7 @@ // Generated code. Do not modify. // source: wifi_constants.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type export 'wifi_constants.pb.dart'; - diff --git a/lib/src/proto/dart/wifi_scan.pb.dart b/lib/src/proto/dart/wifi_scan.pb.dart index a1061d9..6fd9276 100644 --- a/lib/src/proto/dart/wifi_scan.pb.dart +++ b/lib/src/proto/dart/wifi_scan.pb.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: wifi_scan.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type import 'dart:core' as $core; @@ -16,33 +16,43 @@ import 'constants.pbenum.dart' as $0; export 'wifi_scan.pbenum.dart'; class CmdScanStart extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('CmdScanStart', createEmptyInstance: create) - ..aOB(1, 'blocking') - ..aOB(2, 'passive') - ..a<$core.int>(3, 'groupChannels', $pb.PbFieldType.OU3) - ..a<$core.int>(4, 'periodMs', $pb.PbFieldType.OU3) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('CmdScanStart', createEmptyInstance: create) + ..aOB(1, 'blocking') + ..aOB(2, 'passive') + ..a<$core.int>(3, 'groupChannels', $pb.PbFieldType.OU3) + ..a<$core.int>(4, 'periodMs', $pb.PbFieldType.OU3) + ..hasRequiredFields = false; CmdScanStart._() : super(); factory CmdScanStart() => create(); - factory CmdScanStart.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory CmdScanStart.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory CmdScanStart.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory CmdScanStart.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); CmdScanStart clone() => CmdScanStart()..mergeFromMessage(this); - CmdScanStart copyWith(void Function(CmdScanStart) updates) => super.copyWith((message) => updates(message as CmdScanStart)); + CmdScanStart copyWith(void Function(CmdScanStart) updates) => + super.copyWith((message) => updates(message as CmdScanStart)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static CmdScanStart create() => CmdScanStart._(); CmdScanStart createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static CmdScanStart getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CmdScanStart getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static CmdScanStart _defaultInstance; @$pb.TagNumber(1) $core.bool get blocking => $_getBF(0); @$pb.TagNumber(1) - set blocking($core.bool v) { $_setBool(0, v); } + set blocking($core.bool v) { + $_setBool(0, v); + } + @$pb.TagNumber(1) $core.bool hasBlocking() => $_has(0); @$pb.TagNumber(1) @@ -51,7 +61,10 @@ class CmdScanStart extends $pb.GeneratedMessage { @$pb.TagNumber(2) $core.bool get passive => $_getBF(1); @$pb.TagNumber(2) - set passive($core.bool v) { $_setBool(1, v); } + set passive($core.bool v) { + $_setBool(1, v); + } + @$pb.TagNumber(2) $core.bool hasPassive() => $_has(1); @$pb.TagNumber(2) @@ -60,7 +73,10 @@ class CmdScanStart extends $pb.GeneratedMessage { @$pb.TagNumber(3) $core.int get groupChannels => $_getIZ(2); @$pb.TagNumber(3) - set groupChannels($core.int v) { $_setUnsignedInt32(2, v); } + set groupChannels($core.int v) { + $_setUnsignedInt32(2, v); + } + @$pb.TagNumber(3) $core.bool hasGroupChannels() => $_has(2); @$pb.TagNumber(3) @@ -69,7 +85,10 @@ class CmdScanStart extends $pb.GeneratedMessage { @$pb.TagNumber(4) $core.int get periodMs => $_getIZ(3); @$pb.TagNumber(4) - set periodMs($core.int v) { $_setUnsignedInt32(3, v); } + set periodMs($core.int v) { + $_setUnsignedInt32(3, v); + } + @$pb.TagNumber(4) $core.bool hasPeriodMs() => $_has(3); @$pb.TagNumber(4) @@ -77,73 +96,97 @@ class CmdScanStart extends $pb.GeneratedMessage { } class RespScanStart extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('RespScanStart', createEmptyInstance: create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('RespScanStart', createEmptyInstance: create) + ..hasRequiredFields = false; RespScanStart._() : super(); factory RespScanStart() => create(); - factory RespScanStart.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RespScanStart.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory RespScanStart.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory RespScanStart.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); RespScanStart clone() => RespScanStart()..mergeFromMessage(this); - RespScanStart copyWith(void Function(RespScanStart) updates) => super.copyWith((message) => updates(message as RespScanStart)); + RespScanStart copyWith(void Function(RespScanStart) updates) => + super.copyWith((message) => updates(message as RespScanStart)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static RespScanStart create() => RespScanStart._(); RespScanStart createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static RespScanStart getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RespScanStart getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static RespScanStart _defaultInstance; } class CmdScanStatus extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('CmdScanStatus', createEmptyInstance: create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('CmdScanStatus', createEmptyInstance: create) + ..hasRequiredFields = false; CmdScanStatus._() : super(); factory CmdScanStatus() => create(); - factory CmdScanStatus.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory CmdScanStatus.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory CmdScanStatus.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory CmdScanStatus.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); CmdScanStatus clone() => CmdScanStatus()..mergeFromMessage(this); - CmdScanStatus copyWith(void Function(CmdScanStatus) updates) => super.copyWith((message) => updates(message as CmdScanStatus)); + CmdScanStatus copyWith(void Function(CmdScanStatus) updates) => + super.copyWith((message) => updates(message as CmdScanStatus)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static CmdScanStatus create() => CmdScanStatus._(); CmdScanStatus createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static CmdScanStatus getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CmdScanStatus getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static CmdScanStatus _defaultInstance; } class RespScanStatus extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('RespScanStatus', createEmptyInstance: create) - ..aOB(1, 'scanFinished') - ..a<$core.int>(2, 'resultCount', $pb.PbFieldType.OU3) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('RespScanStatus', createEmptyInstance: create) + ..aOB(1, 'scanFinished') + ..a<$core.int>(2, 'resultCount', $pb.PbFieldType.OU3) + ..hasRequiredFields = false; RespScanStatus._() : super(); factory RespScanStatus() => create(); - factory RespScanStatus.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RespScanStatus.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory RespScanStatus.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory RespScanStatus.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); RespScanStatus clone() => RespScanStatus()..mergeFromMessage(this); - RespScanStatus copyWith(void Function(RespScanStatus) updates) => super.copyWith((message) => updates(message as RespScanStatus)); + RespScanStatus copyWith(void Function(RespScanStatus) updates) => + super.copyWith((message) => updates(message as RespScanStatus)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static RespScanStatus create() => RespScanStatus._(); RespScanStatus createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static RespScanStatus getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RespScanStatus getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static RespScanStatus _defaultInstance; @$pb.TagNumber(1) $core.bool get scanFinished => $_getBF(0); @$pb.TagNumber(1) - set scanFinished($core.bool v) { $_setBool(0, v); } + set scanFinished($core.bool v) { + $_setBool(0, v); + } + @$pb.TagNumber(1) $core.bool hasScanFinished() => $_has(0); @$pb.TagNumber(1) @@ -152,7 +195,10 @@ class RespScanStatus extends $pb.GeneratedMessage { @$pb.TagNumber(2) $core.int get resultCount => $_getIZ(1); @$pb.TagNumber(2) - set resultCount($core.int v) { $_setUnsignedInt32(1, v); } + set resultCount($core.int v) { + $_setUnsignedInt32(1, v); + } + @$pb.TagNumber(2) $core.bool hasResultCount() => $_has(1); @$pb.TagNumber(2) @@ -160,31 +206,41 @@ class RespScanStatus extends $pb.GeneratedMessage { } class CmdScanResult extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('CmdScanResult', createEmptyInstance: create) - ..a<$core.int>(1, 'startIndex', $pb.PbFieldType.OU3) - ..a<$core.int>(2, 'count', $pb.PbFieldType.OU3) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('CmdScanResult', createEmptyInstance: create) + ..a<$core.int>(1, 'startIndex', $pb.PbFieldType.OU3) + ..a<$core.int>(2, 'count', $pb.PbFieldType.OU3) + ..hasRequiredFields = false; CmdScanResult._() : super(); factory CmdScanResult() => create(); - factory CmdScanResult.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory CmdScanResult.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory CmdScanResult.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory CmdScanResult.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); CmdScanResult clone() => CmdScanResult()..mergeFromMessage(this); - CmdScanResult copyWith(void Function(CmdScanResult) updates) => super.copyWith((message) => updates(message as CmdScanResult)); + CmdScanResult copyWith(void Function(CmdScanResult) updates) => + super.copyWith((message) => updates(message as CmdScanResult)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static CmdScanResult create() => CmdScanResult._(); CmdScanResult createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static CmdScanResult getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static CmdScanResult getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static CmdScanResult _defaultInstance; @$pb.TagNumber(1) $core.int get startIndex => $_getIZ(0); @$pb.TagNumber(1) - set startIndex($core.int v) { $_setUnsignedInt32(0, v); } + set startIndex($core.int v) { + $_setUnsignedInt32(0, v); + } + @$pb.TagNumber(1) $core.bool hasStartIndex() => $_has(0); @$pb.TagNumber(1) @@ -193,7 +249,10 @@ class CmdScanResult extends $pb.GeneratedMessage { @$pb.TagNumber(2) $core.int get count => $_getIZ(1); @$pb.TagNumber(2) - set count($core.int v) { $_setUnsignedInt32(1, v); } + set count($core.int v) { + $_setUnsignedInt32(1, v); + } + @$pb.TagNumber(2) $core.bool hasCount() => $_has(1); @$pb.TagNumber(2) @@ -201,34 +260,47 @@ class CmdScanResult extends $pb.GeneratedMessage { } class WiFiScanResult extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('WiFiScanResult', createEmptyInstance: create) - ..a<$core.List<$core.int>>(1, 'ssid', $pb.PbFieldType.OY) - ..a<$core.int>(2, 'channel', $pb.PbFieldType.OU3) - ..a<$core.int>(3, 'rssi', $pb.PbFieldType.O3) - ..a<$core.List<$core.int>>(4, 'bssid', $pb.PbFieldType.OY) - ..e<$3.WifiAuthMode>(5, 'auth', $pb.PbFieldType.OE, defaultOrMaker: $3.WifiAuthMode.Open, valueOf: $3.WifiAuthMode.valueOf, enumValues: $3.WifiAuthMode.values) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('WiFiScanResult', createEmptyInstance: create) + ..a<$core.List<$core.int>>(1, 'ssid', $pb.PbFieldType.OY) + ..a<$core.int>(2, 'channel', $pb.PbFieldType.OU3) + ..a<$core.int>(3, 'rssi', $pb.PbFieldType.O3) + ..a<$core.List<$core.int>>(4, 'bssid', $pb.PbFieldType.OY) + ..e<$3.WifiAuthMode>(5, 'auth', $pb.PbFieldType.OE, + defaultOrMaker: $3.WifiAuthMode.Open, + valueOf: $3.WifiAuthMode.valueOf, + enumValues: $3.WifiAuthMode.values) + ..hasRequiredFields = false; WiFiScanResult._() : super(); factory WiFiScanResult() => create(); - factory WiFiScanResult.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory WiFiScanResult.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory WiFiScanResult.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory WiFiScanResult.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); WiFiScanResult clone() => WiFiScanResult()..mergeFromMessage(this); - WiFiScanResult copyWith(void Function(WiFiScanResult) updates) => super.copyWith((message) => updates(message as WiFiScanResult)); + WiFiScanResult copyWith(void Function(WiFiScanResult) updates) => + super.copyWith((message) => updates(message as WiFiScanResult)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static WiFiScanResult create() => WiFiScanResult._(); WiFiScanResult createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static WiFiScanResult getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static WiFiScanResult getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static WiFiScanResult _defaultInstance; @$pb.TagNumber(1) $core.List<$core.int> get ssid => $_getN(0); @$pb.TagNumber(1) - set ssid($core.List<$core.int> v) { $_setBytes(0, v); } + set ssid($core.List<$core.int> v) { + $_setBytes(0, v); + } + @$pb.TagNumber(1) $core.bool hasSsid() => $_has(0); @$pb.TagNumber(1) @@ -237,7 +309,10 @@ class WiFiScanResult extends $pb.GeneratedMessage { @$pb.TagNumber(2) $core.int get channel => $_getIZ(1); @$pb.TagNumber(2) - set channel($core.int v) { $_setUnsignedInt32(1, v); } + set channel($core.int v) { + $_setUnsignedInt32(1, v); + } + @$pb.TagNumber(2) $core.bool hasChannel() => $_has(1); @$pb.TagNumber(2) @@ -246,7 +321,10 @@ class WiFiScanResult extends $pb.GeneratedMessage { @$pb.TagNumber(3) $core.int get rssi => $_getIZ(2); @$pb.TagNumber(3) - set rssi($core.int v) { $_setSignedInt32(2, v); } + set rssi($core.int v) { + $_setSignedInt32(2, v); + } + @$pb.TagNumber(3) $core.bool hasRssi() => $_has(2); @$pb.TagNumber(3) @@ -255,7 +333,10 @@ class WiFiScanResult extends $pb.GeneratedMessage { @$pb.TagNumber(4) $core.List<$core.int> get bssid => $_getN(3); @$pb.TagNumber(4) - set bssid($core.List<$core.int> v) { $_setBytes(3, v); } + set bssid($core.List<$core.int> v) { + $_setBytes(3, v); + } + @$pb.TagNumber(4) $core.bool hasBssid() => $_has(3); @$pb.TagNumber(4) @@ -264,7 +345,10 @@ class WiFiScanResult extends $pb.GeneratedMessage { @$pb.TagNumber(5) $3.WifiAuthMode get auth => $_getN(4); @$pb.TagNumber(5) - set auth($3.WifiAuthMode v) { setField(5, v); } + set auth($3.WifiAuthMode v) { + setField(5, v); + } + @$pb.TagNumber(5) $core.bool hasAuth() => $_has(4); @$pb.TagNumber(5) @@ -272,24 +356,32 @@ class WiFiScanResult extends $pb.GeneratedMessage { } class RespScanResult extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('RespScanResult', createEmptyInstance: create) - ..pc(1, 'entries', $pb.PbFieldType.PM, subBuilder: WiFiScanResult.create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('RespScanResult', createEmptyInstance: create) + ..pc(1, 'entries', $pb.PbFieldType.PM, + subBuilder: WiFiScanResult.create) + ..hasRequiredFields = false; RespScanResult._() : super(); factory RespScanResult() => create(); - factory RespScanResult.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RespScanResult.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory RespScanResult.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory RespScanResult.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); RespScanResult clone() => RespScanResult()..mergeFromMessage(this); - RespScanResult copyWith(void Function(RespScanResult) updates) => super.copyWith((message) => updates(message as RespScanResult)); + RespScanResult copyWith(void Function(RespScanResult) updates) => + super.copyWith((message) => updates(message as RespScanResult)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static RespScanResult create() => RespScanResult._(); RespScanResult createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static RespScanResult getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RespScanResult getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static RespScanResult _defaultInstance; @$pb.TagNumber(1) @@ -297,60 +389,80 @@ class RespScanResult extends $pb.GeneratedMessage { } enum WiFiScanPayload_Payload { - cmdScanStart, - respScanStart, - cmdScanStatus, - respScanStatus, - cmdScanResult, - respScanResult, + cmdScanStart, + respScanStart, + cmdScanStatus, + respScanStatus, + cmdScanResult, + respScanResult, notSet } class WiFiScanPayload extends $pb.GeneratedMessage { - static const $core.Map<$core.int, WiFiScanPayload_Payload> _WiFiScanPayload_PayloadByTag = { - 10 : WiFiScanPayload_Payload.cmdScanStart, - 11 : WiFiScanPayload_Payload.respScanStart, - 12 : WiFiScanPayload_Payload.cmdScanStatus, - 13 : WiFiScanPayload_Payload.respScanStatus, - 14 : WiFiScanPayload_Payload.cmdScanResult, - 15 : WiFiScanPayload_Payload.respScanResult, - 0 : WiFiScanPayload_Payload.notSet + static const $core.Map<$core.int, WiFiScanPayload_Payload> + _WiFiScanPayload_PayloadByTag = { + 10: WiFiScanPayload_Payload.cmdScanStart, + 11: WiFiScanPayload_Payload.respScanStart, + 12: WiFiScanPayload_Payload.cmdScanStatus, + 13: WiFiScanPayload_Payload.respScanStatus, + 14: WiFiScanPayload_Payload.cmdScanResult, + 15: WiFiScanPayload_Payload.respScanResult, + 0: WiFiScanPayload_Payload.notSet }; - static final $pb.BuilderInfo _i = $pb.BuilderInfo('WiFiScanPayload', createEmptyInstance: create) + static final $pb.BuilderInfo _i = $pb.BuilderInfo('WiFiScanPayload', + createEmptyInstance: create) ..oo(0, [10, 11, 12, 13, 14, 15]) - ..e(1, 'msg', $pb.PbFieldType.OE, defaultOrMaker: WiFiScanMsgType.TypeCmdScanStart, valueOf: WiFiScanMsgType.valueOf, enumValues: WiFiScanMsgType.values) - ..e<$0.Status>(2, 'status', $pb.PbFieldType.OE, defaultOrMaker: $0.Status.Success, valueOf: $0.Status.valueOf, enumValues: $0.Status.values) + ..e(1, 'msg', $pb.PbFieldType.OE, + defaultOrMaker: WiFiScanMsgType.TypeCmdScanStart, + valueOf: WiFiScanMsgType.valueOf, + enumValues: WiFiScanMsgType.values) + ..e<$0.Status>(2, 'status', $pb.PbFieldType.OE, + defaultOrMaker: $0.Status.Success, + valueOf: $0.Status.valueOf, + enumValues: $0.Status.values) ..aOM(10, 'cmdScanStart', subBuilder: CmdScanStart.create) ..aOM(11, 'respScanStart', subBuilder: RespScanStart.create) ..aOM(12, 'cmdScanStatus', subBuilder: CmdScanStatus.create) - ..aOM(13, 'respScanStatus', subBuilder: RespScanStatus.create) + ..aOM(13, 'respScanStatus', + subBuilder: RespScanStatus.create) ..aOM(14, 'cmdScanResult', subBuilder: CmdScanResult.create) - ..aOM(15, 'respScanResult', subBuilder: RespScanResult.create) - ..hasRequiredFields = false - ; + ..aOM(15, 'respScanResult', + subBuilder: RespScanResult.create) + ..hasRequiredFields = false; WiFiScanPayload._() : super(); factory WiFiScanPayload() => create(); - factory WiFiScanPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory WiFiScanPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory WiFiScanPayload.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory WiFiScanPayload.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); WiFiScanPayload clone() => WiFiScanPayload()..mergeFromMessage(this); - WiFiScanPayload copyWith(void Function(WiFiScanPayload) updates) => super.copyWith((message) => updates(message as WiFiScanPayload)); + WiFiScanPayload copyWith(void Function(WiFiScanPayload) updates) => + super.copyWith((message) => updates(message as WiFiScanPayload)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static WiFiScanPayload create() => WiFiScanPayload._(); WiFiScanPayload createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static WiFiScanPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static WiFiScanPayload getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static WiFiScanPayload _defaultInstance; - WiFiScanPayload_Payload whichPayload() => _WiFiScanPayload_PayloadByTag[$_whichOneof(0)]; + WiFiScanPayload_Payload whichPayload() => + _WiFiScanPayload_PayloadByTag[$_whichOneof(0)]; void clearPayload() => clearField($_whichOneof(0)); @$pb.TagNumber(1) WiFiScanMsgType get msg => $_getN(0); @$pb.TagNumber(1) - set msg(WiFiScanMsgType v) { setField(1, v); } + set msg(WiFiScanMsgType v) { + setField(1, v); + } + @$pb.TagNumber(1) $core.bool hasMsg() => $_has(0); @$pb.TagNumber(1) @@ -359,7 +471,10 @@ class WiFiScanPayload extends $pb.GeneratedMessage { @$pb.TagNumber(2) $0.Status get status => $_getN(1); @$pb.TagNumber(2) - set status($0.Status v) { setField(2, v); } + set status($0.Status v) { + setField(2, v); + } + @$pb.TagNumber(2) $core.bool hasStatus() => $_has(1); @$pb.TagNumber(2) @@ -368,7 +483,10 @@ class WiFiScanPayload extends $pb.GeneratedMessage { @$pb.TagNumber(10) CmdScanStart get cmdScanStart => $_getN(2); @$pb.TagNumber(10) - set cmdScanStart(CmdScanStart v) { setField(10, v); } + set cmdScanStart(CmdScanStart v) { + setField(10, v); + } + @$pb.TagNumber(10) $core.bool hasCmdScanStart() => $_has(2); @$pb.TagNumber(10) @@ -379,7 +497,10 @@ class WiFiScanPayload extends $pb.GeneratedMessage { @$pb.TagNumber(11) RespScanStart get respScanStart => $_getN(3); @$pb.TagNumber(11) - set respScanStart(RespScanStart v) { setField(11, v); } + set respScanStart(RespScanStart v) { + setField(11, v); + } + @$pb.TagNumber(11) $core.bool hasRespScanStart() => $_has(3); @$pb.TagNumber(11) @@ -390,7 +511,10 @@ class WiFiScanPayload extends $pb.GeneratedMessage { @$pb.TagNumber(12) CmdScanStatus get cmdScanStatus => $_getN(4); @$pb.TagNumber(12) - set cmdScanStatus(CmdScanStatus v) { setField(12, v); } + set cmdScanStatus(CmdScanStatus v) { + setField(12, v); + } + @$pb.TagNumber(12) $core.bool hasCmdScanStatus() => $_has(4); @$pb.TagNumber(12) @@ -401,7 +525,10 @@ class WiFiScanPayload extends $pb.GeneratedMessage { @$pb.TagNumber(13) RespScanStatus get respScanStatus => $_getN(5); @$pb.TagNumber(13) - set respScanStatus(RespScanStatus v) { setField(13, v); } + set respScanStatus(RespScanStatus v) { + setField(13, v); + } + @$pb.TagNumber(13) $core.bool hasRespScanStatus() => $_has(5); @$pb.TagNumber(13) @@ -412,7 +539,10 @@ class WiFiScanPayload extends $pb.GeneratedMessage { @$pb.TagNumber(14) CmdScanResult get cmdScanResult => $_getN(6); @$pb.TagNumber(14) - set cmdScanResult(CmdScanResult v) { setField(14, v); } + set cmdScanResult(CmdScanResult v) { + setField(14, v); + } + @$pb.TagNumber(14) $core.bool hasCmdScanResult() => $_has(6); @$pb.TagNumber(14) @@ -423,7 +553,10 @@ class WiFiScanPayload extends $pb.GeneratedMessage { @$pb.TagNumber(15) RespScanResult get respScanResult => $_getN(7); @$pb.TagNumber(15) - set respScanResult(RespScanResult v) { setField(15, v); } + set respScanResult(RespScanResult v) { + setField(15, v); + } + @$pb.TagNumber(15) $core.bool hasRespScanResult() => $_has(7); @$pb.TagNumber(15) @@ -431,4 +564,3 @@ class WiFiScanPayload extends $pb.GeneratedMessage { @$pb.TagNumber(15) RespScanResult ensureRespScanResult() => $_ensure(7); } - diff --git a/lib/src/proto/dart/wifi_scan.pbenum.dart b/lib/src/proto/dart/wifi_scan.pbenum.dart index 6247bcb..fc93034 100644 --- a/lib/src/proto/dart/wifi_scan.pbenum.dart +++ b/lib/src/proto/dart/wifi_scan.pbenum.dart @@ -10,14 +10,20 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; class WiFiScanMsgType extends $pb.ProtobufEnum { - static const WiFiScanMsgType TypeCmdScanStart = WiFiScanMsgType._(0, 'TypeCmdScanStart'); - static const WiFiScanMsgType TypeRespScanStart = WiFiScanMsgType._(1, 'TypeRespScanStart'); - static const WiFiScanMsgType TypeCmdScanStatus = WiFiScanMsgType._(2, 'TypeCmdScanStatus'); - static const WiFiScanMsgType TypeRespScanStatus = WiFiScanMsgType._(3, 'TypeRespScanStatus'); - static const WiFiScanMsgType TypeCmdScanResult = WiFiScanMsgType._(4, 'TypeCmdScanResult'); - static const WiFiScanMsgType TypeRespScanResult = WiFiScanMsgType._(5, 'TypeRespScanResult'); + static const WiFiScanMsgType TypeCmdScanStart = + WiFiScanMsgType._(0, 'TypeCmdScanStart'); + static const WiFiScanMsgType TypeRespScanStart = + WiFiScanMsgType._(1, 'TypeRespScanStart'); + static const WiFiScanMsgType TypeCmdScanStatus = + WiFiScanMsgType._(2, 'TypeCmdScanStatus'); + static const WiFiScanMsgType TypeRespScanStatus = + WiFiScanMsgType._(3, 'TypeRespScanStatus'); + static const WiFiScanMsgType TypeCmdScanResult = + WiFiScanMsgType._(4, 'TypeCmdScanResult'); + static const WiFiScanMsgType TypeRespScanResult = + WiFiScanMsgType._(5, 'TypeRespScanResult'); - static const $core.List values = [ + static const $core.List values = [ TypeCmdScanStart, TypeRespScanStart, TypeCmdScanStatus, @@ -26,9 +32,9 @@ class WiFiScanMsgType extends $pb.ProtobufEnum { TypeRespScanResult, ]; - static final $core.Map<$core.int, WiFiScanMsgType> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, WiFiScanMsgType> _byValue = + $pb.ProtobufEnum.initByValue(values); static WiFiScanMsgType valueOf($core.int value) => _byValue[value]; const WiFiScanMsgType._($core.int v, $core.String n) : super(v, n); } - diff --git a/lib/src/proto/dart/wifi_scan.pbjson.dart b/lib/src/proto/dart/wifi_scan.pbjson.dart index f447aee..58042f7 100644 --- a/lib/src/proto/dart/wifi_scan.pbjson.dart +++ b/lib/src/proto/dart/wifi_scan.pbjson.dart @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: wifi_scan.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type const WiFiScanMsgType$json = const { @@ -22,7 +22,13 @@ const CmdScanStart$json = const { '2': const [ const {'1': 'blocking', '3': 1, '4': 1, '5': 8, '10': 'blocking'}, const {'1': 'passive', '3': 2, '4': 1, '5': 8, '10': 'passive'}, - const {'1': 'group_channels', '3': 3, '4': 1, '5': 13, '10': 'groupChannels'}, + const { + '1': 'group_channels', + '3': 3, + '4': 1, + '5': 13, + '10': 'groupChannels' + }, const {'1': 'period_ms', '3': 4, '4': 1, '5': 13, '10': 'periodMs'}, ], }; @@ -58,31 +64,106 @@ const WiFiScanResult$json = const { const {'1': 'channel', '3': 2, '4': 1, '5': 13, '10': 'channel'}, const {'1': 'rssi', '3': 3, '4': 1, '5': 5, '10': 'rssi'}, const {'1': 'bssid', '3': 4, '4': 1, '5': 12, '10': 'bssid'}, - const {'1': 'auth', '3': 5, '4': 1, '5': 14, '6': '.WifiAuthMode', '10': 'auth'}, + const { + '1': 'auth', + '3': 5, + '4': 1, + '5': 14, + '6': '.WifiAuthMode', + '10': 'auth' + }, ], }; const RespScanResult$json = const { '1': 'RespScanResult', '2': const [ - const {'1': 'entries', '3': 1, '4': 3, '5': 11, '6': '.WiFiScanResult', '10': 'entries'}, + const { + '1': 'entries', + '3': 1, + '4': 3, + '5': 11, + '6': '.WiFiScanResult', + '10': 'entries' + }, ], }; const WiFiScanPayload$json = const { '1': 'WiFiScanPayload', '2': const [ - const {'1': 'msg', '3': 1, '4': 1, '5': 14, '6': '.WiFiScanMsgType', '10': 'msg'}, - const {'1': 'status', '3': 2, '4': 1, '5': 14, '6': '.Status', '10': 'status'}, - const {'1': 'cmd_scan_start', '3': 10, '4': 1, '5': 11, '6': '.CmdScanStart', '9': 0, '10': 'cmdScanStart'}, - const {'1': 'resp_scan_start', '3': 11, '4': 1, '5': 11, '6': '.RespScanStart', '9': 0, '10': 'respScanStart'}, - const {'1': 'cmd_scan_status', '3': 12, '4': 1, '5': 11, '6': '.CmdScanStatus', '9': 0, '10': 'cmdScanStatus'}, - const {'1': 'resp_scan_status', '3': 13, '4': 1, '5': 11, '6': '.RespScanStatus', '9': 0, '10': 'respScanStatus'}, - const {'1': 'cmd_scan_result', '3': 14, '4': 1, '5': 11, '6': '.CmdScanResult', '9': 0, '10': 'cmdScanResult'}, - const {'1': 'resp_scan_result', '3': 15, '4': 1, '5': 11, '6': '.RespScanResult', '9': 0, '10': 'respScanResult'}, + const { + '1': 'msg', + '3': 1, + '4': 1, + '5': 14, + '6': '.WiFiScanMsgType', + '10': 'msg' + }, + const { + '1': 'status', + '3': 2, + '4': 1, + '5': 14, + '6': '.Status', + '10': 'status' + }, + const { + '1': 'cmd_scan_start', + '3': 10, + '4': 1, + '5': 11, + '6': '.CmdScanStart', + '9': 0, + '10': 'cmdScanStart' + }, + const { + '1': 'resp_scan_start', + '3': 11, + '4': 1, + '5': 11, + '6': '.RespScanStart', + '9': 0, + '10': 'respScanStart' + }, + const { + '1': 'cmd_scan_status', + '3': 12, + '4': 1, + '5': 11, + '6': '.CmdScanStatus', + '9': 0, + '10': 'cmdScanStatus' + }, + const { + '1': 'resp_scan_status', + '3': 13, + '4': 1, + '5': 11, + '6': '.RespScanStatus', + '9': 0, + '10': 'respScanStatus' + }, + const { + '1': 'cmd_scan_result', + '3': 14, + '4': 1, + '5': 11, + '6': '.CmdScanResult', + '9': 0, + '10': 'cmdScanResult' + }, + const { + '1': 'resp_scan_result', + '3': 15, + '4': 1, + '5': 11, + '6': '.RespScanResult', + '9': 0, + '10': 'respScanResult' + }, ], '8': const [ const {'1': 'payload'}, ], }; - diff --git a/lib/src/proto/dart/wifi_scan.pbserver.dart b/lib/src/proto/dart/wifi_scan.pbserver.dart index 73dfe01..01727e0 100644 --- a/lib/src/proto/dart/wifi_scan.pbserver.dart +++ b/lib/src/proto/dart/wifi_scan.pbserver.dart @@ -2,8 +2,7 @@ // Generated code. Do not modify. // source: wifi_scan.proto // -// @dart = 2.3 +// // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type export 'wifi_scan.pb.dart'; - diff --git a/lib/src/security.dart b/lib/src/security.dart index 48910ad..e2ccacc 100644 --- a/lib/src/security.dart +++ b/lib/src/security.dart @@ -10,9 +10,9 @@ enum SecurityState { } abstract class ProvSecurity { - Future encrypt(Uint8List data); + Future encrypt(dynamic data); - Future decrypt(Uint8List data); + Future decrypt(dynamic data); Future securitySession(SessionData responseData); } diff --git a/lib/src/security1.dart b/lib/src/security1.dart index 970d80d..76c5de3 100644 --- a/lib/src/security1.dart +++ b/lib/src/security1.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:developer' as developer; import 'dart:math'; import 'dart:typed_data'; import 'package:collection/collection.dart'; @@ -31,12 +32,12 @@ class Security1 implements ProvSecurity { } } - Future encrypt(Uint8List data) async { + Future encrypt(dynamic data) async { _verbose('raw before process ${data.toString()}'); return crypt.crypt(data); } - Future decrypt(Uint8List data) async { + Future decrypt(dynamic data) async { return encrypt(data); } @@ -55,6 +56,7 @@ class Security1 implements ProvSecurity { } Future securitySession(SessionData responseData) async { + developer.log("SESSION STATE $sessionState"); if (sessionState == SecurityState.REQUEST1) { sessionState = SecurityState.RESPONSE1_REQUEST2; return await setup0Request(); @@ -73,38 +75,43 @@ class Security1 implements ProvSecurity { } Future setup0Request() async { + developer.log("SET UP 0 REQUEST"); _verbose('setup0Request'); var setupRequest = new SessionData(); setupRequest.secVer = SecSchemeVersion.SecScheme1; await _generateKey(); + developer.log("GENERATE KEY COMPLETE"); SessionCmd0 sc0 = SessionCmd0(); - List temp = await clientKey.extractPublicKey().then((value) => value.bytes); + List temp = + await clientKey?.extractPublicKey().then((value) => value.bytes) ?? []; + developer.log("EXTRACT PUBLIC KEY COMPLETE $temp"); + sc0.clientPubkey = temp; // await clientKey.extractPublicKey().byte; Sec1Payload sec1 = Sec1Payload(); sec1.sc0 = sc0; setupRequest.sec1 = sec1; - _verbose( - 'setup0Request: clientPubkey = ${temp.toString()}'); + _verbose('setup0Request: clientPubkey = ${temp.toString()}'); + developer.log("SET UP REQUEST $setupRequest"); return setupRequest; } Future setup0Response(SessionData responseData) async { SessionData setupResp = responseData; - if (setupResp.secVer != SecSchemeVersion.SecScheme1) { + if (setupResp?.secVer != SecSchemeVersion.SecScheme1) { throw Exception('Invalid sec scheme'); } - devicePublicKey = SimplePublicKey(setupResp.sec1.sr0.devicePubkey,type: x25519.keyPairType); - deviceRandom = setupResp.sec1.sr0.deviceRandom; + devicePublicKey = SimplePublicKey(setupResp?.sec1.sr0.devicePubkey ?? [], + type: x25519.keyPairType); + deviceRandom = Uint8List.fromList(setupResp?.sec1.sr0.deviceRandom ?? []); _verbose( - 'setup0Response:Device public key ${devicePublicKey.bytes.toString()}'); + 'setup0Response:Device public key ${devicePublicKey?.bytes.toString()}'); _verbose('setup0Response:Device random ${deviceRandom.toString()}'); final sharedKey = await x25519.sharedSecretKey( - keyPair: clientKey, - remotePublicKey: devicePublicKey); + keyPair: clientKey, remotePublicKey: devicePublicKey); var sharedK = await sharedKey.extractBytes(); _verbose('setup0Response: Shared key calculated: ${sharedK.toString()}'); if (pop != null) { @@ -112,19 +119,21 @@ class Security1 implements ProvSecurity { sink.add(utf8.encode(pop)); sink.close(); final hash = await sink.hash(); - sharedK = _xor(Uint8List.fromList(sharedK), Uint8List.fromList(hash.bytes)); + sharedK = + _xor(Uint8List.fromList(sharedK), Uint8List.fromList(hash.bytes)); _verbose( 'setup0Response: pop: $pop, hash: ${hash.bytes.toString()} sharedK: ${sharedK.toString()}'); } - await crypt.init(sharedK, deviceRandom); + await crypt.init(Uint8List.fromList(sharedK), deviceRandom); _verbose( 'setup0Response: cipherSecretKey: ${sharedK.toString()} cipherNonce: ${deviceRandom.toString()}'); return setupResp; } Future setup1Request(SessionData responseData) async { - _verbose('setup1Request ${devicePublicKey.bytes.toString()}'); - var clientVerify = await encrypt(devicePublicKey.bytes); + _verbose('setup1Request ${devicePublicKey?.bytes.toString()}'); + var clientVerify = + await encrypt(Uint8List.fromList(devicePublicKey?.bytes ?? [])); _verbose('client verify ${clientVerify.toString()}'); var setupRequest = SessionData(); @@ -141,14 +150,17 @@ class Security1 implements ProvSecurity { Future setup1Response(SessionData responseData) async { _verbose('setup1Response'); var setupResp = responseData; - if (setupResp.secVer == SecSchemeVersion.SecScheme1) { - final deviceVerify = setupResp.sec1.sr1.deviceVerifyData; + if (setupResp?.secVer == SecSchemeVersion.SecScheme1) { + final deviceVerify = setupResp?.sec1.sr1.deviceVerifyData ?? []; _verbose('Device verify: ${deviceVerify.toString()}'); - final encClientPubkey = - await decrypt(setupResp.sec1.sr1.deviceVerifyData); + + final encClientPubkey = await decrypt( + Uint8List.fromList(setupResp?.sec1.sr1.deviceVerifyData ?? [])); _verbose('Enc client pubkey: ${encClientPubkey.toString()}'); Function eq = const ListEquality().equals; - List temp = await clientKey.extractPublicKey().then((value) => value.bytes); + List temp = + await clientKey?.extractPublicKey().then((value) => value.bytes) ?? + []; if (!eq(encClientPubkey, temp)) { throw Exception('Mismatch in device verify'); } @@ -156,4 +168,4 @@ class Security1 implements ProvSecurity { } throw Exception('Unsupported security protocol'); } -} \ No newline at end of file +} diff --git a/lib/src/transport_ble.dart b/lib/src/transport_ble.dart index e4f0955..63f7e3d 100644 --- a/lib/src/transport_ble.dart +++ b/lib/src/transport_ble.dart @@ -1,37 +1,58 @@ import 'dart:async'; +import 'dart:developer'; import 'dart:typed_data'; import 'package:flutter_ble_lib/flutter_ble_lib.dart'; - +// import 'package:flutter_blue/flutter_blue.dart'; import 'transport.dart'; class TransportBLE implements ProvTransport { final Peripheral peripheral; + // final BluetoothDevice bluetoothDevice; + // List services; final String serviceUUID; - Map nuLookup; + Map nuLookup = {}; final Map lockupTable; static const PROV_BLE_SERVICE = '021a9004-0382-4aea-bff4-6b3f1c5adfb4'; static const PROV_BLE_EP = { 'prov-scan': 'ff50', - 'prov-session': 'ff51', - 'prov-config': 'ff52', - 'proto-ver': 'ff53', + 'prov-session': '0001', + 'prov-config': '0002', + 'proto-ver': '0003', 'custom-data': 'ff54', }; + // {"prov-session", 0x0001}, + // {"prov-config", 0x0002}, + // {"proto-ver", 0x0003}, + TransportBLE(this.peripheral, {this.serviceUUID = PROV_BLE_SERVICE, this.lockupTable = PROV_BLE_EP}) { nuLookup = new Map(); for (var name in lockupTable.keys) { - var charsInt = int.parse(lockupTable[name], radix: 16); - var serviceHex = charsInt.toRadixString(16).padLeft(4, '0'); - nuLookup[name] = - serviceUUID.substring(0, 4) + serviceHex + serviceUUID.substring(8); + var charsInt = lockupTable[name] == null + ? null + : int.parse(lockupTable[name], radix: 16); + var serviceHex = charsInt?.toRadixString(16).padLeft(4, '0'); + if (charsInt != null && serviceHex != null) { + nuLookup[name] = + serviceUUID.substring(0, 4) + serviceHex + serviceUUID.substring(8); + } } } Future connect() async { + // bluetoothDevice.state.listen((state) async { + // if (state == BluetoothDeviceState.connected) { + // Future.value(true); + // } else { + // await bluetoothDevice.connect(autoConnect: false); + // await bluetoothDevice.requestMtu(512); + // services = await bluetoothDevice.discoverServices(); + // } + // }); + bool isConnected = await peripheral.isConnected(); if (isConnected) { return Future.value(true); @@ -43,28 +64,68 @@ class TransportBLE implements ProvTransport { } Future sendReceive(String epName, Uint8List data) async { - if (data != null){ - if( data.length > 0){ - await peripheral.writeCharacteristic(serviceUUID, nuLookup[epName??""], data, true); + log("EP NAME $epName DATA $data"); + if (data != null) { + if (data.length > 0) { + // BluetoothService service = services.firstWhere( + // (s) => s.uuid.toString() == serviceUUID, + // orElse: () => null); + // if (service != null) { + // BluetoothCharacteristic characteristic = service.characteristics + // .firstWhere((c) => c.uuid.toString() == nuLookup[epName ?? ""], + // orElse: () => null); + // characteristic.write(data); + // } + var res = await peripheral.writeCharacteristic( + serviceUUID, nuLookup[epName ?? ""], data, true); + log("CHARACTERISTIC $res"); } } + + // BluetoothService service = services.firstWhere( + // (s) => s.uuid.toString() == serviceUUID, + // orElse: () => null); + // if (service != null) { + // BluetoothCharacteristic characteristic = service.characteristics + // .firstWhere((c) => c.uuid.toString() == nuLookup[epName ?? ""], + // orElse: () => null); + // await characteristic.write(data); + // return characteristic.read(); + // } + CharacteristicWithValue receivedData = await peripheral.readCharacteristic( - serviceUUID, nuLookup[epName??""], + serviceUUID, nuLookup[epName ?? ""], transactionId: 'readCharacteristic'); return receivedData.value; } Future disconnect() async { + // bluetoothDevice.state.listen((state) async { + // if (state == BluetoothDeviceState.connected) { + // return await bluetoothDevice.disconnect(); + // } else { + // return; + // } + // }); + bool check = await peripheral.isConnected(); - if(check){ + if (check) { return await peripheral.disconnectOrCancelConnection(); - }else{ + } else { return; } } Future checkConnect() async { + log("INSIDE CHECK CONNECT FUNCTION"); return await peripheral.isConnected(); + // bluetoothDevice.state.listen((state) async { + // if (state == BluetoothDeviceState.connected) { + // return true; + // } else { + // return false; + // } + // }); } void dispose() { diff --git a/pubspec.lock b/pubspec.lock index e432cf5..7016b57 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,28 +21,21 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: "direct main" description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" crypto: dependency: transitive description: @@ -63,7 +56,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" fixnum: dependency: transitive description: @@ -79,10 +72,10 @@ packages: flutter_ble_lib: dependency: "direct main" description: - name: flutter_ble_lib - url: "https://pub.dartlang.org" - source: hosted - version: "2.3.2" + path: "../FlutterBleLib" + relative: true + source: path + version: "2.4.0" flutter_test: dependency: "direct dev" description: flutter @@ -101,21 +94,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" protobuf: dependency: "direct main" description: @@ -134,7 +134,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -155,21 +155,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.12" typed_data: dependency: transitive description: @@ -183,7 +183,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=1.10.0" diff --git a/pubspec.yaml b/pubspec.yaml index 6605689..dba01f4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,8 @@ name: esp_provisioning description: Espressif Provisioning library version: 1.0.0+6 homepage: https://github.com/sunshine-tech/esp_provisioning.git -author: Tuan PM +# author: Tuan PM +publish_to: none environment: sdk: ">=2.7.0 <3.0.0" @@ -14,7 +15,11 @@ dependencies: protobuf: ^2.0.0 cryptography: ^2.0.1 collection: ^1.15.0 - flutter_ble_lib: ^2.3.2 + # flutter_blue: ^0.8.0 + flutter_ble_lib: + path: ../FlutterBleLib/ + # git: + # url: https://github.com/villageenergy/FlutterBleLib.git dev_dependencies: @@ -30,3 +35,6 @@ flutter: pluginClass: EspProvisioningPlugin ios: pluginClass: EspProvisioningPlugin + +module: + androidX: true \ No newline at end of file diff --git a/test/esp_provisioning_test.dart b/test/esp_provisioning_test.dart index d4fdc72..48e0436 100644 --- a/test/esp_provisioning_test.dart +++ b/test/esp_provisioning_test.dart @@ -5,7 +5,7 @@ import 'package:esp_provisioning/esp_provisioning.dart'; void main() { const MethodChannel channel = MethodChannel('esp_provisioning'); - TestWidgetsFlutterBinding.ensureInitialized(); + // TestWidgetsFlutterBinding.ensureInitialized(); setUp(() { channel.setMockMethodCallHandler((MethodCall methodCall) async { @@ -17,6 +17,5 @@ void main() { channel.setMockMethodCallHandler(null); }); - test('getPlatformVersion', () async { - }); + test('getPlatformVersion', () async {}); } From a7d2d2f8b17165772ccdd19728e0e6069a65abbb Mon Sep 17 00:00:00 2001 From: Sakina Boriwala Date: Tue, 14 Feb 2023 11:17:53 +0530 Subject: [PATCH 2/7] Flutter Ble Lib Removed and Flutter Blue Plus added --- example/lib/ble_screen/ble_bloc.dart | 28 +++++---- example/lib/ble_screen/ble_device.dart | 12 ++-- example/lib/ble_service.dart | 83 +++++++++++++------------- example/pubspec.lock | 29 +++++---- example/pubspec.yaml | 6 +- lib/src/transport_ble.dart | 76 +++++++++++++++++------ pubspec.lock | 30 +++++++--- pubspec.yaml | 7 ++- 8 files changed, 168 insertions(+), 103 deletions(-) diff --git a/example/lib/ble_screen/ble_bloc.dart b/example/lib/ble_screen/ble_bloc.dart index a8fa11c..2fa3887 100644 --- a/example/lib/ble_screen/ble_bloc.dart +++ b/example/lib/ble_screen/ble_bloc.dart @@ -1,14 +1,14 @@ import 'dart:async'; import 'package:bloc/bloc.dart'; import 'package:esp_provisioning_example/ble_service.dart'; -import 'package:flutter_ble_lib/flutter_ble_lib.dart'; +import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:rxdart/rxdart.dart'; import 'ble.dart'; class BleBloc extends Bloc { var bleService = BleService.getInstance(); - StreamSubscription _scanSubscription; - List> bleDevices = new List>(); + StreamSubscription> _scanSubscription; + List> bleDevices = []; BleBloc() : super(BleStateLoading()) { on((event, emit) async { @@ -52,7 +52,7 @@ class BleBloc extends Bloc { return; } var bleState = await bleService.start(); - if (bleState == BluetoothState.UNAUTHORIZED) { + if (bleState == BluetoothState.unauthorized) { add(BleEventPermissionDenied()); return; } @@ -60,17 +60,19 @@ class BleBloc extends Bloc { _scanSubscription = bleService .scanBle() .debounce((_) => TimerStream(true, Duration(milliseconds: 100))) - .listen((ScanResult scanResult) { - var bleDevice = BleDevice(scanResult); - if (scanResult.advertisementData.localName != null) { - var idx = bleDevices.indexWhere((e) => e['id'] == bleDevice.id); + .listen((List scanResult) { + for (int i = 0; i < scanResult.length; i++) { + var bleDevice = BleDevice(scanResult[i]); + if (scanResult[i].advertisementData.localName != null) { + var idx = bleDevices.indexWhere((e) => e['id'] == bleDevice.id); - if (idx < 0) { - bleDevices.add(bleDevice.toMap()); - } else { - bleDevices[idx] = bleDevice.toMap(); + if (idx < 0) { + bleDevices.add(bleDevice.toMap()); + } else { + bleDevices[idx] = bleDevice.toMap(); + } + add(BleEventDeviceUpdated(bleDevices)); } - add(BleEventDeviceUpdated(bleDevices)); } }); } diff --git a/example/lib/ble_screen/ble_device.dart b/example/lib/ble_screen/ble_device.dart index fe38441..648e524 100644 --- a/example/lib/ble_screen/ble_device.dart +++ b/example/lib/ble_screen/ble_device.dart @@ -1,16 +1,18 @@ import 'package:collection/collection.dart'; -import 'package:flutter_ble_lib/flutter_ble_lib.dart'; +import 'package:flutter_blue_plus/flutter_blue_plus.dart'; class BleDevice { - final Peripheral peripheral; + final BluetoothDevice peripheral; final String name; int rssi; - String get id => peripheral.identifier; + String get id => peripheral.id.id; BleDevice(ScanResult scanResult) - : peripheral = scanResult.peripheral, - name = scanResult.peripheral.name ?? scanResult.advertisementData.localName ?? "Unknown", + : peripheral = scanResult.device, + name = scanResult.device.name ?? + scanResult.advertisementData.localName ?? + "Unknown", rssi = scanResult.rssi; @override diff --git a/example/lib/ble_service.dart b/example/lib/ble_service.dart index f094e12..98d89fd 100644 --- a/example/lib/ble_service.dart +++ b/example/lib/ble_service.dart @@ -1,7 +1,7 @@ import 'dart:async'; // import 'dart:html'; import 'dart:io'; -import 'package:flutter_ble_lib/flutter_ble_lib.dart'; +import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:esp_provisioning/esp_provisioning.dart'; import 'package:logger/logger.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -11,11 +11,12 @@ import 'package:rxdart/rxdart.dart'; class BleService { static BleService _instance; - static BleManager _bleManager; + // static BleManager _bleManager; + static FlutterBluePlus _bleManager; static Logger log; bool _isPowerOn = false; StreamSubscription _stateSubscription; - Peripheral selectedPeripheral; + BluetoothDevice selectedPeripheral; List serviceUUIDs; static BleService getInstance() { @@ -24,7 +25,7 @@ class BleService { } if (_bleManager == null) { - _bleManager = BleManager(); + _bleManager = FlutterBluePlus.instance; log = Logger(printer: PrettyPrinter()); } log.v('BleService started'); @@ -44,26 +45,27 @@ class BleService { } log.v('createClient'); - await _bleManager.createClient( - restoreStateIdentifier: "example-ble-client-id", - restoreStateAction: (peripherals) { - peripherals?.forEach((peripheral) { - log.v("Restored peripheral: ${peripheral.name}"); - selectedPeripheral = peripheral; - }); - }); - - // if (Platform.isAndroid) { - log.v('enableRadio'); - // await _bleManager.enableRadio(); - // } + + // await _bleManager.createClient( + // restoreStateIdentifier: "example-ble-client-id", + // restoreStateAction: (peripherals) { + // peripherals?.forEach((peripheral) { + // log.v("Restored peripheral: ${peripheral.name}"); + // selectedPeripheral = peripheral; + // }); + // }); + + if (Platform.isAndroid) { + log.v('enableRadio'); + await _bleManager.turnOn(); + } try { BluetoothState state = await _waitForBluetoothPoweredOn(); - _isPowerOn = state == BluetoothState.POWERED_ON; + _isPowerOn = state == BluetoothState.on; if (!_isPowerOn) { if (Platform.isAndroid) { - await _bleManager.enableRadio(); + await _bleManager.turnOn(); _isPowerOn = true; } } @@ -71,13 +73,13 @@ class BleService { } catch (e) { log.e('Error ${e.toString()}'); } - return BluetoothState.UNKNOWN; + return BluetoothState.unknown; } - void select(Peripheral peripheral) async { - bool _check = await selectedPeripheral?.isConnected(); + void select(BluetoothDevice peripheral) async { + bool _check = (await _bleManager.connectedDevices).contains(peripheral); if (_check == true) { - await selectedPeripheral?.disconnectOrCancelConnection(); + await selectedPeripheral?.disconnect(); } selectedPeripheral = peripheral; log.v('selectedPeripheral = $selectedPeripheral'); @@ -90,38 +92,39 @@ class BleService { _isPowerOn = false; stopScanBle(); await _stateSubscription?.cancel(); - bool _check = await selectedPeripheral?.isConnected(); + bool _check = + (await _bleManager.connectedDevices).contains(selectedPeripheral); if (_check == true) { - await selectedPeripheral?.disconnectOrCancelConnection(); + await selectedPeripheral?.disconnect(); } if (Platform.isAndroid) { - await _bleManager.disableRadio(); + await _bleManager.turnOff(); } - await _bleManager.destroyClient(); + // await _bleManager.destroyClient(); return true; } - Stream scanBle() { - stopScanBle(); - return _bleManager.startPeripheralScan( - uuids: [TransportBLE.PROV_BLE_SERVICE], + Stream> scanBle() { + _bleManager.startScan( scanMode: ScanMode.balanced, - allowDuplicates: true); + allowDuplicates: true, + withServices: [Guid(TransportBLE.PROV_BLE_SERVICE)]); + return _bleManager.scanResults; } Future stopScanBle() { - return _bleManager.stopPeripheralScan(); + return _bleManager.stopScan(); } Future startProvisioning( - {Peripheral peripheral, String pop = '6953327194'}) async { + {BluetoothDevice peripheral, String pop = 'abcd1234'}) async { if (!_isPowerOn) { await _waitForBluetoothPoweredOn(); } - Peripheral p = peripheral ?? selectedPeripheral; + BluetoothDevice p = peripheral ?? selectedPeripheral; log.v('peripheral here $p'); - await _bleManager.stopPeripheralScan(); + await _bleManager.stopScan(); log.v('STOPPPED PERIPHERAL SCAN ========'); EspProv prov = @@ -136,13 +139,11 @@ class BleService { Future _waitForBluetoothPoweredOn() async { Completer completer = Completer(); _stateSubscription?.cancel(); - _stateSubscription = _bleManager - .observeBluetoothState(emitCurrentValue: true) - .listen((bluetoothState) async { + _stateSubscription = _bleManager.state.listen((bluetoothState) async { log.v('bluetoothState = $bluetoothState'); - if ((bluetoothState == BluetoothState.POWERED_ON || - bluetoothState == BluetoothState.UNAUTHORIZED) && + if ((bluetoothState == BluetoothState.on || + bluetoothState == BluetoothState.unauthorized) && !completer.isCompleted) { completer.complete(bluetoothState); } diff --git a/example/pubspec.lock b/example/pubspec.lock index aedcd0f..1bf10eb 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -43,6 +43,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.16.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.1" crypto: dependency: transitive description: @@ -97,13 +104,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_ble_lib: - dependency: transitive - description: - path: "../../FlutterBleLib" - relative: true - source: path - version: "2.4.0" flutter_bloc: dependency: "direct main" description: @@ -111,6 +111,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "8.1.1" + flutter_blue_plus: + dependency: "direct main" + description: + name: flutter_blue_plus + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" flutter_spinkit: dependency: "direct main" description: @@ -199,7 +206,7 @@ packages: name: protobuf url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" provider: dependency: transitive description: @@ -213,7 +220,7 @@ packages: name: rxdart url: "https://pub.dartlang.org" source: hosted - version: "0.26.0" + version: "0.27.7" sky_engine: dependency: transitive description: flutter @@ -276,5 +283,5 @@ packages: source: hosted version: "2.1.2" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=2.0.0" + dart: ">=2.18.0 <3.0.0" + flutter: ">=2.5.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index ab4d64a..52ba5a7 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -16,10 +16,10 @@ dependencies: logger: ^1.0.0 permission_handler: ^7.0.0 equatable: ^2.0.0 - rxdart: ^0.26.0 + rxdart: ^0.27.5 flutter_spinkit: ^5.0.0 - # location: ^4.4.0 - + # The following packages is integrated to scan and connect to BLE Device, this package is actively maintained as of Feb,2023. + flutter_blue_plus: ^1.4.0 cupertino_icons: ^1.0.2 dev_dependencies: diff --git a/lib/src/transport_ble.dart b/lib/src/transport_ble.dart index 63f7e3d..1ec6abb 100644 --- a/lib/src/transport_ble.dart +++ b/lib/src/transport_ble.dart @@ -1,14 +1,15 @@ import 'dart:async'; import 'dart:developer'; import 'dart:typed_data'; -import 'package:flutter_ble_lib/flutter_ble_lib.dart'; +import 'package:flutter_blue_plus/flutter_blue_plus.dart'; // import 'package:flutter_blue/flutter_blue.dart'; import 'transport.dart'; class TransportBLE implements ProvTransport { - final Peripheral peripheral; + final BluetoothDevice peripheral; // final BluetoothDevice bluetoothDevice; // List services; + final FlutterBluePlus bleManager = FlutterBluePlus.instance; final String serviceUUID; Map nuLookup = {}; final Map lockupTable; @@ -26,8 +27,11 @@ class TransportBLE implements ProvTransport { // {"prov-config", 0x0002}, // {"proto-ver", 0x0003}, - TransportBLE(this.peripheral, - {this.serviceUUID = PROV_BLE_SERVICE, this.lockupTable = PROV_BLE_EP}) { + TransportBLE( + this.peripheral, { + this.serviceUUID = PROV_BLE_SERVICE, + this.lockupTable = PROV_BLE_EP, + }) { nuLookup = new Map(); for (var name in lockupTable.keys) { @@ -53,14 +57,17 @@ class TransportBLE implements ProvTransport { // } // }); - bool isConnected = await peripheral.isConnected(); + bool isConnected = (await bleManager.connectedDevices).contains(peripheral); if (isConnected) { return Future.value(true); } - await peripheral.connect(requestMtu: 512); - await peripheral.discoverAllServicesAndCharacteristics( - transactionId: 'discoverAllServicesAndCharacteristics'); - return await peripheral.isConnected(); + await peripheral.connect(); + await peripheral.requestMtu(512); + + await peripheral.discoverServices(); + // discoverAllServicesAndCharacteristics( + // transactionId: 'discoverAllServicesAndCharacteristics'); + return (await bleManager.connectedDevices).contains(peripheral); } Future sendReceive(String epName, Uint8List data) async { @@ -76,9 +83,23 @@ class TransportBLE implements ProvTransport { // orElse: () => null); // characteristic.write(data); // } - var res = await peripheral.writeCharacteristic( - serviceUUID, nuLookup[epName ?? ""], data, true); - log("CHARACTERISTIC $res"); + List services = await peripheral.discoverServices(); + for (int i = 0; i < services.length; i++) { + if (services[i].uuid.toString() == serviceUUID) { + var characteristics = services[i].characteristics; + for (BluetoothCharacteristic c in characteristics) { + if (c.uuid.toString() == nuLookup[epName ?? ""]) { + log("WRITING DATA"); + await Future.delayed(const Duration(milliseconds: 500)); + var resp = await c.write(data); + log("RESPONSE $resp"); + } + } + } + } + // var res = await peripheral.writeCharacteristic( + // serviceUUID, nuLookup[epName ?? ""], data, true); + // log("CHARACTERISTIC $res"); } } @@ -93,10 +114,27 @@ class TransportBLE implements ProvTransport { // return characteristic.read(); // } - CharacteristicWithValue receivedData = await peripheral.readCharacteristic( - serviceUUID, nuLookup[epName ?? ""], - transactionId: 'readCharacteristic'); - return receivedData.value; + List services = await peripheral.discoverServices(); + for (int i = 0; i < services.length; i++) { + if (services[i].uuid.toString() == serviceUUID) { + var characteristics = services[i].characteristics; + for (BluetoothCharacteristic c in characteristics) { + if (c.uuid.toString() == nuLookup[epName ?? ""] && + c.properties.read) { + log("READ CHARACTERISTIC ${c.uuid.toString()} ${nuLookup[epName ?? ""]}"); + await Future.delayed(const Duration(milliseconds: 500)); + List value = await c.read(); + log("VALUE $value"); + return value; + } + } + } + } + + // List receivedData = await peripheral.readCharacteristic( + // serviceUUID, nuLookup[epName ?? ""], + // transactionId: 'readCharacteristic'); + // return receivedData.value; } Future disconnect() async { @@ -108,9 +146,9 @@ class TransportBLE implements ProvTransport { // } // }); - bool check = await peripheral.isConnected(); + bool check = (await bleManager.connectedDevices).contains(peripheral); if (check) { - return await peripheral.disconnectOrCancelConnection(); + return await peripheral.disconnect(); } else { return; } @@ -118,7 +156,7 @@ class TransportBLE implements ProvTransport { Future checkConnect() async { log("INSIDE CHECK CONNECT FUNCTION"); - return await peripheral.isConnected(); + return (await bleManager.connectedDevices).contains(peripheral); // bluetoothDevice.state.listen((state) async { // if (state == BluetoothDeviceState.connected) { // return true; diff --git a/pubspec.lock b/pubspec.lock index 7016b57..ede752b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -36,6 +36,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.16.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.1" crypto: dependency: transitive description: @@ -69,13 +76,13 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_ble_lib: + flutter_blue_plus: dependency: "direct main" description: - path: "../FlutterBleLib" - relative: true - source: path - version: "2.4.0" + name: flutter_blue_plus + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" flutter_test: dependency: "direct dev" description: flutter @@ -122,7 +129,14 @@ packages: name: protobuf url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" + rxdart: + dependency: transitive + description: + name: rxdart + url: "https://pub.dartlang.org" + source: hosted + version: "0.27.7" sky_engine: dependency: transitive description: flutter @@ -185,5 +199,5 @@ packages: source: hosted version: "2.1.2" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=1.10.0" + dart: ">=2.18.0 <3.0.0" + flutter: ">=2.5.0" diff --git a/pubspec.yaml b/pubspec.yaml index dba01f4..737d25f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,9 +15,10 @@ dependencies: protobuf: ^2.0.0 cryptography: ^2.0.1 collection: ^1.15.0 - # flutter_blue: ^0.8.0 - flutter_ble_lib: - path: ../FlutterBleLib/ + # The following packages is integrated to scan and connect to BLE Device, this package is actively maintained as of Feb,2023. + flutter_blue_plus: ^1.4.0 + # flutter_ble_lib: + # path: ../FlutterBleLib/ # git: # url: https://github.com/villageenergy/FlutterBleLib.git From 8c1182e21cf5fdef2199e89f96e4ebdf60c1793e Mon Sep 17 00:00:00 2001 From: Sakina Boriwala Date: Wed, 15 Feb 2023 16:35:53 +0530 Subject: [PATCH 3/7] Delay time increased to 1 second, more logs added --- lib/src/transport_ble.dart | 53 ++++++++++++-------------------------- 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/lib/src/transport_ble.dart b/lib/src/transport_ble.dart index 1ec6abb..48ba7d4 100644 --- a/lib/src/transport_ble.dart +++ b/lib/src/transport_ble.dart @@ -62,7 +62,7 @@ class TransportBLE implements ProvTransport { return Future.value(true); } await peripheral.connect(); - await peripheral.requestMtu(512); + // await peripheral.requestMtu(512); await peripheral.discoverServices(); // discoverAllServicesAndCharacteristics( @@ -71,70 +71,49 @@ class TransportBLE implements ProvTransport { } Future sendReceive(String epName, Uint8List data) async { + List services = await peripheral.discoverServices(); + log("EP NAME $epName DATA $data"); if (data != null) { if (data.length > 0) { - // BluetoothService service = services.firstWhere( - // (s) => s.uuid.toString() == serviceUUID, - // orElse: () => null); - // if (service != null) { - // BluetoothCharacteristic characteristic = service.characteristics - // .firstWhere((c) => c.uuid.toString() == nuLookup[epName ?? ""], - // orElse: () => null); - // characteristic.write(data); - // } - List services = await peripheral.discoverServices(); for (int i = 0; i < services.length; i++) { if (services[i].uuid.toString() == serviceUUID) { var characteristics = services[i].characteristics; for (BluetoothCharacteristic c in characteristics) { if (c.uuid.toString() == nuLookup[epName ?? ""]) { - log("WRITING DATA"); - await Future.delayed(const Duration(milliseconds: 500)); - var resp = await c.write(data); - log("RESPONSE $resp"); + log("WAIT FOR 2 SECONDS"); + await Future.delayed(const Duration(seconds: 1)); + log("WRITING DATA $i ${c.deviceId.toString()} ${c.uuid.toString()} ${c.serviceUuid.toString()} $data"); + + dynamic resp = await c.write(data, withoutResponse: false); + log("WRITING DATA RESPONSE $resp"); } } } } - // var res = await peripheral.writeCharacteristic( - // serviceUUID, nuLookup[epName ?? ""], data, true); - // log("CHARACTERISTIC $res"); } } - // BluetoothService service = services.firstWhere( - // (s) => s.uuid.toString() == serviceUUID, - // orElse: () => null); - // if (service != null) { - // BluetoothCharacteristic characteristic = service.characteristics - // .firstWhere((c) => c.uuid.toString() == nuLookup[epName ?? ""], - // orElse: () => null); - // await characteristic.write(data); - // return characteristic.read(); - // } - - List services = await peripheral.discoverServices(); + log("WRITE DATA COMPLETE, NOW READING"); + Uint8List readResponse; for (int i = 0; i < services.length; i++) { if (services[i].uuid.toString() == serviceUUID) { var characteristics = services[i].characteristics; for (BluetoothCharacteristic c in characteristics) { if (c.uuid.toString() == nuLookup[epName ?? ""] && c.properties.read) { + log("WAIT FOR 2 SECONDS"); + await Future.delayed(const Duration(seconds: 1)); log("READ CHARACTERISTIC ${c.uuid.toString()} ${nuLookup[epName ?? ""]}"); - await Future.delayed(const Duration(milliseconds: 500)); List value = await c.read(); log("VALUE $value"); - return value; + readResponse = value; } } } } - - // List receivedData = await peripheral.readCharacteristic( - // serviceUUID, nuLookup[epName ?? ""], - // transactionId: 'readCharacteristic'); - // return receivedData.value; + log("READ DATA COMPLETE, RESPONSE $readResponse"); + return readResponse; } Future disconnect() async { From f715f52c80120d41dc8fb3e4834df1bc112d51b5 Mon Sep 17 00:00:00 2001 From: Sakina Boriwala Date: Mon, 20 Feb 2023 16:37:29 +0530 Subject: [PATCH 4/7] log updated and wait time reduced to 300ms --- example/pubspec.lock | 135 +++++++++++++++++++++++-------------- lib/src/transport_ble.dart | 11 ++- pubspec.lock | 102 +++++++++++++++++----------- 3 files changed, 155 insertions(+), 93 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 1bf10eb..be63d5b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,77 +5,88 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.10.0" bloc: dependency: transitive description: name: bloc - url: "https://pub.dartlang.org" + sha256: bd4f8027bfa60d96c8046dec5ce74c463b2c918dce1b0d36593575995344534a + url: "https://pub.dev" source: hosted version: "8.1.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" source: hosted version: "1.2.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" source: hosted version: "3.1.1" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c + url: "https://pub.dev" source: hosted version: "3.0.1" cryptography: dependency: transitive description: name: cryptography - url: "https://pub.dartlang.org" + sha256: acb6725e6d5186ec61a1705ad83f4d43d9ff05fd7c2382c68b9d4fcce9596c00 + url: "https://pub.dev" source: hosted version: "2.0.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: caac504f942f41dfadcf45229ce8c47065b93919a12739f20d6173a883c5ec73 + url: "https://pub.dev" source: hosted version: "1.0.2" equatable: dependency: "direct main" description: name: equatable - url: "https://pub.dartlang.org" + sha256: "8867afc0f09dd9aff976817fbd94e9a35a3a2e58bef3b39a5376918321ec97a4" + url: "https://pub.dev" source: hosted version: "2.0.0" esp_provisioning: @@ -89,14 +100,16 @@ packages: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.dartlang.org" + sha256: "6a2ef17156f4dc49684f9d99aaf4a93aba8ac49f5eac861755f5730ddf6e2e4e" + url: "https://pub.dev" source: hosted version: "1.0.0" flutter: @@ -108,21 +121,24 @@ packages: dependency: "direct main" description: name: flutter_bloc - url: "https://pub.dartlang.org" + sha256: "890c51c8007f0182360e523518a0c732efb89876cb4669307af7efada5b55557" + url: "https://pub.dev" source: hosted version: "8.1.1" flutter_blue_plus: dependency: "direct main" description: name: flutter_blue_plus - url: "https://pub.dartlang.org" + sha256: "4e49b45d2f1ec9855826ed0af7d2b78b7d2a3e5743b3ae72aec59eb3790356d9" + url: "https://pub.dev" source: hosted version: "1.4.0" flutter_spinkit: dependency: "direct main" description: name: flutter_spinkit - url: "https://pub.dartlang.org" + sha256: bd4c27ac82bfece6b9dce68b23063f894cefbd9cb3af98743e488c01141f5461 + url: "https://pub.dev" source: hosted version: "5.0.0" flutter_test: @@ -134,91 +150,104 @@ packages: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "0.6.5" logger: dependency: "direct main" description: name: logger - url: "https://pub.dartlang.org" + sha256: "6a4002cf63953ea2fd6c50d9be53dc1d2c70ecc92711a5ac3d1d93ac409087ce" + url: "https://pub.dev" source: hosted version: "1.0.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.13" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted version: "1.8.0" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" source: hosted version: "1.0.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted version: "1.8.2" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://pub.dartlang.org" + sha256: "4412a3f9323a10638495e6a3f6f939adc7f515c3cae1baa9664fb9f90121c958" + url: "https://pub.dev" source: hosted version: "7.0.0" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - url: "https://pub.dartlang.org" + sha256: a5c6619326e5aea9a5fe4857f7632c255c40a7b299dcc6c9b8d187c58b7dc653 + url: "https://pub.dev" source: hosted version: "3.3.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: c2c49e16d42fd6983eb55e44b7f197fdf16b4da7aab7f8e1d21da307cad3fb02 + url: "https://pub.dev" source: hosted version: "2.0.0" protobuf: dependency: transitive description: name: protobuf - url: "https://pub.dartlang.org" + sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08" + url: "https://pub.dev" source: hosted version: "2.1.0" provider: dependency: transitive description: name: provider - url: "https://pub.dartlang.org" + sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + url: "https://pub.dev" source: hosted version: "6.0.5" rxdart: dependency: "direct main" description: name: rxdart - url: "https://pub.dartlang.org" + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.dev" source: hosted version: "0.27.7" sky_engine: @@ -230,58 +259,66 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.4.16" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" + url: "https://pub.dev" source: hosted version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" sdks: dart: ">=2.18.0 <3.0.0" flutter: ">=2.5.0" diff --git a/lib/src/transport_ble.dart b/lib/src/transport_ble.dart index 48ba7d4..aadc9f8 100644 --- a/lib/src/transport_ble.dart +++ b/lib/src/transport_ble.dart @@ -81,10 +81,9 @@ class TransportBLE implements ProvTransport { var characteristics = services[i].characteristics; for (BluetoothCharacteristic c in characteristics) { if (c.uuid.toString() == nuLookup[epName ?? ""]) { - log("WAIT FOR 2 SECONDS"); - await Future.delayed(const Duration(seconds: 1)); - log("WRITING DATA $i ${c.deviceId.toString()} ${c.uuid.toString()} ${c.serviceUuid.toString()} $data"); - + log("WAIT FOR 300 MILLISECONDS"); + await Future.delayed(const Duration(milliseconds: 300)); + log("WRITING DATA $i DEVICEID: ${c.deviceId.toString()} DEVICE UUID: ${c.uuid.toString()} SERVICE UUID: ${c.serviceUuid.toString()} DATA: $data"); dynamic resp = await c.write(data, withoutResponse: false); log("WRITING DATA RESPONSE $resp"); } @@ -102,8 +101,8 @@ class TransportBLE implements ProvTransport { for (BluetoothCharacteristic c in characteristics) { if (c.uuid.toString() == nuLookup[epName ?? ""] && c.properties.read) { - log("WAIT FOR 2 SECONDS"); - await Future.delayed(const Duration(seconds: 1)); + log("WAIT FOR 300 MILLISECONDS"); + await Future.delayed(const Duration(milliseconds: 300)); log("READ CHARACTERISTIC ${c.uuid.toString()} ${nuLookup[epName ?? ""]}"); List value = await c.read(); log("VALUE $value"); diff --git a/pubspec.lock b/pubspec.lock index ede752b..98ac768 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,70 +5,80 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.10.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" source: hosted version: "1.2.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" collection: dependency: "direct main" description: name: collection - url: "https://pub.dartlang.org" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" source: hosted version: "3.1.1" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c + url: "https://pub.dev" source: hosted version: "3.0.1" cryptography: dependency: "direct main" description: name: cryptography - url: "https://pub.dartlang.org" + sha256: acb6725e6d5186ec61a1705ad83f4d43d9ff05fd7c2382c68b9d4fcce9596c00 + url: "https://pub.dev" source: hosted version: "2.0.1" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.dartlang.org" + sha256: "6a2ef17156f4dc49684f9d99aaf4a93aba8ac49f5eac861755f5730ddf6e2e4e" + url: "https://pub.dev" source: hosted version: "1.0.0" flutter: @@ -80,7 +90,8 @@ packages: dependency: "direct main" description: name: flutter_blue_plus - url: "https://pub.dartlang.org" + sha256: "4e49b45d2f1ec9855826ed0af7d2b78b7d2a3e5743b3ae72aec59eb3790356d9" + url: "https://pub.dev" source: hosted version: "1.4.0" flutter_test: @@ -92,49 +103,56 @@ packages: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" source: hosted - version: "0.6.3" + version: "0.6.5" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.13" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted version: "1.8.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted version: "1.8.2" protobuf: dependency: "direct main" description: name: protobuf - url: "https://pub.dartlang.org" + sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08" + url: "https://pub.dev" source: hosted version: "2.1.0" rxdart: dependency: transitive description: name: rxdart - url: "https://pub.dartlang.org" + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.dev" source: hosted version: "0.27.7" sky_engine: @@ -146,58 +164,66 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.4.16" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" + url: "https://pub.dev" source: hosted version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" sdks: dart: ">=2.18.0 <3.0.0" flutter: ">=2.5.0" From 35db39ec3e3a74e1001720930e86da6d1c111c1c Mon Sep 17 00:00:00 2001 From: Sakina Boriwala Date: Mon, 20 Feb 2023 17:00:21 +0530 Subject: [PATCH 5/7] commented code for wait --- lib/src/transport_ble.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/transport_ble.dart b/lib/src/transport_ble.dart index aadc9f8..fb48892 100644 --- a/lib/src/transport_ble.dart +++ b/lib/src/transport_ble.dart @@ -81,8 +81,8 @@ class TransportBLE implements ProvTransport { var characteristics = services[i].characteristics; for (BluetoothCharacteristic c in characteristics) { if (c.uuid.toString() == nuLookup[epName ?? ""]) { - log("WAIT FOR 300 MILLISECONDS"); - await Future.delayed(const Duration(milliseconds: 300)); + // log("WAIT FOR 300 MILLISECONDS"); + // await Future.delayed(const Duration(milliseconds: 300)); log("WRITING DATA $i DEVICEID: ${c.deviceId.toString()} DEVICE UUID: ${c.uuid.toString()} SERVICE UUID: ${c.serviceUuid.toString()} DATA: $data"); dynamic resp = await c.write(data, withoutResponse: false); log("WRITING DATA RESPONSE $resp"); @@ -101,8 +101,8 @@ class TransportBLE implements ProvTransport { for (BluetoothCharacteristic c in characteristics) { if (c.uuid.toString() == nuLookup[epName ?? ""] && c.properties.read) { - log("WAIT FOR 300 MILLISECONDS"); - await Future.delayed(const Duration(milliseconds: 300)); + // log("WAIT FOR 300 MILLISECONDS"); + // await Future.delayed(const Duration(milliseconds: 300)); log("READ CHARACTERISTIC ${c.uuid.toString()} ${nuLookup[epName ?? ""]}"); List value = await c.read(); log("VALUE $value"); From d4d13c570fd01693322ad6b3da66c1c659d4fcfd Mon Sep 17 00:00:00 2001 From: Sakina Boriwala Date: Wed, 23 Aug 2023 12:53:19 +0530 Subject: [PATCH 6/7] Added try catch block to catch exception while discovering services --- lib/src/transport_ble.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/transport_ble.dart b/lib/src/transport_ble.dart index fb48892..2a584d4 100644 --- a/lib/src/transport_ble.dart +++ b/lib/src/transport_ble.dart @@ -64,7 +64,11 @@ class TransportBLE implements ProvTransport { await peripheral.connect(); // await peripheral.requestMtu(512); - await peripheral.discoverServices(); + try { + await peripheral.discoverServices(); + } catch (e) { + return Future.error(e); + } // discoverAllServicesAndCharacteristics( // transactionId: 'discoverAllServicesAndCharacteristics'); return (await bleManager.connectedDevices).contains(peripheral); From 77046430e02d7167b2411286667de3d813480b29 Mon Sep 17 00:00:00 2001 From: Sakina Boriwala Date: Wed, 23 Aug 2023 13:42:39 +0530 Subject: [PATCH 7/7] added more logs and one more try block --- lib/src/esp_prov.dart | 64 +++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/lib/src/esp_prov.dart b/lib/src/esp_prov.dart index b3a040e..cb2acbb 100644 --- a/lib/src/esp_prov.dart +++ b/lib/src/esp_prov.dart @@ -185,41 +185,47 @@ class EspProv { } Future getStatus() async { - var payload = WiFiConfigPayload(); - payload.msg = WiFiConfigMsgType.TypeCmdGetStatus; + try { + log("INSIDE GET STATUS"); + var payload = WiFiConfigPayload(); + payload.msg = WiFiConfigMsgType.TypeCmdGetStatus; - var cmdGetStatus = CmdGetStatus(); - payload.cmdGetStatus = cmdGetStatus; + var cmdGetStatus = CmdGetStatus(); + payload.cmdGetStatus = cmdGetStatus; - var reqData = await security?.encrypt(payload.writeToBuffer()); - var respData = await transport?.sendReceive('prov-config', reqData); - var respRaw = await security?.decrypt(respData); - var respPayload = WiFiConfigPayload.fromBuffer(respRaw?.toList() ?? []); + var reqData = await security?.encrypt(payload.writeToBuffer()); + var respData = await transport?.sendReceive('prov-config', reqData); + var respRaw = await security?.decrypt(respData); + var respPayload = WiFiConfigPayload.fromBuffer(respRaw?.toList() ?? []); - if (respPayload.respGetStatus.staState.value == 0) { - return ConnectionStatus( - state: WifiConnectionState.Connected, - ip: respPayload.respGetStatus.connected.ip4Addr); - } else if (respPayload.respGetStatus.staState.value == 1) { - return ConnectionStatus(state: WifiConnectionState.Connecting); - } else if (respPayload.respGetStatus.staState.value == 2) { - return ConnectionStatus(state: WifiConnectionState.Disconnected); - } else if (respPayload.respGetStatus.staState.value == 3) { - if (respPayload.respGetStatus.failReason.value == 0) { + if (respPayload.respGetStatus.staState.value == 0) { return ConnectionStatus( - state: WifiConnectionState.ConnectionFailed, - failedReason: WifiConnectFailedReason.AuthError, - ); - } else if (respPayload.respGetStatus.failReason.value == 1) { - return ConnectionStatus( - state: WifiConnectionState.ConnectionFailed, - failedReason: WifiConnectFailedReason.NetworkNotFound, - ); + state: WifiConnectionState.Connected, + ip: respPayload.respGetStatus.connected.ip4Addr); + } else if (respPayload.respGetStatus.staState.value == 1) { + return ConnectionStatus(state: WifiConnectionState.Connecting); + } else if (respPayload.respGetStatus.staState.value == 2) { + return ConnectionStatus(state: WifiConnectionState.Disconnected); + } else if (respPayload.respGetStatus.staState.value == 3) { + if (respPayload.respGetStatus.failReason.value == 0) { + return ConnectionStatus( + state: WifiConnectionState.ConnectionFailed, + failedReason: WifiConnectFailedReason.AuthError, + ); + } else if (respPayload.respGetStatus.failReason.value == 1) { + return ConnectionStatus( + state: WifiConnectionState.ConnectionFailed, + failedReason: WifiConnectFailedReason.NetworkNotFound, + ); + } + return ConnectionStatus(state: WifiConnectionState.ConnectionFailed); } - return ConnectionStatus(state: WifiConnectionState.ConnectionFailed); - } - return null; + return null; + } catch (e) { + log("ERROR FETCHING STATUS $e"); + return Future.error(e); + } } Future sendReceiveCustomData(Uint8List data,