nx_server_plugin_sdk 1.0 Server Plugin SDK

i_device_agent.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 <nx/sdk/cloud_storage/i_codec_info.h>
6 #include <nx/sdk/cloud_storage/i_stream_reader.h>
7 #include <nx/sdk/cloud_storage/i_stream_writer.h>
8 #include <nx/sdk/i_device_info.h>
9 #include <nx/sdk/i_list.h>
10 #include <nx/sdk/i_integration.h>
11 #include <nx/sdk/i_string.h>
12 #include <nx/sdk/interface.h>
13 #include <nx/sdk/result.h>
14
15 namespace nx::sdk::cloud_storage {
16
21 class IDeviceAgent: public Interface<IDeviceAgent>
22 {
23 public:
24 static auto interfaceId() { return makeId("nx::sdk::archive::IDevice"); }
25
27 protected: virtual void getDeviceInfo(Result<const IDeviceInfo*>* outResult) const = 0;
28 public: virtual Result<const IDeviceInfo*> deviceInfo() const
29 {
30 Result<const IDeviceInfo*> result;
31 getDeviceInfo(&result);
32 return result;
33 }
34
35 protected: virtual void doCreateStreamWriter(
36 nxcip::MediaStreamQuality quality,
37 int64_t startTimeUs,
38 const IList<ICodecInfo>* codecInfoList,
39 const char* opaqueMetadata,
40 Result<IStreamWriter*>* outResult) = 0;
41
52 public: Result<IStreamWriter*> createStreamWriter(
53 nxcip::MediaStreamQuality quality,
54 int64_t startTimeMs,
55 const IList<ICodecInfo>* codecInfoList,
56 const char* opaqueMetadata)
57 {
58 Result<IStreamWriter*> result;
59 doCreateStreamWriter(quality, startTimeMs, codecInfoList, opaqueMetadata, &result);
60 return result;
61 }
62
63 protected: virtual void doCreateStreamReader(
64 const char* bucketUrl,
65 nxcip::MediaStreamQuality quality,
66 int64_t startTimeUs,
67 int64_t durationUs,
68 Result<IStreamReader*>* outResult) = 0;
69
76 public: Result<IStreamReader*> createStreamReader(
77 const char* bucketUrl,
78 nxcip::MediaStreamQuality quality,
79 int64_t startTimeMs,
80 int64_t durationMs)
81 {
82 Result<IStreamReader*> result;
83 doCreateStreamReader(bucketUrl, quality, startTimeMs, durationMs, &result);
84 return result;
85 }
86 };
87
88 } // namespace nx::sdk::cloud_storage
nx::sdk::cloud_storage::IDeviceAgent::createStreamReader
Result< IStreamReader * > createStreamReader(const char *bucketUrl, nxcip::MediaStreamQuality quality, int64_t startTimeMs, int64_t durationMs)
Definition: i_device_agent.h:76
nx::sdk::Interface
Definition: interface.h:48
nx::sdk::cloud_storage::IDeviceAgent::createStreamWriter
Result< IStreamWriter * > createStreamWriter(nxcip::MediaStreamQuality quality, int64_t startTimeMs, const IList< ICodecInfo > *codecInfoList, const char *opaqueMetadata)
Definition: i_device_agent.h:52
nx::sdk::cloud_storage::IDeviceAgent::getDeviceInfo
virtual void getDeviceInfo(Result< const IDeviceInfo *> *outResult) const =0
nx::sdk::cloud_storage::IDeviceAgent
Definition: i_device_agent.h:21
nx::sdk::Result
Definition: result.h:52
nx::sdk::cloud_storage
Definition: algorithm.cpp:9
nxcip::MediaStreamQuality
MediaStreamQuality
Definition: camera_plugin.h:1189
nx::sdk::IList
Definition: i_list.h:10
nx::sdk::IRefCountable::makeId
static const InterfaceId * makeId(const char(&charArray)[len])
Definition: i_ref_countable.h:77