# Samgr ## **Overview** 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. |