# Samgr - [Overview](#section780157231165625) - [Summary](#section39131248165625) - [Files](#files) - [Data Structures](#nested-classes) - [Macros](#define-members) - [Typedefs](#typedef-members) - [Enumerations](#enum-members) - [Functions](#func-members) - [Details](#section175715380165625) - [Macro Definition](#section944963564165625) - [DEFAULT\_IUNKNOWN\_IMPL](#gac8d8c9671531f9340427153d50ca4a2b) - [DEFAULT\_VERSION](#ga13dae059206df8d2d9b9b42e694b3f9c) - [GET\_IUNKNOWN](#ga9403f55c3f75fd03854dcd37c231e05b) - [GET\_OFFSIZE](#gab094855efe05ae51eaaf3e0ddf0346cc) - [INHERIT\_FEATURE](#ga63c2f681bde297cb28a9a300a462f3f4) - [INHERIT\_IUNKNOWN](#gab74532a22d6993d0ffc014d36253397f) - [INHERIT\_IUNKNOWNENTRY](#gad6324fd90dd636180efa2a59b377e65c) - [INHERIT\_SERVICE](#gae9253a7fc1d0acbab91414b4cacc1d84) - [IUNKNOWN\_ENTRY\_BEGIN](#ga52ec6b5b03d56b0dfe7277785246bda1) - [IUNKNOWN\_ENTRY\_END](#ga4ef734474ece49aa938d8ebd5b54bdb3) - [Typedef](#section1152235996165625) - [BootMessage](#gadc486c8d2698eab8a9f26f0eb6cc63c8) - [Handler](#ga5e13d943cc6a87a5c99fe604f3bc01e4) - [IUnknownEntry](#gacaa7db32a018a33a2bbf919cde8d8f9c) - [SamgrLite](#gaad729fe4f36b7b42a122349af334fb28) - [SpecifyTag](#gae9c7eed07272a46851d61e646b6e86d5) - [TaskPriority](#gaef69bbb3353ea484414c3bbaf8ec362b) - [TaskType](#gab265648f2dbef93878ad8c383712b43a) - [Vector](#ga255ca81c214b8a94a90f786ceef94514) - [Enumeration Type](#section2050728011165625) - [BootMessage](#gaf39e482610dca95f0dba85613755eb40) - [SpecifyTag](#ga704a59a45a705ef7a15d16e3cab8c1b0) - [TaskPriority](#gaee057e5f06a7b2533e6f58bde34d15fa) - [TaskType](#ga026844c14ab62f42a2e19b54d622609b) - [Function](#section677802347165625) - [IUNKNOWN\_AddRef\(\)](#ga9abef49ec89bf913c3bed03faf478c1e) - [IUNKNOWN\_QueryInterface\(\)](#gac857d12648500c7dab1cb43e85ae2ed4) - [IUNKNOWN\_Release\(\)](#gabd462f8a5e6460a68760cd0719982296) - [SAMGR\_Bootstrap\(\)](#ga756ac1f5376c72aa5d14b855a302d7b6) - [SAMGR\_GetInstance\(\)](#ga21f168d6f97d6991115ae1cf8bbd8deb) - [SAMGR\_SendRequest\(\)](#ga03b440d8dff9fcc8694ca8a3baa83462) - [SAMGR\_SendResponse\(\)](#gadba5f2881a6e1403cb642726d5fec3e2) - [SAMGR\_SendResponseByIdentity\(\)](#ga44ab9b4c98e2dd6ba3338d1d2664a6fe) - [SAMGR\_SendSharedDirectRequest\(\)](#ga0c8c20d2265f4eb8ec8b516300a94a63) - [SAMGR\_SendSharedRequest\(\)](#gae7c4d087b251949d10d81e88a47e8dbd) - [VECTOR\_Add\(\)](#ga234ba2452c973e9fa4a8be47eaea9d06) - [VECTOR\_At\(\)](#ga75210ba0bd37a38a1902c4904e61246a) - [VECTOR\_Clear\(\)](#gaebfe9ac38f2667d61bf39420aa8e7035) - [VECTOR\_Find\(\)](#gaabc5b0eda1ee6889411e6dacb233cb07) - [VECTOR\_FindByKey\(\)](#gac65bc6dc959a90d95dff93368abd97c7) - [VECTOR\_Make\(\)](#gae790345f8a2863c143bfee4bab3fb6d7) - [VECTOR\_Num\(\)](#ga90523bfd48091a0135f74670076af4d5) - [VECTOR\_Size\(\)](#ga1432f30c136d14bc00414d883d8be3bd) - [VECTOR\_Swap\(\)](#ga7f435d33ba61d145de9d5892b68a0eda) ## **Overview** **Description:** Manages system capabilities. This module provides the development framework base of the service-oriented architecture \(SOA\). You can develop your own abilities based on the Samgr development framework. This module provides basic models of services, features, and functions, and registration and discovery capabilities. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Files
Provides common objects and functions for Samgr and external modules. |
|
Provides the base class and default implementation for external functions of system capabilities. |
|
Provides message communication APIs that help you to implement asynchronous functions of IUnknown. |
|
Defines the simplified vector class, which is extended by four elements. |
|
Defines the IUnknown class. |
|
Defines the IUnknown implementation class. |
|
GET_OFFSIZE(T, member) (long)((char *)&(((T *)(0))->member)) |
|
DEFAULT_VERSION 0x20 |
Defines the default IUnknown version. You can customize the version. |
Defines the macro for inheriting the IUnknown interface. |
|
Defines the macro for inheriting the classes that implement the IUnknown interface. |
|
Defines the default marco for initializing the IUnknown interface. |
|
IUNKNOWN_ENTRY_BEGIN(version) |
Defines the macro for initializing the classes that implement the IUnknown interface. |
IUnknown Defines the end macro for initializing the IUnknown implementation object. |
|
GET_IUNKNOWN(T) (IUnknown *)(&((T).iUnknown)) |
Obtains the pointer of the IUnknown interface object from the subclass object T (generic macro) of the IUnknown implementation class. |
Starts a bootstrap service, which is used by samgr and implemented by system service developers. |
|
Indicates the macro used to inherit the members from the service class. |
typedef struct SimpleVector Defines the simplified vector class, which is extended by four elements. |
|
typedef struct IUnknownEntry Defines the IUnknown implementation class. |
|
typedef enum BootMessage Enumerates the IDs of the message to be processed for starting the bootstrap service. |
|
typedef struct SamgrLite |
|
typedef enum TaskType |
|
typedef enum SpecifyTag |
|
typedef enum TaskPriority |
BootMessage { BOOT_SYS_COMPLETED, BOOT_APP_COMPLETED, BOOT_REG_SERVICE, BOOTSTRAP_BUTT } |
Enumerates the IDs of the message to be processed for starting the bootstrap service. |
TaskType { SHARED_TASK = 0, SINGLE_TASK = 1, SPECIFIED_TASK = 2, NO_TASK = 0xFF } |
|
SpecifyTag { LEVEL_HIGH = 0, LEVEL_MIDDLE = 1, LEVEL_LOW = 2, LEVEL_CUSTOM_BEGIN } |
|
TaskPriority { PRI_LOW = 9, PRI_BELOW_NORMAL = 16, PRI_NORMAL = 24, PRI_ABOVE_NORMAL = 32, PRI_BUTT = 39 } |
VECTOR_Make (VECTOR_Key key, VECTOR_Compare compare) |
|
VECTOR_Clear (Vector *vector) |
|
VECTOR_Add (Vector *vector, void *element) |
|
VECTOR_Size (Vector *vector) |
Obtains the number of elements in the vector, including elements that have been set to NULL. |
VECTOR_Num (Vector *vector) |
Obtains the number of valid elements in the vector, excluding elements that have been set to NULL. |
VECTOR_Swap (Vector *vector, int16 index, void *element) |
Swaps the element at a specified position in a vector with another element. |
VECTOR_Find (Vector *vector, const void *element) |
|
VECTOR_FindByKey (Vector *vector, const void *key) |
|
IUNKNOWN_AddRef (IUnknown *iUnknown) |
Increments the reference count in this IUnknown interface. |
IUNKNOWN_QueryInterface (IUnknown *iUnknown, int ver, void **target) |
Queries the IUnknown interfaces of a specified version (downcasting). |
IUNKNOWN_Release (IUnknown *iUnknown) |
Releases a reference to an IUnknown interface that is no longer used. |
SAMGR_SendRequest (const Identity *identity, const Request *request, Handler handler) |
Sends a request to a service or feature of a specified identity. |
SAMGR_SendSharedRequest (const Identity *identity, const Request *request, uint32 *token, Handler handler) |
Sends a request to multiple services or features to save memory. |
SAMGR_SendSharedDirectRequest (const Identity *id, const Request *req, const Response *resp, uint32 **ref, Handler handler) |
Sends a request and response of a caller to the feature thread. The handler is directly called to process the request and response without using the message processing functions. (Customized function for the broadcast service) |
SAMGR_SendResponse (const Request *request, const Response *response) |
|
SAMGR_SendResponseByIdentity (const Identity *id, const Request *request, const Response *response) |
Sends a response to a specified service or feature after processing the original request. (Customized function for bootstrap) |
SAMGR_GetInstance (void) |
|
SAMGR_Bootstrap (void) |
Indicates | the T type. |
member | Indicates the name of the T member variable. |
LEVEL_HIGH | |
LEVEL_MIDDLE | |
LEVEL_LOW | |
LEVEL_CUSTOM_BEGIN |
PRI_LOW | |
PRI_BELOW_NORMAL | |
PRI_NORMAL | |
PRI_ABOVE_NORMAL | Higher than the normal priority: [32, 39). The communication service is available. |
PRI_BUTT |
SHARED_TASK | |
SINGLE_TASK | |
SPECIFIED_TASK | |
NO_TASK | No task for the service. Generally, this situation does not occur. |
iUnknown | Indicates the pointer to the IUnknown interface. |
version | Indicates the version of the IUnknown interface object to be converted. |
target | Indicates the IUnknown subclass type required by the caller. This is an output parameter. |
iUnknown | Indicates the pointer to the IUnknown interface object. |
request | Indicates the pointer to the original request. |
response | Indicates the pointer to the response content. |
id | Indicates the pointer to the ID of a service or feature. The response is sent to the thread of the service or feature for processing. |
request | Indicates the pointer to the original request. |
response | Indicates the pointer to the response content. |
vector | Indicates the this pointer to the vector. |
element | Indicates the element to add. |
vector | Indicates the this pointer to the vector. |
index | Indicates the subscript to be obtained. |
vector | Indicates the pointer to the vector to clear. |
vector | Indicates the this pointer to the vector. |
element | Indicates the element to be checked. |
vector | Indicates the this pointer to the vector. |
key | Indicates the pointer to the key value of the element to check. |
vector | Indicates the this pointer to the vector. |
vector | Indicates the this pointer to the vector. |
vector | Indicates the this pointer to the vector. |
index | Indicates the position of the element to be swapped. |
element | Indicates the pointer to the new element. |