Service
Overview
Related Modules:
Description:
Indicates the basic type of a service.
You need to implement the function pointers of Service.
Summary
Data Fields
Initialize )(Service service, Identity identity) |
|
MessageHandle )(Service service, Request request) |
|
GetTaskConfig )(Service service) |
Details
Field Documentation
GetName
const char*(* Service::GetName) ([Service]($api-api-SmartVision-Devices-Service.md) *service)
Description:
Obtains the name of a service.
This function is called by Samgr during service registration and startup. You need to implement this function.
Parameters:
service | Indicates the pointer to the service. |
Returns:
Returns a constant string no more than 16 bytes if the service name is obtained successfully; returns NULL if the service name fails to be obtained.
GetTaskConfig
[TaskConfig]($api-api-SmartVision-Devices-TaskConfig.md)(* Service::GetTaskConfig) ([Service]($api-api-SmartVision-Devices-Service.md) *service)
Description:
Obtains task configurations of a service.
This function is used to return task configurations. You need to implement this function.
Parameters:
service | Indicates the pointer to the service. |
Returns:
Returns TaskConfig.
Initialize
BOOL(* Service::Initialize) ([Service]($api-api-SmartVision-Devices-Service.md) *service, [Identity]($api-api-SmartVision-Devices-Identity.md) identity)
Description:
Initializes the service.
After Samgr assigns tasks to a service, the service calls the function in its own tasks. You need to implement this function.
Parameters:
service | Indicates the pointer to the service. |
identity | Indicates the ID allocated by the system to the service. For details, see Identity. |
Returns:
Returns TRUE if the initialization is successful; returns FALSE otherwise.
MessageHandle
BOOL(* Service::MessageHandle) ([Service]($api-api-SmartVision-Devices-Service.md) *service, [Request]($api-api-SmartVision-Devices-Request.md) *request)
Description:
Processes service messages.
This function is used to process requests sent by the caller through IUnknown. You need to implement this function.
Parameters:
service | Indicates the pointer to the service. |
request | Indicates the pointer to the request data. |
Returns:
Returns TRUE if the message processing is successful; returns FALSE if the processing fails.