mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
push generate report for one sensor
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_reports.dart';
|
||||
|
||||
class FakeDeviceReport {
|
||||
static DeviceReport generateFakeReport() {
|
||||
return DeviceReport(
|
||||
deviceUuid: 'fake-uuid-12345',
|
||||
startTime: DateTime.now().millisecondsSinceEpoch,
|
||||
endTime: DateTime.now().add(Duration(hours: 1)).millisecondsSinceEpoch,
|
||||
data: [
|
||||
{
|
||||
'date': '13/08/2024',
|
||||
'time': '13:05',
|
||||
'status': 'Presence',
|
||||
'description': 'Description for Presence at 13:05 on 13/08/2024',
|
||||
},
|
||||
{
|
||||
'date': '13/08/2024',
|
||||
'time': '14:10',
|
||||
'status': 'No Presence',
|
||||
'description': 'Description for No Presence at 14:10 on 13/08/2024',
|
||||
},
|
||||
{
|
||||
'date': '14/08/2024',
|
||||
'time': '15:30',
|
||||
'status': 'Presence',
|
||||
'description': 'Description for Presence at 15:30 on 14/08/2024',
|
||||
},
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
class DeviceReport {
|
||||
final String? deviceUuid;
|
||||
final int? startTime;
|
||||
final int? endTime;
|
||||
final List<dynamic>? data;
|
||||
|
||||
DeviceReport({
|
||||
this.deviceUuid,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
this.data,
|
||||
});
|
||||
|
||||
DeviceReport.fromJson(Map<String, dynamic> json)
|
||||
: deviceUuid = json['deviceUuid'] as String?,
|
||||
startTime = json['startTime'] as int?,
|
||||
endTime = json['endTime'] as int?,
|
||||
data = json['data'] as List?;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'deviceUuid': deviceUuid,
|
||||
'startTime': startTime,
|
||||
'endTime': endTime,
|
||||
'data': data
|
||||
};
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/helper/fake_report_data.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/wall_sensor/bloc/event.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/wall_sensor/bloc/state.dart';
|
||||
@ -14,9 +15,13 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
|
||||
WallSensorBloc({required this.deviceId}) : super(WallSensorInitialState()) {
|
||||
on<WallSensorInitialEvent>(_fetchWallSensorStatus);
|
||||
on<WallSensorChangeValueEvent>(_changeValue);
|
||||
on<GetDeviceReportsEvent>(_getDeviceReports);
|
||||
on<ShowDescriptionEvent>(_showDescription);
|
||||
on<BackToGridViewEvent>(_backToGridView);
|
||||
}
|
||||
|
||||
void _fetchWallSensorStatus(WallSensorInitialEvent event, Emitter<WallSensorState> emit) async {
|
||||
void _fetchWallSensorStatus(
|
||||
WallSensorInitialEvent event, Emitter<WallSensorState> emit) async {
|
||||
emit(WallSensorLoadingInitialState());
|
||||
try {
|
||||
var response = await DevicesManagementApi().getDeviceStatus(deviceId);
|
||||
@ -48,7 +53,8 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
|
||||
// } catch (_) {}
|
||||
// }
|
||||
|
||||
void _changeValue(WallSensorChangeValueEvent event, Emitter<WallSensorState> emit) async {
|
||||
void _changeValue(
|
||||
WallSensorChangeValueEvent event, Emitter<WallSensorState> emit) async {
|
||||
emit(WallSensorLoadingNewSate(wallSensorModel: deviceStatus));
|
||||
if (event.code == 'far_detection') {
|
||||
deviceStatus.farDetection = event.value;
|
||||
@ -60,7 +66,8 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
|
||||
deviceStatus.noBodyTime = event.value;
|
||||
}
|
||||
emit(WallSensorUpdateState(wallSensorModel: deviceStatus));
|
||||
await _runDeBouncer(deviceId: deviceId, code: event.code, value: event.value);
|
||||
await _runDeBouncer(
|
||||
deviceId: deviceId, code: event.code, value: event.value);
|
||||
}
|
||||
|
||||
_runDeBouncer({
|
||||
@ -73,8 +80,8 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
|
||||
}
|
||||
_timer = Timer(const Duration(seconds: 1), () async {
|
||||
try {
|
||||
final response =
|
||||
await DevicesManagementApi().deviceControl(deviceId, Status(code: code, value: value));
|
||||
final response = await DevicesManagementApi()
|
||||
.deviceControl(deviceId, Status(code: code, value: value));
|
||||
|
||||
if (!response) {
|
||||
add(WallSensorInitialEvent());
|
||||
@ -85,4 +92,30 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
FutureOr<void> _getDeviceReports(
|
||||
GetDeviceReportsEvent event, Emitter<WallSensorState> emit) async {
|
||||
emit(DeviceReportsLoadingState());
|
||||
|
||||
try {
|
||||
//await DevicesManagementApi.getDeviceReports(deviceId, event.code)
|
||||
// .then((value) {
|
||||
final fakeReport = FakeDeviceReport.generateFakeReport();
|
||||
emit(DeviceReportsState(deviceReport: fakeReport));
|
||||
// });
|
||||
} catch (e) {
|
||||
emit(DeviceReportsFailedState(error: e.toString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void _showDescription(
|
||||
ShowDescriptionEvent event, Emitter<WallSensorState> emit) {
|
||||
emit(WallSensorShowDescriptionState(description: event.description));
|
||||
}
|
||||
|
||||
void _backToGridView(
|
||||
BackToGridViewEvent event, Emitter<WallSensorState> emit) {
|
||||
emit(WallSensorUpdateState(wallSensorModel: deviceStatus));
|
||||
}
|
||||
}
|
||||
|
@ -17,3 +17,22 @@ class WallSensorChangeValueEvent extends WallSensorEvent {
|
||||
@override
|
||||
List<Object> get props => [value, code];
|
||||
}
|
||||
|
||||
class GetDeviceReportsEvent extends WallSensorEvent {
|
||||
final String deviceUuid;
|
||||
final String code;
|
||||
const GetDeviceReportsEvent({
|
||||
required this.deviceUuid,
|
||||
required this.code,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => [deviceUuid, code];
|
||||
}
|
||||
|
||||
class ShowDescriptionEvent extends WallSensorEvent {
|
||||
final String description;
|
||||
const ShowDescriptionEvent({required this.description});
|
||||
}
|
||||
|
||||
class BackToGridViewEvent extends WallSensorEvent {}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_reports.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/wall_sensor/model/wall_sensor_model.dart';
|
||||
|
||||
class WallSensorState extends Equatable {
|
||||
@ -36,3 +37,20 @@ class WallSensorFailedState extends WallSensorState {
|
||||
@override
|
||||
List<Object> get props => [error];
|
||||
}
|
||||
|
||||
class DeviceReportsLoadingState extends WallSensorState {}
|
||||
|
||||
class DeviceReportsState extends WallSensorState {
|
||||
final DeviceReport deviceReport;
|
||||
const DeviceReportsState({required this.deviceReport});
|
||||
}
|
||||
|
||||
class DeviceReportsFailedState extends WallSensorState {
|
||||
final String error;
|
||||
const DeviceReportsFailedState({required this.error});
|
||||
}
|
||||
|
||||
class WallSensorShowDescriptionState extends WallSensorState {
|
||||
final String description;
|
||||
const WallSensorShowDescriptionState({required this.description});
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_reports.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/wall_sensor/bloc/bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/wall_sensor/bloc/event.dart';
|
||||
@ -8,6 +9,7 @@ import 'package:syncrow_web/pages/device_managment/shared/sensors_widgets/presen
|
||||
import 'package:syncrow_web/pages/device_managment/shared/sensors_widgets/presence_static_widget.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/sensors_widgets/presence_status.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/sensors_widgets/presence_update_data.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/wall_sensor/model/wall_sensor_model.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
@ -21,12 +23,31 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
final isLarge = isLargeScreenSize(context);
|
||||
final isMedium = isMediumScreenSize(context);
|
||||
return BlocProvider(
|
||||
create: (context) => WallSensorBloc(deviceId: device.uuid!)..add(WallSensorInitialEvent()),
|
||||
create: (context) =>
|
||||
WallSensorBloc(deviceId: device.uuid!)..add(WallSensorInitialEvent()),
|
||||
child: BlocBuilder<WallSensorBloc, WallSensorState>(
|
||||
builder: (context, state) {
|
||||
if (state is WallSensorLoadingInitialState) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (state is WallSensorUpdateState) {
|
||||
return _buildGridView(
|
||||
context, state.wallSensorModel, isLarge, isMedium);
|
||||
} else if (state is DeviceReportsState) {
|
||||
return _buildReportsTable(context, state.deviceReport);
|
||||
} else if (state is WallSensorShowDescriptionState) {
|
||||
return _buildDescriptionView(context, state.description);
|
||||
} else if (state is DeviceReportsFailedState) {
|
||||
final model = context.read<WallSensorBloc>().deviceStatus;
|
||||
return _buildGridView(context, model, isLarge, isMedium);
|
||||
}
|
||||
return const Center(child: Text('Error fetching status'));
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildGridView(BuildContext context, WallSensorModel model,
|
||||
bool isLarge, bool isMedium) {
|
||||
return GridView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||
shrinkWrap: true,
|
||||
@ -43,25 +64,25 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
),
|
||||
children: [
|
||||
PresenceState(
|
||||
value: state.wallSensorModel.presenceState,
|
||||
value: model.presenceState,
|
||||
),
|
||||
PresenceDisplayValue(
|
||||
value: state.wallSensorModel.presenceTime.toString(),
|
||||
value: model.presenceTime.toString(),
|
||||
postfix: 'min',
|
||||
description: 'Presence Time',
|
||||
),
|
||||
PresenceDisplayValue(
|
||||
value: state.wallSensorModel.currentDistance.toString(),
|
||||
value: model.currentDistance.toString(),
|
||||
postfix: 'cm',
|
||||
description: 'Current Distance',
|
||||
),
|
||||
PresenceDisplayValue(
|
||||
value: state.wallSensorModel.illuminance.toString(),
|
||||
value: model.illuminance.toString(),
|
||||
postfix: 'Lux',
|
||||
description: 'Illuminance Value',
|
||||
),
|
||||
PresenceUpdateData(
|
||||
value: state.wallSensorModel.motionSensitivity.toDouble(),
|
||||
value: model.motionSensitivity.toDouble(),
|
||||
title: 'Motion Detection Sensitivity:',
|
||||
minValue: 1,
|
||||
maxValue: 5,
|
||||
@ -76,7 +97,7 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
},
|
||||
),
|
||||
PresenceUpdateData(
|
||||
value: state.wallSensorModel.motionlessSensitivity.toDouble(),
|
||||
value: model.motionlessSensitivity.toDouble(),
|
||||
title: 'Motionless Detection Sensitivity:',
|
||||
minValue: 1,
|
||||
maxValue: 5,
|
||||
@ -89,7 +110,7 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
),
|
||||
),
|
||||
PresenceUpdateData(
|
||||
value: state.wallSensorModel.noBodyTime.toDouble(),
|
||||
value: model.noBodyTime.toDouble(),
|
||||
title: 'Nobody Time:',
|
||||
minValue: 10,
|
||||
maxValue: 10000,
|
||||
@ -101,7 +122,7 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
value: value,
|
||||
))),
|
||||
PresenceUpdateData(
|
||||
value: state.wallSensorModel.farDetection.toDouble(),
|
||||
value: model.farDetection.toDouble(),
|
||||
title: 'Far Detection:',
|
||||
minValue: 75,
|
||||
maxValue: 600,
|
||||
@ -115,14 +136,20 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
context.read<WallSensorBloc>().add(GetDeviceReportsEvent(
|
||||
code: 'illuminance_record', deviceUuid: device.uuid!));
|
||||
},
|
||||
child: const PresenceStaticWidget(
|
||||
icon: Assets.illuminanceRecordIcon,
|
||||
description: 'Illuminance Record',
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
context.read<WallSensorBloc>().add(GetDeviceReportsEvent(
|
||||
code: 'presence_record', deviceUuid: device.uuid!));
|
||||
},
|
||||
child: const PresenceStaticWidget(
|
||||
icon: Assets.presenceRecordIcon,
|
||||
description: 'Presence Record',
|
||||
@ -130,11 +157,234 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return const Center(child: Text('Error fetching status'));
|
||||
}
|
||||
|
||||
Widget _buildReportsTable(BuildContext context, DeviceReport report) {
|
||||
return Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Table(
|
||||
border: TableBorder.all(color: Colors.grey.shade300, width: 1),
|
||||
columnWidths: const {
|
||||
0: FlexColumnWidth(),
|
||||
1: FlexColumnWidth(),
|
||||
2: FlexColumnWidth(),
|
||||
},
|
||||
children: [
|
||||
TableRow(
|
||||
decoration: BoxDecoration(color: Colors.grey.shade200),
|
||||
children: [
|
||||
_buildTableHeader('Date'),
|
||||
_buildTableHeader('Time'),
|
||||
_buildTableHeader('Status'),
|
||||
],
|
||||
),
|
||||
...report.data!.map((entry) {
|
||||
return TableRow(
|
||||
children: [
|
||||
_buildTableCell(entry['date']),
|
||||
_buildTableCell(entry['time']),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context.read<WallSensorBloc>().add(
|
||||
ShowDescriptionEvent(
|
||||
description: entry['description']),
|
||||
);
|
||||
},
|
||||
child: _buildTableCell(entry['status']),
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: IconButton(
|
||||
icon: const Icon(
|
||||
Icons.close,
|
||||
color: Colors.red,
|
||||
size: 18,
|
||||
),
|
||||
onPressed: () {
|
||||
context.read<WallSensorBloc>().add(BackToGridViewEvent());
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDescriptionView(BuildContext context, String description) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Help Description',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium!
|
||||
.copyWith(color: Colors.grey),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context.read<WallSensorBloc>().add(BackToGridViewEvent());
|
||||
},
|
||||
child: Text(
|
||||
'Close',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium!
|
||||
.copyWith(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(description),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTableHeader(String title) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
title,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTableCell(String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(value),
|
||||
);
|
||||
}
|
||||
|
||||
// BlocBuilder<WallSensorBloc, WallSensorState>(
|
||||
// builder: (context, state) {
|
||||
// if (state is WallSensorLoadingInitialState) {
|
||||
// return const Center(child: CircularProgressIndicator());
|
||||
// } else if (state is WallSensorUpdateState) {
|
||||
// return
|
||||
// GridView(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||
// shrinkWrap: true,
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
// crossAxisCount: isLarge
|
||||
// ? 3
|
||||
// : isMedium
|
||||
// ? 2
|
||||
// : 1,
|
||||
// mainAxisExtent: 133,
|
||||
// crossAxisSpacing: 12,
|
||||
// mainAxisSpacing: 12,
|
||||
// ),
|
||||
// children: [
|
||||
// PresenceState(
|
||||
// value: state.wallSensorModel.presenceState,
|
||||
// ),
|
||||
// PresenceDisplayValue(
|
||||
// value: state.wallSensorModel.presenceTime.toString(),
|
||||
// postfix: 'min',
|
||||
// description: 'Presence Time',
|
||||
// ),
|
||||
// PresenceDisplayValue(
|
||||
// value: state.wallSensorModel.currentDistance.toString(),
|
||||
// postfix: 'cm',
|
||||
// description: 'Current Distance',
|
||||
// ),
|
||||
// PresenceDisplayValue(
|
||||
// value: state.wallSensorModel.illuminance.toString(),
|
||||
// postfix: 'Lux',
|
||||
// description: 'Illuminance Value',
|
||||
// ),
|
||||
// PresenceUpdateData(
|
||||
// value: state.wallSensorModel.motionSensitivity.toDouble(),
|
||||
// title: 'Motion Detection Sensitivity:',
|
||||
// minValue: 1,
|
||||
// maxValue: 5,
|
||||
// steps: 1,
|
||||
// action: (int value) {
|
||||
// context.read<WallSensorBloc>().add(
|
||||
// WallSensorChangeValueEvent(
|
||||
// code: 'motion_sensitivity_value',
|
||||
// value: value,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// PresenceUpdateData(
|
||||
// value: state.wallSensorModel.motionlessSensitivity.toDouble(),
|
||||
// title: 'Motionless Detection Sensitivity:',
|
||||
// minValue: 1,
|
||||
// maxValue: 5,
|
||||
// steps: 1,
|
||||
// action: (int value) => context.read<WallSensorBloc>().add(
|
||||
// WallSensorChangeValueEvent(
|
||||
// code: 'motionless_sensitivity',
|
||||
// value: value,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// PresenceUpdateData(
|
||||
// value: state.wallSensorModel.noBodyTime.toDouble(),
|
||||
// title: 'Nobody Time:',
|
||||
// minValue: 10,
|
||||
// maxValue: 10000,
|
||||
// steps: 1,
|
||||
// description: 'hr',
|
||||
// action: (int value) =>
|
||||
// context.read<WallSensorBloc>().add(WallSensorChangeValueEvent(
|
||||
// code: 'no_one_time',
|
||||
// value: value,
|
||||
// ))),
|
||||
// PresenceUpdateData(
|
||||
// value: state.wallSensorModel.farDetection.toDouble(),
|
||||
// title: 'Far Detection:',
|
||||
// minValue: 75,
|
||||
// maxValue: 600,
|
||||
// steps: 75,
|
||||
// description: 'cm',
|
||||
// action: (int value) => context.read<WallSensorBloc>().add(
|
||||
// WallSensorChangeValueEvent(
|
||||
// code: 'far_detection',
|
||||
// value: value,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// GestureDetector(
|
||||
// onTap: () {},
|
||||
// child: const PresenceStaticWidget(
|
||||
// icon: Assets.illuminanceRecordIcon,
|
||||
// description: 'Illuminance Record',
|
||||
// ),
|
||||
// ),
|
||||
// GestureDetector(
|
||||
// onTap: () {},
|
||||
// child: const PresenceStaticWidget(
|
||||
// icon: Assets.presenceRecordIcon,
|
||||
// description: 'Presence Record',
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// } else {
|
||||
// return const Center(child: Text('Error fetching status'));
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_reports.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/pages/visitor_password/model/device_model.dart';
|
||||
@ -94,6 +95,16 @@ class DevicesManagementApi {
|
||||
return response;
|
||||
}
|
||||
|
||||
//https://syncrow-dev.azurewebsites.net/device/report-logs/7e97c359-e822-4507-ac1f-e0ff96b0ca29?code=factory_reset
|
||||
|
||||
static Future<DeviceReport> getDeviceReports(String uuid, String code) async {
|
||||
final response = await HTTPService().get(
|
||||
path: ApiEndpoints.getDeviceLogs
|
||||
.replaceAll('{uuid}', uuid)
|
||||
.replaceAll('{code}', code),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return DeviceReport.fromJson(json);
|
||||
},
|
||||
);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -35,4 +35,7 @@ abstract class ApiEndpoints {
|
||||
static const String deviceControl = '$baseUrl/device/{uuid}/control';
|
||||
static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices';
|
||||
static const String openDoorLock = '/door-lock/open/{doorLockUuid}';
|
||||
|
||||
static const String getDeviceLogs =
|
||||
'$baseUrl/device/report-logs/{uuid}?code={code}';
|
||||
}
|
||||
|
Reference in New Issue
Block a user