Server.h
Go to the documentation of this file.
1 // Copyright (c) 2016 Digital Barriers
4 
25 #pragma once
26 
27 #include "OpResult.h"
28 #include "EdgeVisSDK.h"
29 #include "ServerConnectInfo.h"
30 #include "Device.h"
31 #include "Encoder.h"
32 #include "Pimpl.h"
33 #include "ConnectionStrategy.h"
34 #include "ServerAddresses.h"
35 #include "Credentials.h"
36 #include "ClientSecurityPolicy.h"
37 #include "LoggingLevel.h"
38 
39 namespace EdgeVisDecoderSDK
40 {
41  typedef EdgeVisSDKCore::ServerAddresses ServerAddresses;
42 
43  class ServerImpl;
44  class PasswordResetInfo;
45  class ServerInfo;
46  class Stream;
47  class IServerListener;
48  class IServerEventListener;
49  class CamsRuleManager;
50  class CamsNotificationManager;
51  class UserNotificationPreferences;
52  class MFALoginResponse;
53  class SSOOpenIdLoginResponse;
54 
55  class Server : public EdgeVisSDKPimpl<ServerImpl>
56  {
57  public:
58 
59  DB_EDGEVIS_SDK Server();
60 
68  DB_EDGEVIS_SDK Server( const std::wstring& appName, const std::wstring& appMetadata );
69 
70  EdgeVisSDKPimplWeakConstructor(Server);
71 
72  DB_EDGEVIS_SDK virtual ~Server();
73 
79  DB_EDGEVIS_SDK static std::wstring ClientVersion();
80 
94  DB_EDGEVIS_SDK void SetClusterInfoCachingEnabled(bool enabled);
95 
127  DB_EDGEVIS_SDK OpResult Connect(
128  const ServerAddresses& hostAddresses,
129  const std::wstring& username,
130  const std::wstring& password,
131  const std::wstring& new_password,
132  ServerAddresses& availableAddresses,
133  ConnectionStrategy connect_strategy,
135  );
136 
171  DB_EDGEVIS_SDK OpResult Connect(
172  const ServerAddresses& hostAddresses,
173  const Credentials credentials,
174  ServerAddresses& availableAddresses,
175  ConnectionStrategy connect_strategy,
177  );
178 
210  DB_EDGEVIS_SDK OpResult Connect(
211  const ServerAddresses& hostAddresses,
212  const Credentials credentials,
213  ServerAddresses& availableAddresses
214  );
215 
223  DB_EDGEVIS_SDK PasswordResetInfo GetPasswordResetInfo() const;
224 
232  DB_EDGEVIS_SDK MFALoginResponse GetMFALoginResponse() const;
233 
239  DB_EDGEVIS_SDK SSOOpenIdLoginResponse GetSSOOpenIdLoginResponse() const;
240 
247  DB_EDGEVIS_SDK std::wstring GetDevicePassword() const;
248 
254  DB_EDGEVIS_SDK bool HasCams() const;
255 
262  DB_EDGEVIS_SDK bool SupportsClientCamsRuleBuilder() const;
263 
279  DB_EDGEVIS_SDK ServerInfo QueryServerInfo( const ServerAddresses& hostAddresses );
280 
312  DB_EDGEVIS_SDK OpResult ValidateCredentials(
313  const ServerAddresses& hostAddresses,
314  const Credentials& credentials,
315  ServerAddresses& availableAddresses);
316 
352  DB_EDGEVIS_SDK OpResult ValidateCredentials( const ServerAddresses& hostAddresses,
353  const std::wstring& username,
354  const std::wstring& password,
355  const std::wstring& new_password,
356  ServerAddresses& availableAddresses);
357 
362  DB_EDGEVIS_SDK void CancelQueryServerInfo();
363 
368  DB_EDGEVIS_SDK void CancelValidateCredentials();
369 
378 
384  DB_EDGEVIS_SDK int32_t GetAvailableLicenses() const;
385 
390  DB_EDGEVIS_SDK void Disconnect();
391 
397  DB_EDGEVIS_SDK bool IsConnected() const;
398 
404  DB_EDGEVIS_SDK ServerInfo GetServerInfo() const;
405 
424  DB_EDGEVIS_SDK OpResult QueryEncoders(std::vector<Encoder> &result);
425 
445  DB_EDGEVIS_SDK OpResult GetEncoders(std::vector<Encoder> &result);
446 
465  DB_EDGEVIS_SDK OpResult QueryEncoder( Encoder &result, const std::wstring& name );
466 
478  DB_EDGEVIS_SDK OpResult GetDevices(std::vector<Device>& result) const;
479 
493  DB_EDGEVIS_SDK OpResult GetEncodersForDeviceUUID(const std::wstring& deviceUUID, std::vector<Encoder>& result) const;
494 
508  DB_EDGEVIS_SDK OpResult GetDeviceForEncoderUUID(const std::wstring& encoderUUID, Device& result);
509 
516  DB_EDGEVIS_SDK void RegisterListener( IServerListener* listener );
517 
524  DB_EDGEVIS_SDK void UnregisterListener( IServerListener* listener );
525 
532  DB_EDGEVIS_SDK void RegisterEventListener(IServerEventListener* listener);
533 
540  DB_EDGEVIS_SDK void UnregisterEventListener(IServerEventListener* listener);
541 
561  DB_EDGEVIS_SDK Device GetDevice(const std::wstring& name) const;
562 
582  DB_EDGEVIS_SDK Device GetDeviceByUUID(const std::wstring& uuid) const;
583 
602  DB_EDGEVIS_SDK Encoder GetEncoder( const std::wstring& name ) const;
603 
622  DB_EDGEVIS_SDK Encoder GetEncoderByUUID(const std::wstring& uuid) const;
623 
630  DB_EDGEVIS_SDK std::wstring Name() const;
631 
638  DB_EDGEVIS_SDK std::wstring Version() const;
639 
648  DB_EDGEVIS_SDK std::wstring UniqueID() const;
649 
661  DB_EDGEVIS_SDK bool IsAtLeastVersion(int32_t major, int32_t minor, int32_t build) const;
662 
669  DB_EDGEVIS_SDK bool SupportsUserConfig();
670 
681  DB_EDGEVIS_SDK OpResult GetUserConfig(UserNotificationPreferences& user_config);
682 
704  DB_EDGEVIS_SDK OpResult SetUserConfig(UserNotificationPreferences& user_config);
705 
713  DB_EDGEVIS_SDK bool SupportsEncoderManagerURLs() const;
714 
721  DB_EDGEVIS_SDK bool SupportsCamsTemplates() const;
722 
730  DB_EDGEVIS_SDK std::wstring GetWebAPIToken() const;
731 
737  DB_EDGEVIS_SDK std::wstring UserName() const;
738 
746  DB_EDGEVIS_SDK std::wstring UserAccountName() const;
747 
755  DB_EDGEVIS_SDK int64_t GetServerClockOffset() const;
756 
762  DB_EDGEVIS_SDK int64_t GetTotalBytesSent();
763 
769  DB_EDGEVIS_SDK int64_t GetTotalBytesReceived();
770 
774  DB_EDGEVIS_SDK void ResetDataUsageStats();
775 
782  DB_EDGEVIS_SDK bool SupportsClientSecurityPolicy() const;
783 
791 
802  DB_EDGEVIS_SDK OpResult GetClientSecurityPolicy(ClientSecurityPolicy& policy);
803 
818  DB_EDGEVIS_SDK void SetLoggingLevel(EdgeVisSDKCore::LoggingLevel level, const std::wstring& log_location);
819 
826  DB_EDGEVIS_SDK bool SupportsStreamProfiles() const;
827  };
828 }
DB_EDGEVIS_SDK std::wstring Name() const
Returns the name of friendly name of the server currently connected to If not connected this will ret...
DB_EDGEVIS_SDK std::wstring Version() const
Returns the name of version number of the server currently connected to If not connected this will re...
DB_EDGEVIS_SDK MFALoginResponse GetMFALoginResponse() const
Retrieve the multiple factor login response.
DB_EDGEVIS_SDK PasswordResetInfo GetPasswordResetInfo() const
If a users password must be reset then the limitation for the password can be retrieved and used to e...
The interface for receiving CAMS notification events from the Server.
Definition: IServerEventListener.h:37
DB_EDGEVIS_SDK std::wstring UserAccountName() const
Returns the name of the account name for the current user.
DB_EDGEVIS_SDK bool SupportsUserConfig()
Returns if the server supports user config using the GetUserConfig and SetUserConfig methods...
DB_EDGEVIS_SDK void SetLoggingLevel(EdgeVisSDKCore::LoggingLevel level, const std::wstring &log_location)
Set the logging level and log file location.
DB_EDGEVIS_SDK void SetClusterInfoCachingEnabled(bool enabled)
Enables or disables automatic caching of the server cluster token in a file managed by the SDK...
DB_EDGEVIS_SDK std::wstring GetWebAPIToken() const
Retrieve a new web API token from the Server for the currently logged in user.
DB_EDGEVIS_SDK std::wstring UniqueID() const
Returns the name of Unique ID of the server currently connected to.
DB_EDGEVIS_SDK OpResult GetClientSecurityPolicy(ClientSecurityPolicy &policy)
Gets the cached Client Security Policy object.
DB_EDGEVIS_SDK OpResult GetDeviceForEncoderUUID(const std::wstring &encoderUUID, Device &result)
Returns the parent Device for an Encoder UUID.
A class representing the current user&#39;s CAMS notification preferences.
Definition: UserNotificationPreferences.h:31
DB_EDGEVIS_SDK Device GetDeviceByUUID(const std::wstring &uuid) const
Returns the Device object with the specified UUID.
DB_EDGEVIS_SDK ServerInfo GetServerInfo() const
Returns the current ServerInfo for the connected server.
DB_EDGEVIS_SDK Encoder GetEncoder(const std::wstring &name) const
Returns the Encoder object with the specified name.
DB_EDGEVIS_SDK void Disconnect()
Disconnects the session from the Server.
DB_EDGEVIS_SDK void RegisterEventListener(IServerEventListener *listener)
Registers the specified listener to be notified when a CAMS notification associated with the Server h...
DB_EDGEVIS_SDK bool IsAtLeastVersion(int32_t major, int32_t minor, int32_t build) const
Will check that the server is at least a certain version number.
DB_EDGEVIS_SDK SSOOpenIdLoginResponse GetSSOOpenIdLoginResponse() const
Retrieve the SSO OpenId login response.
DB_EDGEVIS_SDK OpResult GetEncodersForDeviceUUID(const std::wstring &deviceUUID, std::vector< Encoder > &result) const
Returns a list of Encoders available for a particular Device using its UUID.
Describes the client security policy set at the server.
Definition: ClientSecurityPolicy.h:27
A Device represents a physical device that may provide one or more Encoder instances.
Definition: Device.h:32
DB_EDGEVIS_SDK bool IsConnected() const
Determines of the Server session is currently connected.
Holds the server credentials for the user logging in.
Definition: Credentials.h:29
DB_EDGEVIS_SDK std::wstring UserName() const
Returns the name of the current user.
DB_EDGEVIS_SDK OpResult SetUserConfig(UserNotificationPreferences &user_config)
Update the current user&#39;s notification preferences on the server.
Correct the image for aspect ratio.
Definition: ServerConnectInfo.h:28
DB_EDGEVIS_SDK CamsNotificationManager GetCamsNotificationManager()
Retrieve the CAMS notification manager for this server.
DB_EDGEVIS_SDK Encoder GetEncoderByUUID(const std::wstring &uuid) const
Returns the Encoder object with the specified UUID.
static DB_EDGEVIS_SDK std::wstring ClientVersion()
Returns the version of the SDK.
DB_EDGEVIS_SDK void RegisterListener(IServerListener *listener)
Registers the specified listener to be notified when an event associated with the Server happens...
DB_EDGEVIS_SDK int64_t GetTotalBytesSent()
Returns the current total number of bytes sent on this server.
DB_EDGEVIS_SDK OpResult QueryEncoder(Encoder &result, const std::wstring &name)
Sends a query to the server to obtain information about an encoder that the user has access to...
ConnectionStrategy
The strategy the SDK should use to connect to a cluster of servers.
Definition: ConnectionStrategy.h:20
Holds the current status of the server.
Definition: ServerInfo.h:29
DB_EDGEVIS_SDK void CancelValidateCredentials()
Cancels the query for the Validate Credentials.
DB_EDGEVIS_SDK OpResult GetDevices(std::vector< Device > &result) const
Returns a list of all available Devices.
DB_EDGEVIS_SDK Device GetDevice(const std::wstring &name) const
Returns the Device object with the specified name.
DB_EDGEVIS_SDK int32_t GetAvailableLicenses() const
Returns the number of available licenses on the system.
DB_EDGEVIS_SDK bool SupportsClientCamsRuleBuilder() const
Check if this server supports CAMS rule builder in client applications.
DB_EDGEVIS_SDK void UnregisterListener(IServerListener *listener)
Removes the specified listener from the set of listeners to be notified about Server.
This stores server addresses that the SDK should use to connect to.
Definition: ServerAddresses.h:48
An Encoder interface represents an Encoder that is managed by the server.
Definition: Encoder.h:58
DB_EDGEVIS_SDK ServerInfo QueryServerInfo(const ServerAddresses &hostAddresses)
Queries the server to obtain its current information.
DB_EDGEVIS_SDK int64_t GetTotalBytesReceived()
Returns the current total number of bytes received on this server.
DB_EDGEVIS_SDK bool SupportsEncoderManagerURLs() const
Returns if the server supports encoder manager URLs obtained using the Encoder::GetManagerURL method...
Describes the details required for resetting a users password.
Definition: PasswordResetInfo.h:29
DB_EDGEVIS_SDK void ResetDataUsageStats()
Resets the count of the total number of bytes sent and received for this server.
DB_EDGEVIS_SDK void UnregisterEventListener(IServerEventListener *listener)
Removes the specified listener from the set of listeners to be notified about Server CAMS notificatio...
DB_EDGEVIS_SDK bool SupportsStreamProfiles() const
Returns if the server supports the new stream profile configuration API for encoders.
DB_EDGEVIS_SDK int64_t GetServerClockOffset() const
Returns difference in the clock timestamps between the server clock and the clock on the client machi...
A Server interface is used to make a connection to an EdgeVis server.
Definition: Server.h:55
DB_EDGEVIS_SDK OpResult QueryClientSecurityPolicy(ClientSecurityPolicy &policy)
Queries the server to obtain the client security policy for the current user.
DB_EDGEVIS_SDK bool SupportsCamsTemplates() const
Returns if the server supports template fields in CAMS rules.
The EdgeVis Decoder SDK namespace.
LoggingLevel
Contains the available logging levels.
Definition: LoggingLevel.h:19
DB_EDGEVIS_SDK bool HasCams() const
Check if this server supports CAMS notifications.
DB_EDGEVIS_SDK bool SupportsClientSecurityPolicy() const
Returns if the server supports client security policies.
DB_EDGEVIS_SDK OpResult ValidateCredentials(const ServerAddresses &hostAddresses, const Credentials &credentials, ServerAddresses &availableAddresses)
Test that the supplied credentials are valid for the given server.
DB_EDGEVIS_SDK OpResult Connect(const ServerAddresses &hostAddresses, const std::wstring &username, const std::wstring &password, const std::wstring &new_password, ServerAddresses &availableAddresses, ConnectionStrategy connect_strategy, ServerConnectInfo flags=SCI_ASPECT_CORRECT)
Connects to an EdgeVis server.
DB_EDGEVIS_SDK void CancelQueryServerInfo()
Cancels the query for the ServerInfo.
DB_EDGEVIS_SDK std::wstring GetDevicePassword() const
Retrieve a device password to use when logging in.
Holds the result of a time based one time passcode (OTP) login attempt.
Definition: MFALoginResponse.h:32
DB_EDGEVIS_SDK OpResult GetUserConfig(UserNotificationPreferences &user_config)
Retrieve the current user&#39;s notification preferences from the server.
The CamsNotificationManager facilitates interactions with CAMS notifications stored at the server...
Definition: CamsNotificationManager.h:32
DB_EDGEVIS_SDK OpResult QueryEncoders(std::vector< Encoder > &result)
Sends a query to the server to find all the Encoders that the currently connected user has permission...
DB_EDGEVIS_SDK OpResult GetEncoders(std::vector< Encoder > &result)
Returns a list of all available Encoders.
OpResult
Result of an operation.
Definition: OpResult.h:25
The interface for the Server.
Definition: IServerListener.h:42
ServerConnectInfo
This contains values representing configuration info for the local server object on connection...
Definition: ServerConnectInfo.h:25