pumaguard 21.post27__py3-none-any.whl → 21.post83__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. pumaguard/presets.py +1 -0
  2. pumaguard/pumaguard-ui/.last_build_id +1 -1
  3. pumaguard/pumaguard-ui/assets/NOTICES +621 -71
  4. pumaguard/pumaguard-ui/assets/fonts/MaterialIcons-Regular.otf +0 -0
  5. pumaguard/pumaguard-ui/flutter_bootstrap.js +1 -1
  6. pumaguard/pumaguard-ui/main.dart.js +28869 -28787
  7. pumaguard/web_routes/dhcp.py +311 -54
  8. pumaguard/web_routes/diagnostics.py +6 -0
  9. pumaguard/web_routes/settings.py +13 -0
  10. pumaguard/web_ui.py +29 -0
  11. {pumaguard-21.post27.dist-info → pumaguard-21.post83.dist-info}/METADATA +1 -1
  12. pumaguard-21.post83.dist-info/RECORD +254 -0
  13. pumaguard-ui/.gitignore +48 -0
  14. pumaguard-ui/.metadata +45 -0
  15. pumaguard-ui/API_REFERENCE.md +717 -0
  16. pumaguard-ui/LICENSE +201 -0
  17. pumaguard-ui/Makefile +36 -0
  18. pumaguard-ui/README.md +371 -0
  19. pumaguard-ui/UI_DEVELOPMENT_CONTEXT.md +427 -0
  20. pumaguard-ui/analysis_options.yaml +28 -0
  21. pumaguard-ui/android/.gitignore +14 -0
  22. pumaguard-ui/android/app/build.gradle.kts +44 -0
  23. pumaguard-ui/android/app/src/debug/AndroidManifest.xml +7 -0
  24. pumaguard-ui/android/app/src/main/AndroidManifest.xml +45 -0
  25. pumaguard-ui/android/app/src/main/kotlin/com/example/pumaguard_ui/MainActivity.kt +5 -0
  26. pumaguard-ui/android/app/src/main/res/drawable/launch_background.xml +12 -0
  27. pumaguard-ui/android/app/src/main/res/drawable-v21/launch_background.xml +12 -0
  28. pumaguard-ui/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  29. pumaguard-ui/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  30. pumaguard-ui/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  31. pumaguard-ui/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  32. pumaguard-ui/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  33. pumaguard-ui/android/app/src/main/res/values/styles.xml +18 -0
  34. pumaguard-ui/android/app/src/main/res/values-night/styles.xml +18 -0
  35. pumaguard-ui/android/app/src/profile/AndroidManifest.xml +7 -0
  36. pumaguard-ui/android/build.gradle.kts +24 -0
  37. pumaguard-ui/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  38. pumaguard-ui/android/gradle.properties +2 -0
  39. pumaguard-ui/android/settings.gradle.kts +26 -0
  40. pumaguard-ui/fonts/README.md +38 -0
  41. pumaguard-ui/fonts/Roboto-Bold.ttf +0 -0
  42. pumaguard-ui/fonts/Roboto-Light.ttf +0 -0
  43. pumaguard-ui/fonts/Roboto-Medium.ttf +0 -0
  44. pumaguard-ui/fonts/Roboto-Regular.ttf +0 -0
  45. pumaguard-ui/fonts/RobotoMono-Bold.ttf +0 -0
  46. pumaguard-ui/fonts/RobotoMono-Medium.ttf +0 -0
  47. pumaguard-ui/fonts/RobotoMono-Regular.ttf +0 -0
  48. pumaguard-ui/fonts/download_fonts.sh +76 -0
  49. pumaguard-ui/ios/.gitignore +34 -0
  50. pumaguard-ui/ios/Flutter/AppFrameworkInfo.plist +26 -0
  51. pumaguard-ui/ios/Flutter/Debug.xcconfig +1 -0
  52. pumaguard-ui/ios/Flutter/Release.xcconfig +1 -0
  53. pumaguard-ui/ios/Runner/AppDelegate.swift +13 -0
  54. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +122 -0
  55. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
  56. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
  57. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
  58. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
  59. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
  60. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
  61. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
  62. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
  63. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
  64. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
  65. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
  66. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
  67. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
  68. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
  69. pumaguard-ui/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
  70. pumaguard-ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
  71. pumaguard-ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
  72. pumaguard-ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
  73. pumaguard-ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
  74. pumaguard-ui/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
  75. pumaguard-ui/ios/Runner/Base.lproj/LaunchScreen.storyboard +37 -0
  76. pumaguard-ui/ios/Runner/Base.lproj/Main.storyboard +26 -0
  77. pumaguard-ui/ios/Runner/Info.plist +49 -0
  78. pumaguard-ui/ios/Runner/Runner-Bridging-Header.h +1 -0
  79. pumaguard-ui/ios/Runner.xcodeproj/project.pbxproj +616 -0
  80. pumaguard-ui/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  81. pumaguard-ui/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  82. pumaguard-ui/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  83. pumaguard-ui/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +101 -0
  84. pumaguard-ui/ios/Runner.xcworkspace/contents.xcworkspacedata +7 -0
  85. pumaguard-ui/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  86. pumaguard-ui/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  87. pumaguard-ui/ios/RunnerTests/RunnerTests.swift +12 -0
  88. pumaguard-ui/lib/main.dart +56 -0
  89. pumaguard-ui/lib/models/camera.dart +45 -0
  90. pumaguard-ui/lib/models/plug.dart +45 -0
  91. pumaguard-ui/lib/models/settings.dart +112 -0
  92. pumaguard-ui/lib/models/status.dart +58 -0
  93. pumaguard-ui/lib/screens/directories_screen.dart +319 -0
  94. pumaguard-ui/lib/screens/home_screen.dart +545 -0
  95. pumaguard-ui/lib/screens/image_browser_screen.dart +1248 -0
  96. pumaguard-ui/lib/screens/server_discovery_screen.dart +390 -0
  97. pumaguard-ui/lib/screens/settings_screen.dart +1162 -0
  98. pumaguard-ui/lib/screens/wifi_settings_screen.dart +671 -0
  99. pumaguard-ui/lib/services/api_service.dart +717 -0
  100. pumaguard-ui/lib/services/camera_events_service.dart +195 -0
  101. pumaguard-ui/lib/services/mdns_service.dart +4 -0
  102. pumaguard-ui/lib/services/mdns_service_impl.dart +282 -0
  103. pumaguard-ui/lib/services/mdns_service_io.dart +1 -0
  104. pumaguard-ui/lib/services/mdns_service_web.dart +106 -0
  105. pumaguard-ui/lib/utils/download_helper.dart +2 -0
  106. pumaguard-ui/lib/utils/download_helper_stub.dart +6 -0
  107. pumaguard-ui/lib/utils/download_helper_web.dart +14 -0
  108. pumaguard-ui/lib/utils/platform_url.dart +10 -0
  109. pumaguard-ui/lib/utils/platform_url_stub.dart +11 -0
  110. pumaguard-ui/lib/utils/platform_url_web.dart +16 -0
  111. pumaguard-ui/linux/.gitignore +1 -0
  112. pumaguard-ui/linux/CMakeLists.txt +128 -0
  113. pumaguard-ui/linux/flutter/CMakeLists.txt +88 -0
  114. pumaguard-ui/linux/flutter/generated_plugin_registrant.cc +15 -0
  115. pumaguard-ui/linux/flutter/generated_plugin_registrant.h +15 -0
  116. pumaguard-ui/linux/flutter/generated_plugins.cmake +24 -0
  117. pumaguard-ui/linux/runner/CMakeLists.txt +26 -0
  118. pumaguard-ui/linux/runner/main.cc +6 -0
  119. pumaguard-ui/linux/runner/my_application.cc +148 -0
  120. pumaguard-ui/linux/runner/my_application.h +21 -0
  121. pumaguard-ui/macos/.gitignore +7 -0
  122. pumaguard-ui/macos/Flutter/Flutter-Debug.xcconfig +1 -0
  123. pumaguard-ui/macos/Flutter/Flutter-Release.xcconfig +1 -0
  124. pumaguard-ui/macos/Flutter/GeneratedPluginRegistrant.swift +16 -0
  125. pumaguard-ui/macos/Runner/AppDelegate.swift +13 -0
  126. pumaguard-ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  127. pumaguard-ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
  128. pumaguard-ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
  129. pumaguard-ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
  130. pumaguard-ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
  131. pumaguard-ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
  132. pumaguard-ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
  133. pumaguard-ui/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
  134. pumaguard-ui/macos/Runner/Base.lproj/MainMenu.xib +343 -0
  135. pumaguard-ui/macos/Runner/Configs/AppInfo.xcconfig +14 -0
  136. pumaguard-ui/macos/Runner/Configs/Debug.xcconfig +2 -0
  137. pumaguard-ui/macos/Runner/Configs/Release.xcconfig +2 -0
  138. pumaguard-ui/macos/Runner/Configs/Warnings.xcconfig +13 -0
  139. pumaguard-ui/macos/Runner/DebugProfile.entitlements +12 -0
  140. pumaguard-ui/macos/Runner/Info.plist +32 -0
  141. pumaguard-ui/macos/Runner/MainFlutterWindow.swift +15 -0
  142. pumaguard-ui/macos/Runner/Release.entitlements +8 -0
  143. pumaguard-ui/macos/Runner.xcodeproj/project.pbxproj +705 -0
  144. pumaguard-ui/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  145. pumaguard-ui/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +99 -0
  146. pumaguard-ui/macos/Runner.xcworkspace/contents.xcworkspacedata +7 -0
  147. pumaguard-ui/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  148. pumaguard-ui/macos/RunnerTests/RunnerTests.swift +12 -0
  149. pumaguard-ui/pubspec.lock +882 -0
  150. pumaguard-ui/pubspec.yaml +125 -0
  151. pumaguard-ui/test/models/camera_test.dart +515 -0
  152. pumaguard-ui/test/models/plug_test.dart +499 -0
  153. pumaguard-ui/test/models/settings_test.dart +903 -0
  154. pumaguard-ui/test/models/status_test.dart +707 -0
  155. pumaguard-ui/test/screens/image_browser_grouping_test.dart +555 -0
  156. pumaguard-ui/test/services/api_service_cameras_test.dart +580 -0
  157. pumaguard-ui/test/services/api_service_image_browser_test.dart +512 -0
  158. pumaguard-ui/test/widget_test.dart.skip +38 -0
  159. pumaguard-ui/web/favicon.png +0 -0
  160. pumaguard-ui/web/icons/Icon-192.png +0 -0
  161. pumaguard-ui/web/icons/Icon-512.png +0 -0
  162. pumaguard-ui/web/icons/Icon-maskable-192.png +0 -0
  163. pumaguard-ui/web/icons/Icon-maskable-512.png +0 -0
  164. pumaguard-ui/web/index.html +38 -0
  165. pumaguard-ui/web/manifest.json +35 -0
  166. pumaguard-ui/windows/.gitignore +17 -0
  167. pumaguard-ui/windows/CMakeLists.txt +108 -0
  168. pumaguard-ui/windows/flutter/CMakeLists.txt +109 -0
  169. pumaguard-ui/windows/flutter/generated_plugin_registrant.cc +14 -0
  170. pumaguard-ui/windows/flutter/generated_plugin_registrant.h +15 -0
  171. pumaguard-ui/windows/flutter/generated_plugins.cmake +24 -0
  172. pumaguard-ui/windows/runner/CMakeLists.txt +40 -0
  173. pumaguard-ui/windows/runner/Runner.rc +121 -0
  174. pumaguard-ui/windows/runner/flutter_window.cpp +71 -0
  175. pumaguard-ui/windows/runner/flutter_window.h +33 -0
  176. pumaguard-ui/windows/runner/main.cpp +43 -0
  177. pumaguard-ui/windows/runner/resource.h +16 -0
  178. pumaguard-ui/windows/runner/resources/app_icon.ico +0 -0
  179. pumaguard-ui/windows/runner/runner.exe.manifest +14 -0
  180. pumaguard-ui/windows/runner/utils.cpp +65 -0
  181. pumaguard-ui/windows/runner/utils.h +19 -0
  182. pumaguard-ui/windows/runner/win32_window.cpp +288 -0
  183. pumaguard-ui/windows/runner/win32_window.h +102 -0
  184. pumaguard-21.post27.dist-info/RECORD +0 -83
  185. {pumaguard-21.post27.dist-info → pumaguard-21.post83.dist-info}/WHEEL +0 -0
  186. {pumaguard-21.post27.dist-info → pumaguard-21.post83.dist-info}/entry_points.txt +0 -0
  187. {pumaguard-21.post27.dist-info → pumaguard-21.post83.dist-info}/licenses/LICENSE +0 -0
  188. {pumaguard-21.post27.dist-info → pumaguard-21.post83.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,125 @@
1
+ name: pumaguard_ui
2
+ description: "A new Flutter project."
3
+ # The following line prevents the package from being accidentally published to
4
+ # pub.dev using `flutter pub publish`. This is preferred for private packages.
5
+ publish_to: "none" # Remove this line if you wish to publish to pub.dev
6
+
7
+ # The following defines the version and build number for your application.
8
+ # A version number is three numbers separated by dots, like 1.2.43
9
+ # followed by an optional build number separated by a +.
10
+ # Both the version and the builder number may be overridden in flutter
11
+ # build by specifying --build-name and --build-number, respectively.
12
+ # In Android, build-name is used as versionName while build-number used as versionCode.
13
+ # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
14
+ # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
15
+ # Read more about iOS versioning at
16
+ # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
17
+ # In Windows, build-name is used as the major, minor, and patch parts
18
+ # of the product and file versions while build-number is used as the build suffix.
19
+ version: 1.0.0+1
20
+
21
+ environment:
22
+ sdk: ^3.10.0-290.4.beta
23
+
24
+ # Dependencies specify other packages that your package needs in order to work.
25
+ # To automatically upgrade your package dependencies to the latest versions
26
+ # consider running `flutter pub upgrade --major-versions`. Alternatively,
27
+ # dependencies can be manually updated by changing the version numbers below to
28
+ # the latest version available on pub.dev. To see which dependencies have newer
29
+ # versions available, run `flutter pub outdated`.
30
+ dependencies:
31
+ flutter:
32
+ sdk: flutter
33
+
34
+ # The following adds the Cupertino Icons font to your application.
35
+ # Use with the CupertinoIcons class for iOS style icons.
36
+ cupertino_icons: ^1.0.8
37
+
38
+ # HTTP requests
39
+ http: ^1.1.0
40
+
41
+ # State management
42
+ provider: ^6.1.0
43
+
44
+ # JSON serialization
45
+ json_annotation: ^4.8.1
46
+
47
+ # Intl for date formatting
48
+ intl: ^0.20.2
49
+
50
+ # Shared preferences for storing UI preferences
51
+ shared_preferences: ^2.3.0
52
+
53
+ # Web APIs (modern replacement for dart:html)
54
+ web: ^1.1.0
55
+
56
+ # mDNS service discovery
57
+ multicast_dns: ^0.3.2+7
58
+
59
+ # Crypto for checksums
60
+ crypto: ^3.0.3
61
+
62
+ # File picker for selecting download destination
63
+ file_picker: ^10.0.0
64
+
65
+ # URL launcher for opening camera URL
66
+ url_launcher: ^6.3.0
67
+
68
+ dev_dependencies:
69
+ flutter_test:
70
+ sdk: flutter
71
+
72
+ # The "flutter_lints" package below contains a set of recommended lints to
73
+ # encourage good coding practices. The lint set provided by the package is
74
+ # activated in the `analysis_options.yaml` file located at the root of your
75
+ # package. See that file for information about deactivating specific lint
76
+ # rules and activating additional ones.
77
+ flutter_lints: ^6.0.0
78
+
79
+ # JSON serialization code generator
80
+ build_runner: ^2.4.0
81
+ json_serializable: ^6.7.0
82
+
83
+ # HTTP mocking for tests
84
+ mockito: ^5.4.4
85
+ http_mock_adapter: ^0.6.1
86
+
87
+ # For information on the generic Dart part of this file, see the
88
+ # following page: https://dart.dev/tools/pub/pubspec
89
+
90
+ # The following section is specific to Flutter packages.
91
+ flutter:
92
+ # The following line ensures that the Material Icons font is
93
+ # included with your application, so that you can use the icons in
94
+ # the material Icons class.
95
+ uses-material-design: true
96
+
97
+ # To add assets to your application, add an assets section, like this:
98
+ # assets:
99
+ # - images/a_dot_burr.jpeg
100
+ # - images/a_dot_ham.jpeg
101
+
102
+ # An image asset can refer to one or more resolution-specific "variants", see
103
+ # https://flutter.dev/to/resolution-aware-images
104
+
105
+ # For details regarding adding assets from package dependencies, see
106
+ # https://flutter.dev/to/asset-from-package
107
+
108
+ # Embedded fonts for offline/air-gapped use
109
+ fonts:
110
+ - family: Roboto
111
+ fonts:
112
+ - asset: fonts/Roboto-Regular.ttf
113
+ - asset: fonts/Roboto-Medium.ttf
114
+ weight: 500
115
+ - asset: fonts/Roboto-Bold.ttf
116
+ weight: 700
117
+ - asset: fonts/Roboto-Light.ttf
118
+ weight: 300
119
+ - family: RobotoMono
120
+ fonts:
121
+ - asset: fonts/RobotoMono-Regular.ttf
122
+ - asset: fonts/RobotoMono-Medium.ttf
123
+ weight: 500
124
+ - asset: fonts/RobotoMono-Bold.ttf
125
+ weight: 700
@@ -0,0 +1,515 @@
1
+ // Unit tests for Camera model
2
+ // Tests JSON serialization, deserialization, and helper methods
3
+
4
+ import 'package:flutter_test/flutter_test.dart';
5
+ import 'package:pumaguard_ui/models/camera.dart';
6
+
7
+ void main() {
8
+ group('Camera Model Tests', () {
9
+ group('Constructor', () {
10
+ test('creates Camera with all fields', () {
11
+ final camera = Camera(
12
+ hostname: 'TestCamera',
13
+ ipAddress: '192.168.52.100',
14
+ macAddress: 'aa:bb:cc:dd:ee:ff',
15
+ lastSeen: '2024-01-15T10:30:00Z',
16
+ status: 'connected',
17
+ );
18
+
19
+ expect(camera.hostname, 'TestCamera');
20
+ expect(camera.ipAddress, '192.168.52.100');
21
+ expect(camera.macAddress, 'aa:bb:cc:dd:ee:ff');
22
+ expect(camera.lastSeen, '2024-01-15T10:30:00Z');
23
+ expect(camera.status, 'connected');
24
+ });
25
+
26
+ test('creates Camera with empty strings', () {
27
+ final camera = Camera(
28
+ hostname: '',
29
+ ipAddress: '',
30
+ macAddress: '',
31
+ lastSeen: '',
32
+ status: '',
33
+ );
34
+
35
+ expect(camera.hostname, '');
36
+ expect(camera.ipAddress, '');
37
+ expect(camera.macAddress, '');
38
+ expect(camera.lastSeen, '');
39
+ expect(camera.status, '');
40
+ });
41
+ });
42
+
43
+ group('fromJson', () {
44
+ test('parses complete JSON correctly', () {
45
+ final json = {
46
+ 'hostname': 'Microseven-Cam1',
47
+ 'ip_address': '192.168.52.101',
48
+ 'mac_address': 'aa:bb:cc:dd:ee:01',
49
+ 'last_seen': '2024-01-15T10:30:00Z',
50
+ 'status': 'connected',
51
+ };
52
+
53
+ final camera = Camera.fromJson(json);
54
+
55
+ expect(camera.hostname, 'Microseven-Cam1');
56
+ expect(camera.ipAddress, '192.168.52.101');
57
+ expect(camera.macAddress, 'aa:bb:cc:dd:ee:01');
58
+ expect(camera.lastSeen, '2024-01-15T10:30:00Z');
59
+ expect(camera.status, 'connected');
60
+ });
61
+
62
+ test('handles null values with defaults', () {
63
+ final json = {
64
+ 'hostname': null,
65
+ 'ip_address': null,
66
+ 'mac_address': null,
67
+ 'last_seen': null,
68
+ 'status': null,
69
+ };
70
+
71
+ final camera = Camera.fromJson(json);
72
+
73
+ expect(camera.hostname, '');
74
+ expect(camera.ipAddress, '');
75
+ expect(camera.macAddress, '');
76
+ expect(camera.lastSeen, '');
77
+ expect(camera.status, 'unknown');
78
+ });
79
+
80
+ test('handles missing fields with defaults', () {
81
+ final json = <String, dynamic>{};
82
+
83
+ final camera = Camera.fromJson(json);
84
+
85
+ expect(camera.hostname, '');
86
+ expect(camera.ipAddress, '');
87
+ expect(camera.macAddress, '');
88
+ expect(camera.lastSeen, '');
89
+ expect(camera.status, 'unknown');
90
+ });
91
+
92
+ test('handles partial JSON with some fields missing', () {
93
+ final json = {
94
+ 'hostname': 'PartialCamera',
95
+ 'ip_address': '192.168.52.100',
96
+ };
97
+
98
+ final camera = Camera.fromJson(json);
99
+
100
+ expect(camera.hostname, 'PartialCamera');
101
+ expect(camera.ipAddress, '192.168.52.100');
102
+ expect(camera.macAddress, '');
103
+ expect(camera.lastSeen, '');
104
+ expect(camera.status, 'unknown');
105
+ });
106
+
107
+ test('handles wrong type by converting to string', () {
108
+ final json = {
109
+ 'hostname': 'TestCamera',
110
+ 'ip_address': '192.168.52.100',
111
+ 'mac_address': 'aa:bb:cc:dd:ee:ff',
112
+ 'last_seen': '2024-01-15T10:30:00Z',
113
+ 'status': 'connected',
114
+ };
115
+
116
+ final camera = Camera.fromJson(json);
117
+
118
+ expect(camera.hostname, isA<String>());
119
+ expect(camera.ipAddress, isA<String>());
120
+ expect(camera.macAddress, isA<String>());
121
+ });
122
+ });
123
+
124
+ group('toJson', () {
125
+ test('converts Camera to JSON correctly', () {
126
+ final camera = Camera(
127
+ hostname: 'TestCamera',
128
+ ipAddress: '192.168.52.100',
129
+ macAddress: 'aa:bb:cc:dd:ee:ff',
130
+ lastSeen: '2024-01-15T10:30:00Z',
131
+ status: 'connected',
132
+ );
133
+
134
+ final json = camera.toJson();
135
+
136
+ expect(json['hostname'], 'TestCamera');
137
+ expect(json['ip_address'], '192.168.52.100');
138
+ expect(json['mac_address'], 'aa:bb:cc:dd:ee:ff');
139
+ expect(json['last_seen'], '2024-01-15T10:30:00Z');
140
+ expect(json['status'], 'connected');
141
+ });
142
+
143
+ test('preserves empty strings in JSON', () {
144
+ final camera = Camera(
145
+ hostname: '',
146
+ ipAddress: '',
147
+ macAddress: '',
148
+ lastSeen: '',
149
+ status: '',
150
+ );
151
+
152
+ final json = camera.toJson();
153
+
154
+ expect(json['hostname'], '');
155
+ expect(json['ip_address'], '');
156
+ expect(json['mac_address'], '');
157
+ expect(json['last_seen'], '');
158
+ expect(json['status'], '');
159
+ });
160
+ });
161
+
162
+ group('JSON Round Trip', () {
163
+ test('fromJson and toJson are inverses', () {
164
+ final originalJson = {
165
+ 'hostname': 'RoundTripCamera',
166
+ 'ip_address': '192.168.52.150',
167
+ 'mac_address': 'aa:bb:cc:dd:ee:99',
168
+ 'last_seen': '2024-01-15T12:00:00Z',
169
+ 'status': 'disconnected',
170
+ };
171
+
172
+ final camera = Camera.fromJson(originalJson);
173
+ final resultJson = camera.toJson();
174
+
175
+ expect(resultJson['hostname'], originalJson['hostname']);
176
+ expect(resultJson['ip_address'], originalJson['ip_address']);
177
+ expect(resultJson['mac_address'], originalJson['mac_address']);
178
+ expect(resultJson['last_seen'], originalJson['last_seen']);
179
+ expect(resultJson['status'], originalJson['status']);
180
+ });
181
+ });
182
+
183
+ group('isConnected', () {
184
+ test('returns true when status is "connected"', () {
185
+ final camera = Camera(
186
+ hostname: 'TestCamera',
187
+ ipAddress: '192.168.52.100',
188
+ macAddress: 'aa:bb:cc:dd:ee:ff',
189
+ lastSeen: '2024-01-15T10:30:00Z',
190
+ status: 'connected',
191
+ );
192
+
193
+ expect(camera.isConnected, true);
194
+ });
195
+
196
+ test('returns false when status is "disconnected"', () {
197
+ final camera = Camera(
198
+ hostname: 'TestCamera',
199
+ ipAddress: '192.168.52.100',
200
+ macAddress: 'aa:bb:cc:dd:ee:ff',
201
+ lastSeen: '2024-01-15T10:30:00Z',
202
+ status: 'disconnected',
203
+ );
204
+
205
+ expect(camera.isConnected, false);
206
+ });
207
+
208
+ test('returns false when status is "unknown"', () {
209
+ final camera = Camera(
210
+ hostname: 'TestCamera',
211
+ ipAddress: '192.168.52.100',
212
+ macAddress: 'aa:bb:cc:dd:ee:ff',
213
+ lastSeen: '2024-01-15T10:30:00Z',
214
+ status: 'unknown',
215
+ );
216
+
217
+ expect(camera.isConnected, false);
218
+ });
219
+
220
+ test('returns false when status is empty', () {
221
+ final camera = Camera(
222
+ hostname: 'TestCamera',
223
+ ipAddress: '192.168.52.100',
224
+ macAddress: 'aa:bb:cc:dd:ee:ff',
225
+ lastSeen: '2024-01-15T10:30:00Z',
226
+ status: '',
227
+ );
228
+
229
+ expect(camera.isConnected, false);
230
+ });
231
+
232
+ test('returns false when status is any other value', () {
233
+ final camera = Camera(
234
+ hostname: 'TestCamera',
235
+ ipAddress: '192.168.52.100',
236
+ macAddress: 'aa:bb:cc:dd:ee:ff',
237
+ lastSeen: '2024-01-15T10:30:00Z',
238
+ status: 'pending',
239
+ );
240
+
241
+ expect(camera.isConnected, false);
242
+ });
243
+
244
+ test('is case-sensitive', () {
245
+ final camera = Camera(
246
+ hostname: 'TestCamera',
247
+ ipAddress: '192.168.52.100',
248
+ macAddress: 'aa:bb:cc:dd:ee:ff',
249
+ lastSeen: '2024-01-15T10:30:00Z',
250
+ status: 'Connected', // Capital C
251
+ );
252
+
253
+ expect(camera.isConnected, false);
254
+ });
255
+ });
256
+
257
+ group('displayName', () {
258
+ test('returns hostname when hostname is not empty', () {
259
+ final camera = Camera(
260
+ hostname: 'MyCoolCamera',
261
+ ipAddress: '192.168.52.100',
262
+ macAddress: 'aa:bb:cc:dd:ee:ff',
263
+ lastSeen: '2024-01-15T10:30:00Z',
264
+ status: 'connected',
265
+ );
266
+
267
+ expect(camera.displayName, 'MyCoolCamera');
268
+ });
269
+
270
+ test('returns IP address when hostname is empty', () {
271
+ final camera = Camera(
272
+ hostname: '',
273
+ ipAddress: '192.168.52.100',
274
+ macAddress: 'aa:bb:cc:dd:ee:ff',
275
+ lastSeen: '2024-01-15T10:30:00Z',
276
+ status: 'connected',
277
+ );
278
+
279
+ expect(camera.displayName, '192.168.52.100');
280
+ });
281
+
282
+ test('returns empty string when both hostname and IP are empty', () {
283
+ final camera = Camera(
284
+ hostname: '',
285
+ ipAddress: '',
286
+ macAddress: 'aa:bb:cc:dd:ee:ff',
287
+ lastSeen: '2024-01-15T10:30:00Z',
288
+ status: 'connected',
289
+ );
290
+
291
+ expect(camera.displayName, '');
292
+ });
293
+
294
+ test('prefers hostname over IP address', () {
295
+ final camera = Camera(
296
+ hostname: 'PreferredName',
297
+ ipAddress: '192.168.52.100',
298
+ macAddress: 'aa:bb:cc:dd:ee:ff',
299
+ lastSeen: '2024-01-15T10:30:00Z',
300
+ status: 'connected',
301
+ );
302
+
303
+ expect(camera.displayName, 'PreferredName');
304
+ expect(camera.displayName, isNot('192.168.52.100'));
305
+ });
306
+ });
307
+
308
+ group('cameraUrl', () {
309
+ test('returns IP address', () {
310
+ final camera = Camera(
311
+ hostname: 'TestCamera',
312
+ ipAddress: '192.168.52.100',
313
+ macAddress: 'aa:bb:cc:dd:ee:ff',
314
+ lastSeen: '2024-01-15T10:30:00Z',
315
+ status: 'connected',
316
+ );
317
+
318
+ expect(camera.cameraUrl, '192.168.52.100');
319
+ });
320
+
321
+ test('returns empty string when IP is empty', () {
322
+ final camera = Camera(
323
+ hostname: 'TestCamera',
324
+ ipAddress: '',
325
+ macAddress: 'aa:bb:cc:dd:ee:ff',
326
+ lastSeen: '2024-01-15T10:30:00Z',
327
+ status: 'connected',
328
+ );
329
+
330
+ expect(camera.cameraUrl, '');
331
+ });
332
+
333
+ test('handles IPv4 addresses', () {
334
+ final camera = Camera(
335
+ hostname: 'TestCamera',
336
+ ipAddress: '10.0.0.1',
337
+ macAddress: 'aa:bb:cc:dd:ee:ff',
338
+ lastSeen: '2024-01-15T10:30:00Z',
339
+ status: 'connected',
340
+ );
341
+
342
+ expect(camera.cameraUrl, '10.0.0.1');
343
+ });
344
+
345
+ test('handles IPv6 addresses', () {
346
+ final camera = Camera(
347
+ hostname: 'TestCamera',
348
+ ipAddress: 'fe80::1',
349
+ macAddress: 'aa:bb:cc:dd:ee:ff',
350
+ lastSeen: '2024-01-15T10:30:00Z',
351
+ status: 'connected',
352
+ );
353
+
354
+ expect(camera.cameraUrl, 'fe80::1');
355
+ });
356
+
357
+ test('handles IP with port', () {
358
+ final camera = Camera(
359
+ hostname: 'TestCamera',
360
+ ipAddress: '192.168.52.100:8080',
361
+ macAddress: 'aa:bb:cc:dd:ee:ff',
362
+ lastSeen: '2024-01-15T10:30:00Z',
363
+ status: 'connected',
364
+ );
365
+
366
+ expect(camera.cameraUrl, '192.168.52.100:8080');
367
+ });
368
+
369
+ test('handles localhost', () {
370
+ final camera = Camera(
371
+ hostname: 'TestCamera',
372
+ ipAddress: 'localhost',
373
+ macAddress: 'aa:bb:cc:dd:ee:ff',
374
+ lastSeen: '2024-01-15T10:30:00Z',
375
+ status: 'connected',
376
+ );
377
+
378
+ expect(camera.cameraUrl, 'localhost');
379
+ });
380
+ });
381
+
382
+ group('Special Characters and Edge Cases', () {
383
+ test('handles hostname with spaces', () {
384
+ final camera = Camera(
385
+ hostname: 'My Test Camera',
386
+ ipAddress: '192.168.52.100',
387
+ macAddress: 'aa:bb:cc:dd:ee:ff',
388
+ lastSeen: '2024-01-15T10:30:00Z',
389
+ status: 'connected',
390
+ );
391
+
392
+ expect(camera.hostname, 'My Test Camera');
393
+ expect(camera.displayName, 'My Test Camera');
394
+ });
395
+
396
+ test('handles hostname with special characters', () {
397
+ final camera = Camera(
398
+ hostname: 'Camera-1_Test@Site#A',
399
+ ipAddress: '192.168.52.100',
400
+ macAddress: 'aa:bb:cc:dd:ee:ff',
401
+ lastSeen: '2024-01-15T10:30:00Z',
402
+ status: 'connected',
403
+ );
404
+
405
+ expect(camera.hostname, 'Camera-1_Test@Site#A');
406
+ });
407
+
408
+ test('handles very long hostname', () {
409
+ final longHostname = 'A' * 100;
410
+ final camera = Camera(
411
+ hostname: longHostname,
412
+ ipAddress: '192.168.52.100',
413
+ macAddress: 'aa:bb:cc:dd:ee:ff',
414
+ lastSeen: '2024-01-15T10:30:00Z',
415
+ status: 'connected',
416
+ );
417
+
418
+ expect(camera.hostname, longHostname);
419
+ expect(camera.displayName.length, 100);
420
+ });
421
+
422
+ test('handles MAC address with uppercase letters', () {
423
+ final camera = Camera(
424
+ hostname: 'TestCamera',
425
+ ipAddress: '192.168.52.100',
426
+ macAddress: 'AA:BB:CC:DD:EE:FF',
427
+ lastSeen: '2024-01-15T10:30:00Z',
428
+ status: 'connected',
429
+ );
430
+
431
+ expect(camera.macAddress, 'AA:BB:CC:DD:EE:FF');
432
+ });
433
+
434
+ test('handles MAC address without colons', () {
435
+ final camera = Camera(
436
+ hostname: 'TestCamera',
437
+ ipAddress: '192.168.52.100',
438
+ macAddress: 'aabbccddeeff',
439
+ lastSeen: '2024-01-15T10:30:00Z',
440
+ status: 'connected',
441
+ );
442
+
443
+ expect(camera.macAddress, 'aabbccddeeff');
444
+ });
445
+
446
+ test('handles ISO8601 timestamp formats', () {
447
+ final timestamps = [
448
+ '2024-01-15T10:30:00Z',
449
+ '2024-01-15T10:30:00.123Z',
450
+ '2024-01-15T10:30:00+00:00',
451
+ '2024-01-15T10:30:00-05:00',
452
+ ];
453
+
454
+ for (final timestamp in timestamps) {
455
+ final camera = Camera(
456
+ hostname: 'TestCamera',
457
+ ipAddress: '192.168.52.100',
458
+ macAddress: 'aa:bb:cc:dd:ee:ff',
459
+ lastSeen: timestamp,
460
+ status: 'connected',
461
+ );
462
+
463
+ expect(camera.lastSeen, timestamp);
464
+ }
465
+ });
466
+ });
467
+
468
+ group('Real-World Scenarios', () {
469
+ test('creates camera from typical API response', () {
470
+ final json = {
471
+ 'hostname': 'Microseven',
472
+ 'ip_address': '192.168.52.101',
473
+ 'mac_address': 'aa:bb:cc:dd:ee:01',
474
+ 'last_seen': '2024-01-15T10:30:00Z',
475
+ 'status': 'connected',
476
+ };
477
+
478
+ final camera = Camera.fromJson(json);
479
+
480
+ expect(camera.hostname, 'Microseven');
481
+ expect(camera.isConnected, true);
482
+ expect(camera.displayName, 'Microseven');
483
+ expect(camera.cameraUrl, '192.168.52.101');
484
+ });
485
+
486
+ test('creates disconnected camera', () {
487
+ final json = {
488
+ 'hostname': 'OldCamera',
489
+ 'ip_address': '192.168.52.200',
490
+ 'mac_address': 'ff:ff:ff:ff:ff:ff',
491
+ 'last_seen': '2024-01-14T08:00:00Z',
492
+ 'status': 'disconnected',
493
+ };
494
+
495
+ final camera = Camera.fromJson(json);
496
+
497
+ expect(camera.isConnected, false);
498
+ expect(camera.status, 'disconnected');
499
+ });
500
+
501
+ test('creates camera with minimal information', () {
502
+ final json = {
503
+ 'ip_address': '192.168.52.250',
504
+ 'mac_address': 'aa:bb:cc:dd:ee:99',
505
+ };
506
+
507
+ final camera = Camera.fromJson(json);
508
+
509
+ expect(camera.displayName, '192.168.52.250');
510
+ expect(camera.status, 'unknown');
511
+ expect(camera.isConnected, false);
512
+ });
513
+ });
514
+ });
515
+ }