62 lines
2.1 KiB
Dart
62 lines
2.1 KiB
Dart
import 'dart:convert';
|
|
import 'dart:developer';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import '../objects/cloud_service_api.dart';
|
|
import '../widgets/sidebar.dart';
|
|
|
|
Future<Map<String, dynamic>> readJson() async {
|
|
final String data = await rootBundle.loadString('config/credentials.json');
|
|
final Map<String, dynamic> dataMap = json.decode(data);
|
|
log("loaded json input $dataMap");
|
|
return dataMap;
|
|
}
|
|
|
|
class CloudService extends StatefulWidget {
|
|
const CloudService({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<CloudService> createState() => _CloudService();
|
|
}
|
|
|
|
class _CloudService extends State<CloudService> {
|
|
late final Map<String, dynamic> credentials;
|
|
CloudServiceAPI cloudServiceAPI = CloudServiceAPI();
|
|
static SharedPreferences? preferencesInstance;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text("Cloud Service"),
|
|
),
|
|
body: Center(
|
|
child: TextButton(
|
|
onPressed: () async {
|
|
// List<BluetoothObjectRemote> respond1 = await cloudServiceAPI.getDevices();
|
|
// debugPrint('Devices: ${respond1[0].toString()}');
|
|
// debugPrint('Devices: ${respond1[0].toString()}');
|
|
|
|
//dynamic respond2 = await cloudServiceAPI.getInformation();
|
|
//debugPrint('Information: ${respond2.toString()}');
|
|
|
|
// dynamic respond3 = await cloudServiceAPI.createDevice('1', 'asdas', 'sdwe1');
|
|
// debugPrint('CreateDevice: ${respond3.toString()}');*/
|
|
|
|
//dynamic respond4 = await cloudServiceAPI.getDeviceInfo("PFC200V3-430EB3");
|
|
//debugPrint('Information: ${respond4.toString()}');
|
|
|
|
//bool respond5 = await cloudServiceAPI.createDevice("PFC200V3-430EB2", "60987668030DF277AD7706D7C1FA683F37230D202A80EE5135B05EF928E3BF88", "");
|
|
//debugPrint('Information: ${respond5.toString()}');
|
|
},
|
|
child: const Text("Example"),
|
|
),
|
|
),
|
|
drawer: const Sidebar(),
|
|
);
|
|
}
|
|
}
|