C++ API¶
Namespaces¶
-
namespace
DRMLib
¶ -
class
Exception
: public runtime_error¶ - #include </home/docs/checkouts/readthedocs.org/user_builds/sd-drmlib/checkouts/latest/include/accelize/drm/error.h>
Exception class with error code for the DRMLib.
This class is an exception that may be thrown by the DRMLib in case of synchronous error
-
class
MeteringSessionManager
¶ - #include </home/docs/checkouts/readthedocs.org/user_builds/sd-drmlib/checkouts/latest/include/accelize/drm/session_manager.h>
manages a session of metering on a DRM controller.
The session of metering life-cycle is:
- 1. starting a session : from a locked DRM, install the first license from Accelize WebService which unlocks the protected IPs.
- 2. keep protected IPs unlocked by regularly supplying licenses and uploading metering : this operation will be done in a dedicated thread managed by this class. It will involve communication with the DRM controller and the Accelize WebService.
- 3. May be paused : the DRM is no longer supplied with new licenses. Between pause(3) and resume(4) the end of license time maybe reached and therefore the protected IPs may be locked.
- 4. May be resumed after paused : the manager makes sure that the protected IPs is unlocked back again.
- 5. stop a session : uploads last metering data to the Accelize WebService and locks the protected IPs. After stop the session is correctly ended on the Accelize Webservice.
-
class
Classes¶
-
class
MeteringSessionManager
manages a session of metering on a DRM controller.
The session of metering life-cycle is:
- 1. starting a session : from a locked DRM, install the first license from Accelize WebService which unlocks the protected IPs.
- 2. keep protected IPs unlocked by regularly supplying licenses and uploading metering : this operation will be done in a dedicated thread managed by this class. It will involve communication with the DRM controller and the Accelize WebService.
- 3. May be paused : the DRM is no longer supplied with new licenses. Between pause(3) and resume(4) the end of license time maybe reached and therefore the protected IPs may be locked.
- 4. May be resumed after paused : the manager makes sure that the protected IPs is unlocked back again.
- 5. stop a session : uploads last metering data to the Accelize WebService and locks the protected IPs. After stop the session is correctly ended on the Accelize Webservice.
-
class
Exception
: public runtime_error Exception class with error code for the DRMLib.
This class is an exception that may be thrown by the DRMLib in case of synchronous error
Files¶
session_manager.h¶
-
namespace
Accelize
¶ -
namespace
DRMLib
-
class
MeteringSessionManager
- #include </home/docs/checkouts/readthedocs.org/user_builds/sd-drmlib/checkouts/latest/include/accelize/drm/session_manager.h>
manages a session of metering on a DRM controller.
The session of metering life-cycle is:
- 1. starting a session : from a locked DRM, install the first license from Accelize WebService which unlocks the protected IPs.
- 2. keep protected IPs unlocked by regularly supplying licenses and uploading metering : this operation will be done in a dedicated thread managed by this class. It will involve communication with the DRM controller and the Accelize WebService.
- 3. May be paused : the DRM is no longer supplied with new licenses. Between pause(3) and resume(4) the end of license time maybe reached and therefore the protected IPs may be locked.
- 4. May be resumed after paused : the manager makes sure that the protected IPs is unlocked back again.
- 5. stop a session : uploads last metering data to the Accelize WebService and locks the protected IPs. After stop the session is correctly ended on the Accelize Webservice.
Public Types
-
typedef std::function<int(uint32_t, uint32_t *)>
ReadReg32ByOffsetHandler
¶ Read callback function by offset.
Offset is relative to first register of DRM controller
- Warning
- This function must be thread-safe in case of concurrency on the register bus
-
typedef std::function<int(uint32_t, uint32_t)>
WriteReg32ByOffsetHandler
¶ Write callback function by offset.
Offset is relative to first register of DRM controller
- Warning
- This function must be thread-safe in case of concurrency on the register bus
-
typedef std::function<int(const std::string&, uint32_t *)>
ReadReg32ByNameHandler
¶ Read callback function by register name.
- Note
- This function is intended to be used with QuickPlayLib that manages registers by names
- Warning
- This function must be thread-safe in case of concurrency on the register bus
-
typedef std::function<int(const std::string&, uint32_t)>
WriteReg32ByNameHandler
¶ Write callback function by register name.
- Note
- This function is intended to be used with QuickPlayLib that manages registers by names
- Warning
- This function must be thread-safe in case of concurrency on the register bus
-
typedef std::function<void(const std::string&)>
ErrorCallBackHandler
¶ Asynchronous Error callback function.
This function is called in case of asynchronous error during operation
Public Functions
-
MeteringSessionManager
()¶ No default constructor.
-
MeteringSessionManager
(const std::string &conf_file_path, const std::string &cred_file_path, ReadReg32ByOffsetHandler f_drm_read32, WriteReg32ByOffsetHandler f_drm_write32, ErrorCallBackHandler f_error_cb)¶ Constructor with “ByOffset” functions.
Constructs a MeteringSessionManager with ByOffset callback functions.
- See
- ReadReg32ByOffsetHandler WriteReg32ByOffsetHandler
- Parameters
conf_file_path
: : Path to json configuration file with configuration of the manager (Accelize WebService URL, Board type, Udid, …)cred_file_path
: : Path to json file containing your accelstore.accelize.com Account credentials (client_id, client_private)f_drm_read32
: : Callback function for reading DRM 32bit registers by offsetf_drm_write32
: : Callback function for writing DRM 32bit registers by offsetf_error_cb
: : Callback function in case of asynchronous error
-
MeteringSessionManager
(ReadReg32ByOffsetHandler f_drm_read32, WriteReg32ByOffsetHandler f_drm_write32, ErrorCallBackHandler f_error_cb)¶ Constructor with “ByOffset” functions, uninitialized webservice connection.
Constructs a MeteringSessionManager with ByOffset callback functions.
- See
- ReadReg32ByOffsetHandler WriteReg32ByOffsetHandler
- Warning
- Only used for Debug purposes
- Parameters
f_drm_read32
: : Callback function for reading DRM 32bit registers by offsetf_drm_write32
: : Callback function for writing DRM 32bit registers by offsetf_error_cb
: : Callback function in case of asynchronous error
-
MeteringSessionManager
(const std::string &conf_file_path, const std::string &cred_file_path, ReadReg32ByNameHandler f_drm_read32, WriteReg32ByNameHandler f_drm_write32, ErrorCallBackHandler f_error_cb)¶ Constructor with “ByName” functions.
Constructs a MeteringSessionManager with ByName callback functions.
- See
- ReadReg32ByNameHandler WriteReg32ByNameHandler
- Note
- This function is intended to be used with QuickPlayLib that manages IP registers by names
- Parameters
conf_file_path
: : Path to json configuration file with configuration of the manager (Accelize WebService URL, Board type, Udid, …)cred_file_path
: : Path to json file containing your accelstore.accelize.com Account credentials (client_id, client_private)f_drm_read32
: : Callback function for reading DRM 32bit registers by namef_drm_write32
: : Callback function for writing DRM 32bit registers by namef_error_cb
: : Callback function in case of asynchronous error
-
MeteringSessionManager
(ReadReg32ByNameHandler f_drm_read32, WriteReg32ByNameHandler f_drm_write32, ErrorCallBackHandler f_error_cb)¶ Constructor with “ByName” functions, uninitialized webservice connection.
Constructs a MeteringSessionManager with ByName callback functions.
- See
- ReadReg32ByNameHandler WriteReg32ByNameHandler
- Note
- This function is intended to be used with QuickPlayLib that manages IP registers by names
- Warning
- Only used for Debug purposes
- Parameters
f_drm_read32
: : Callback function for reading DRM 32bit registers by namef_drm_write32
: : Callback function for writing DRM 32bit registers by namef_error_cb
: : Callback function in case of asynchronous error
-
MeteringSessionManager
(const MeteringSessionManager&)¶ Non-copyable.
-
MeteringSessionManager
(MeteringSessionManager&&)¶ Support move.
-
~MeteringSessionManager
()¶ Destructor.
-
void
setUdid
(const std::string &udid)¶ Set Udid.
This function can be used in case the Udid is not already set in the configuration file. In case the Udid has already been set by the configuration file, the new provided Udid will be used. The Udid will be transmitted to the Accelize WebService as additional information about the metering session. Please contact us if you don’t know what Udid to use.
- Parameters
udid
: : udid as a std::string, format “00000000-0000-0000-0000-000000000000”
-
void
setBoardType
(const std::string &boardType)¶ Set BoardType.
This function can be used in case the BoardType is not already set in the configuration file. In case the BoardType has already been set by the configuration file, the new provided BoardType will be used. The BoardType will be transmitted to the Accelize WebService as additional information about the metering session. Please contact us if you don’t know what BoardType to use.
- Parameters
boardType
: : boardType as a std::string
-
void
start_session
()¶ Start a session (1)
This function will always start a new session of metering. The behavior is undefined in case a session was already started. This function will start a std::thread to keep session active with new licenses when necessary (2). Any error during this thread execution will be reported asynchronously via the provided ErrorCallBackHandler. Once this function returns successfully the protected IPs are guaranteed to be unlocked.
-
void
stop_session
()¶ Stop a session (5)
This function will stop a session of metering. This function will join the thread keeping the session active (2) that may have been started by auto_start_session(), start_session() or resume_session(). Once this function returns successfully the protected IPs are guaranteed to be locked and the session has been correctly ended on Accelize WebService.
-
void
pause_session
()¶ Pause a session (3)
This function will pause a session of metering. This function will join the thread keeping the session active (2) that may have been started by auto_start_session(), start_session() or resume_session(). Once this function returns successfully the protected IPs may or may not be locked depending on the time left for licenses currently installed on the DRM controller. Though it is guaranteed that protected IPs will be locked if those licenses reach the end of their validity time
-
void
resume_session
()¶ Resume a session (4)
This function will resume a session of metering. This function will start a std::thread to keep session active with new licenses when necessary (2). Any error during this thread execution will be reported asynchronously via the provided ErrorCallBackHandler. Once this function returns successfully the protected IPs are guaranteed to be unlocked.
-
void
auto_start_session
()¶ Automatically Start or Resume a session (4) This function will automatically start or resume a session of metering. Depending on detected state of the DRM controller this function will call start_session() or resume_session(). As a consequence : This function will start a std::thread to keep session active with new licenses when necessary (2). Once this function returns successfully the protected IPs are guaranteed to be unlocked.
-
void
dump_drm_hw_report
(std::ostream &os)¶ Dump DRM Hardware report.
- Note
- Only for Debug purposes
- Parameters
os
: : std::ostream on which hardware report will be dumped as text
Private Members
-
Impl *
pImpl
¶ Internal representation.
Internal representation
-
class
-
namespace
error.h¶
-
namespace
Accelize
-
namespace
DRMLib
-
class
Exception
: public runtime_error - #include </home/docs/checkouts/readthedocs.org/user_builds/sd-drmlib/checkouts/latest/include/accelize/drm/error.h>
Exception class with error code for the DRMLib.
This class is an exception that may be thrown by the DRMLib in case of synchronous error
Public Functions
-
template <class S>
Exception
(DRMLibErrorCode errCode, S &&errMsg)¶
-
virtual
~Exception
()¶
-
DRMLibErrorCode
getErrCode
() const¶
-
virtual const char *
what
() const¶
Protected Attributes
-
DRMLibErrorCode
errCode
¶ error code from the DRMLibErrorCode enum
-
template <class S>
-
class
-
namespace