加入收藏
举报
02-14 20:02
#0
文件名称:
Feature.md
所在目录:
Openharmony v1.0 / docs / api / api-SmartVision-Devices
文件大小:
9.16 KB
下载地址:
fenwii/OpenHarmony
   
免责声明:本网站仅提供指向 GitHub 上的文件的链接,所有文件的版权归原作者所有,本网站不对文件内容的合法性、准确性或安全性承担任何责任。
文本预览:
# Feature
## **Overview**
**Related Modules:**
[Samgr](Samgr.md)
**Description:**
Defines the base class of a feature.
You need to implement the pointer to the feature.
**Since:**
1.0
**Version:**
1.0
## **Summary**
## Data Fields


















Variable Name


Description


GetName )(Feature *feature)


const char *(* 


Obtains a feature name.


OnInitialize )(Feature *feature, Service *parent, Identity identity)


void(* 


Initializes a feature.


OnStop )(Feature *feature, Identity identity)


void(* 


Stops a feature.


OnMessage )(Feature *feature, Request *request)


BOOL(* 


Processes a feature message.



## **Details**
## **Field Documentation**
## GetName
```
const char*(* Feature::GetName) ([Feature](Feature.md) *feature)
```
**Description:**
Obtains a feature name.
This function is implemented by developers and called by Samgr during feature registration and startup.
**Parameters:**









Name


Description


feature Indicates the pointer to the feature.

**Returns:**
Returns a constant character string less than 16 bytes if the operation is successful; returns **NULL** if the operation fails.
## OnInitialize
```
void(* Feature::OnInitialize) ([Feature](Feature.md) *feature, [Service](Service.md) *parent, [Identity](Identity.md) identity)
```
**Description:**
Initializes a feature.
This function is implemented by developers. After Samgr dispatches tasks to a service, the service calls this function in its own tasks.
**Parameters:**















Name


Description


feature Indicates the pointer to the feature.
parent Indicates the pointer to the Service to which the feature belongs.
identity Indicates the identity of a feature dispatched by the system.

## OnMessage
```
BOOL(* Feature::OnMessage) ([Feature](Feature.md) *feature, [Request](Request.md) *request)
```
**Description:**
Processes a feature message.
This function is implemented by developers to process requests sent by callers through [IUnknown](IUnknown.md).
**Parameters:**












Name


Description


feature Indicates the pointer to the feature.
request Indicates the request message.

**Returns:**
Returns **TRUE** if the processing is successful; returns **FALSE** if the processing fails.
## OnStop
```
void(* Feature::OnStop) ([Feature](Feature.md) *feature, [Identity](Identity.md) identity)
```
**Description:**
Stops a feature.
This function is implemented by developers and is called by Samgr when a feature is deregistered to stop running services.
**Parameters:**












Name


Description


feature Indicates the pointer to the feature.
identity Indicates the Identity of the feature to be stopped.
点赞 回复
回帖
支持markdown部分语法 ?