nx_server_plugin_sdk 1.0 Server Plugin SDK

i_engine.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #pragma once
4
5 #include <camera/camera_plugin.h>
6 #include <nx/sdk/i_device_info.h>
7 #include <nx/sdk/i_list.h>
8 #include <nx/sdk/i_integration.h>
9 #include <nx/sdk/interface.h>
10 #include <nx/sdk/ptr.h>
11 #include <nx/sdk/result.h>
12
13 #include "i_device_agent.h"
14
15 namespace nx::sdk::cloud_storage {
16
17 enum class MetadataType
18 {
19 motion,
20 analytics,
21 bookmark,
22 };
23
24 struct StorageSpace
25 {
26 int64_t totalSpace = -1;
27 int64_t freeSpace = -1;
28 };
29
30 enum class TrackImageType
31 {
32 bestShot,
33 title,
34 };
35
45 class IEngine: public Interface<IEngine>
46 {
47 public:
48 static auto interfaceId() { return makeId("nx::sdk::archive::IEngine"); }
49
50 protected: virtual void doObtainDeviceAgent(
51 Result<IDeviceAgent*>* outResult, const IDeviceInfo* deviceInfo) = 0;
52
56 public: virtual Result<IDeviceAgent*> obtainDeviceAgent(const IDeviceInfo* deviceInfo)
57 {
58 Result<IDeviceAgent*> result;
59 doObtainDeviceAgent(&result, deviceInfo);
60 return result;
61 }
62
63 protected: virtual void doQueryBookmarks(const char* filter, Result<IString*>* outResult) = 0;
64
70 public: Result<IString*> queryBookmarks(const char* filter)
71 {
72 Result<IString*> result;
73 doQueryBookmarks(filter, &result);
74 return result;
75 }
76
77 public: virtual ErrorCode deleteBookmark(const char* bookmarkId) = 0;
78
79 protected: virtual void doQueryMotionTimePeriods(
80 const char* filter, Result<IString*>* outResult) = 0;
81
87 public: Result<IString*> queryMotionTimePeriods(const char* filter)
88 {
89 Result<IString*> result;
90 doQueryMotionTimePeriods(filter, &result);
91 return result;
92 }
93
94 protected: virtual void doQueryAnalytics(const char* filter, Result<IString*>* outResult) = 0;
95
101 public: Result<IString*> queryAnalytics(const char* filter)
102 {
103 Result<IString*> result;
104 doQueryAnalytics(filter, &result);
105 return result;
106 }
107
108 protected: virtual void doQueryAnalyticsTimePeriods(
109 const char* filter, Result<IString*>* outResult) = 0;
110
116 public: Result<IString*> queryAnalyticsTimePeriods(const char* filter)
117 {
118 Result<IString*> result;
119 doQueryAnalyticsTimePeriods(filter, &result);
120 return result;
121 }
122
130 public: virtual ErrorCode saveMetadata(
131 const char* deviceId, MetadataType type, const char* data) = 0;
132
138 public: virtual void flushMetadata(MetadataType type) = 0;
139
144 public: Result<IString*> fetchTrackImage(const char* objectTrackId, TrackImageType type) const
145 {
146 Result<IString*> result;
147 doFetchTrackImage(objectTrackId, type, &result);
148 return result;
149 }
150
151 protected: virtual void doFetchTrackImage(
152 const char* objectTrackId, TrackImageType type, Result<IString*>* outResult) const = 0;
153
157 public: virtual void startAsyncTasks(const char* lastSequenceId) = 0;
158
162 public: virtual void stopAsyncTasks() = 0;
163
168 public: virtual bool isOnline() const = 0;
169
173 public: virtual ErrorCode storageSpace(StorageSpace* storageSpace) const = 0;
174 };
175
176 } // namespace nx::sdk::cloud_storage
nx::sdk::cloud_storage::StorageSpace
Definition: i_engine.h:24
nx::sdk::cloud_storage::IEngine::queryAnalyticsTimePeriods
Result< IString * > queryAnalyticsTimePeriods(const char *filter)
Definition: i_engine.h:116
nx::sdk::Interface
Definition: interface.h:48
nx::sdk::cloud_storage::IEngine::queryBookmarks
Result< IString * > queryBookmarks(const char *filter)
Definition: i_engine.h:70
nx::sdk::cloud_storage::IEngine::queryMotionTimePeriods
Result< IString * > queryMotionTimePeriods(const char *filter)
Definition: i_engine.h:87
nx::sdk::cloud_storage::IEngine::obtainDeviceAgent
virtual Result< IDeviceAgent * > obtainDeviceAgent(const IDeviceInfo *deviceInfo)
Definition: i_engine.h:56
nx::sdk::cloud_storage::IEngine
Definition: i_engine.h:45
nx::sdk::cloud_storage::IEngine::isOnline
virtual bool isOnline() const =0
nx::sdk::cloud_storage::IEngine::fetchTrackImage
Result< IString * > fetchTrackImage(const char *objectTrackId, TrackImageType type) const
Definition: i_engine.h:144
nx::sdk::cloud_storage::IEngine::saveMetadata
virtual ErrorCode saveMetadata(const char *deviceId, MetadataType type, const char *data)=0
nx::sdk::cloud_storage::IEngine::storageSpace
virtual ErrorCode storageSpace(StorageSpace *storageSpace) const =0
nx::sdk::IDeviceInfo
Definition: i_device_info.h:13
nx::sdk::Result
Definition: result.h:52
nx::sdk::cloud_storage::IEngine::stopAsyncTasks
virtual void stopAsyncTasks()=0
nx::sdk::cloud_storage::IEngine::startAsyncTasks
virtual void startAsyncTasks(const char *lastSequenceId)=0
nx::sdk::cloud_storage
Definition: algorithm.cpp:9
nx::sdk::cloud_storage::IEngine::flushMetadata
virtual void flushMetadata(MetadataType type)=0
nx::sdk::cloud_storage::IEngine::queryAnalytics
Result< IString * > queryAnalytics(const char *filter)
Definition: i_engine.h:101
nx::sdk::IRefCountable::makeId
static const InterfaceId * makeId(const char(&charArray)[len])
Definition: i_ref_countable.h:77