mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
push living room status
This commit is contained in:
@ -103,6 +103,6 @@ class AuthenticationAPI {
|
||||
.map((zone) => RegionModel.fromJson(zone))
|
||||
.toList();
|
||||
});
|
||||
return response as List<RegionModel>;
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/models/devices_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
||||
import 'package:syncrow_web/services/api/http_service.dart';
|
||||
import 'package:syncrow_web/utils/constants/api_const.dart';
|
||||
|
||||
@ -23,4 +24,43 @@ class DevicesManagementApi {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Future<DeviceStatus> getDeviceStatus(String uuid) async {
|
||||
try {
|
||||
final response = await HTTPService().get(
|
||||
path: ApiEndpoints.getDeviceStatus.replaceAll('{uuid}', uuid),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
return DeviceStatus.fromJson(json);
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
debugPrint('Error fetching $e');
|
||||
return DeviceStatus(
|
||||
productUuid: '',
|
||||
productType: '',
|
||||
status: [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//deviceControl
|
||||
|
||||
Future<bool> deviceControl (String uuid, Status status) async {
|
||||
try {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.deviceControl.replaceAll('{uuid}', uuid),
|
||||
body: status.toMap(),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
return true;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
debugPrint('Error fetching $e');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user