vnpttech_pkg 1.2.32
vnpttech_pkg: ^1.2.32 copied to clipboard
A Dart library package that provides API communication to connect, configure and control VNPT Technology network devices. Developed by Software Technology Center
ONE Link Software development kit [0.9] #
Platform Support
| Android | iOS | Web | MacOS | Linux | Windows |
|---|---|---|---|---|---|
| ✔️ | ✔️ | ✔️ | ➖ | ➖ | ➖ |
vnpttech_pkg #
This is a Dart library package that provides API communication to connect, configure and control VNPT Technology network devices. This package was developed by Software Technology Center (STC).
Features #
- Device discovery
- Device connect
- Change password
- Database update
- Disconnect device
- Device configuration
- Network quick Setup
- Network configuration
- Network diagnostics
- Network troubleshooting
- Device software update
- Control device reboot
- Control device reset factory
- Restore device configuration
Tech #
vnpttech_pkg uses a number of open source projects to work properly:
- path - A comprehensive, cross-platform path manipulation library for Dart.
- http - A composable, Future-based library for making HTTP requests.
- json_annotation - Defines the annotations used by json_serializable to create code for JSON serialization and deserialization.
- shared_preferences - Wraps platform-specific persistent storage for simple data (NSUserDefaults on iOS and macOS, SharedPreferences on Android, etc.).
- flutter_js - A Javascript engine to use with flutter.
- dart_jsonwebtoken - A Dart implementation of the famous javascript library jsonwebtoken.
- device_info - Flutter plugin providing detailed information about the device (make, model, etc.), and Android or iOS version the app is running on.
- package_info - Flutter plugin for querying information about the application package, such as CFBundleVersion on iOS or versionCode on Android.
- path_provider - A Flutter plugin for finding commonly used locations on the filesystem. Supports Android, iOS, Linux, macOS and Windows. Not all methods are supported on all platforms.
Getting started #
vnpttech_pkg requires Flutter SDK v2.0+ to run.
Configure SSL verification
class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
..badCertificateCallback = (X509Certificate cert, String host, int port) {
return true;
};
}
}
In your main.dart
void main() {
HttpOverrides.global = MyHttpOverrides();
runApp(const MyApp());
}
Installation #
Use this package as a library Run this command:
With Dart:
dart pub add vnpttech_pkg
With Flutter:
flutter pub add vnpttech_pkg
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
vnpttech_pkg: ^1.x.x
Usage #
import 'package:vnpttech_pkg/vnpttech_pkg_base.dart';
var apiEndpoint = VNPTTechAPI(env: 'dev' | 'stag' | 'prod' | 'net');
Initialization first
var registerRequest = {'appId': '<YOUR_APP_ID>', 'appVersion': '<YOUR.APP.VERSION>'};
var result = await apiEndpoint.register(registerRequest);
Devices discovery
await apiEndpoint.devideScan(((data) => onScan(data)));
Connect device
var connectRequest = {
'serialNumber': '<DEVICE_SERIAL>',
'modelName': '<DEVICE_MODEL>',
'ipAddr': '<DEVICE_IP>'
};
var connectResult = await apiEndpoint.connectDevice(connectRequest);
Device infomation
var deviceInfoRequest = {
'serialNumber': '<DEVICE_SERIAL>',
'modelName': '<DEVICE_MODEL>'
};
var deviceInfo = await apiEndpoint.getDeviceInfo(deviceInfoRequest);
License #
BSD-3-Clause