@@ -19,7 +19,7 @@ class Device {
1919 final result = await Isolate .run (() {
2020 final status = deviceOV.getAvailableDevices ();
2121
22- if (StatusEnum . fromValue ( status.ref.status) != StatusEnum .OkStatus ) {
22+ if (status.ref.status != StatusEnum .OkStatus ) {
2323 throw "GetAvailableDevices error: ${status .ref .status } ${status .ref .message .toDartString ()}" ;
2424 }
2525
@@ -39,24 +39,37 @@ class Device {
3939 }
4040}
4141
42+ class Resolution {
43+ final int width;
44+ final int height;
45+
46+ const Resolution (this .width, this .height);
47+ }
48+
4249class CameraDevice {
4350 final int id;
4451 final String name;
45- const CameraDevice (this .id, this .name);
52+ final List <Resolution > resolutions;
53+ const CameraDevice (this .id, this .name, this .resolutions);
4654
4755 static Future <List <CameraDevice >> getDevices () async {
4856 final result = await Isolate .run (() {
4957 final status = deviceOV.getAvailableCameraDevices ();
5058
51- if (StatusEnum . fromValue ( status.ref.status) != StatusEnum .OkStatus ) {
59+ if (status.ref.status != StatusEnum .OkStatus ) {
5260 throw "GetAvailableDevices error: ${status .ref .status } ${status .ref .message .toDartString ()}" ;
5361 }
5462
5563 List <CameraDevice > devices = [];
5664 for (int i = 0 ; i < status.ref.size; i++ ) {
65+ List <Resolution > resolutions = [];
66+ for (int j = 0 ; j < status.ref.value[i].size; j++ ){
67+ resolutions.add (Resolution (status.ref.value[i].resolutions[j].width, status.ref.value[i].resolutions[j].height));
68+ }
5769 devices.add (CameraDevice (
5870 status.ref.value[i].id,
59- status.ref.value[i].name.toDartString ()
71+ status.ref.value[i].name.toDartString (),
72+ resolutions
6073 ));
6174 }
6275 deviceOV.freeStatusOrCameraDevices (status);
0 commit comments