Digital Barriers
Digital Barriers EdgeVis Decoder SDK
Loading...
Searching...
No Matches
Service.h
Go to the documentation of this file.
1
2// Copyright (c) 2016 Digital Barriers
4
30
31#pragma once
32
33#include "ServiceState.h"
34#include "Pimpl.h"
35#include <string>
36#include "EdgeVisSDK.h"
37#include "OpResult.h"
38
39class ControlManager;
40
41namespace EdgeVisDecoderSDK
42{
43 class ServiceImpl;
44 class IAsset;
45 class Server;
46 class IServiceListener;
47
48 class Service : public EdgeVisSDKPimpl<ServiceImpl>
49 {
50 public:
51 Service() {}
52 Service(
53 const std::wstring& serviceName,
54 std::weak_ptr<IAsset> parent = std::weak_ptr<IAsset>(),
55 int32_t keepAliveInterval = -1,
56 int32_t idleTimeoutInterval = -1
57 );
58
59 DB_EDGEVIS_SDK virtual ~Service();
60
66 DB_EDGEVIS_SDK std::wstring ServiceName() const;
67
74 void UpdateState(ServiceState state, std::wstring user);
75
84 DB_EDGEVIS_SDK bool Started() const;
85
92 DB_EDGEVIS_SDK int32_t KeepAliveInterval() const;
93
100 DB_EDGEVIS_SDK int32_t IdleTimeoutInterval() const;
101
108 DB_EDGEVIS_SDK void SetIdleTimeoutInterval(int32_t idleTimeout);
109
115 DB_EDGEVIS_SDK bool KeepAliveTaskRunning() const;
116
122 DB_EDGEVIS_SDK bool IdleTimeoutRunning() const;
123
124 public:
125 DB_EDGEVIS_SDK virtual OpResult Start() = 0;
126 DB_EDGEVIS_SDK virtual OpResult Stop() = 0;
127
134 DB_EDGEVIS_SDK void RegisterListener(IServiceListener* listener);
135
142 DB_EDGEVIS_SDK void UnregisterListener(IServiceListener* listener);
143
150 DB_EDGEVIS_SDK int64_t GetServiceUptime() const;
151
152 };
153}
OpResult
Result of an operation.
Definition OpResult.h:26
ServiceState
Service states.
Definition ServiceState.h:23
An Asset is a tangible asset on the system such as an Encoder or a Server.
Definition IAsset.h:26
Defines an interface for a class that listens for incoming state changes from a service.
Definition IServiceListener.h:37
A Server interface is used to make a connection to an EdgeVis server.
Definition Server.h:56
DB_EDGEVIS_SDK int32_t IdleTimeoutInterval() const
Retrieves the idle timeout interval for the service.
DB_EDGEVIS_SDK std::wstring ServiceName() const
Gets the name of the Service.
DB_EDGEVIS_SDK void UnregisterListener(IServiceListener *listener)
Removes the specified listener from the set of listeners to be notified about service state changes.
DB_EDGEVIS_SDK bool KeepAliveTaskRunning() const
Determines if the Keep alive task is currently running.
DB_EDGEVIS_SDK bool IdleTimeoutRunning() const
Determines if the idle timeout is currently running.
DB_EDGEVIS_SDK int64_t GetServiceUptime() const
Retrieve the number of milliseconds since the service was started.
DB_EDGEVIS_SDK int32_t KeepAliveInterval() const
Retrieves the keep alive interval for the service.
DB_EDGEVIS_SDK bool Started() const
Determines whether the service has been started or not.
void UpdateState(ServiceState state, std::wstring user)
Updates the service's state.
DB_EDGEVIS_SDK void SetIdleTimeoutInterval(int32_t idleTimeout)
Sets the idle timeout interval for the service.
DB_EDGEVIS_SDK void RegisterListener(IServiceListener *listener)
Registers the specified listener to be notified when the service state changes.
The EdgeVis Decoder SDK namespace.