Registry

    Based on the Samgr development framework, this module helps you to develop system capabilities and implement cross-process calls. This module is used when system capabilities need to be provided across processes.

    Since:

    1.0

    Version:

    1.0

    Summary

    Files

    Data Structures

    Data Structure Name

    Description

    Defines the client proxy object.

    IServerProxy

    Defines the base class of the server proxy object.

    Macros

    Macro Name and Value

    Description

    Indicates the inherited macro of the client proxy.

    INHERIT_IPROXY_ENTRY(T)   (T)

    Inherits the server proxy class.

    IPROXY_END   

    Defines the end of the default initialization for the server proxy class.

    SERVER_PROXY_VER   0x80

    Defines the default version number of the server proxy.

    Inherits the server proxy function.

    SERVER_IPROXY_BEGIN   (SERVER_PROXY_VER)

    Defines the beginning of the default initialization for the server proxy class.

    Typedefs

    Functions

    Function Name

    Description

    (const char service, const char feature)

    SvcIdentity 

    Obtains the IPC address of a remote service and feature based on the service name and feature name.

    SAMGR_RegisterFactory (const char service, const char feature, creator, Destroyer destroyer)

    int 

    Registers the factory method of the client proxy object with the Samgr.

    Macro Definition Documentation

    INHERIT_CLIENT_IPROXY

    1. int (*Invoke)([IClientProxy]($api-api-SmartVision-Devices-IClientProxy.md) *proxy, int funcId, IpcIo *request, IOwner owner, [INotify]($api-api-SmartVision-Devices-Registry.md#ga362a17c1bda1aace88d42dcbc88bdfac) notify)

    Description:

    Indicates the inherited macro of the client proxy.

    This constant is used when a client proxy needs to be customized or generated by a tool.

    INHERIT_IPROXY_ENTRY

    Description:

    Inherits the server proxy class.

    When the server provides cross-process system capabilities, it uses INHERIT_IPROXY_ENTRY to define the server proxy class.

    INHERIT_SERVER_IPROXY

    1. #define INHERIT_SERVER_IPROXY

    Description:

    Inherits the server proxy function.

    When the server provides cross-process system capabilities, it uses INHERIT_SERVER_IPROXY to define the server proxy function.

    IPROXY_END

    1. #define IPROXY_END [IUNKNOWN_ENTRY_END]($api-api-SmartVision-Devices-Samgr.md#ga4ef734474ece49aa938d8ebd5b54bdb3)

    Description:

    Defines the end of the default initialization for the server proxy class.

    This macro is used for developing the server proxy class. You can inherit this macro to reduce the code amount and prevent class definition inconsistency.

    SERVER_IPROXY_BEGIN

    Description:

    Defines the beginning of the default initialization for the server proxy class.

    This macro is used for developing the server proxy class. You can inherit this macro to reduce the code amount and prevent class definition inconsistency.

    1. #define SERVER_PROXY_VER 0x80

    Description:

    Defines the default version number of the server proxy.

    The cross-process system capabilities are registered when Samgr uses SERVER_PROXY_VER to query the registered server proxy.

    Typedef Documentation

    Creator

    Indicates the creator of the customized client proxy.

    This macro creates a local client proxy for remote service APIs. If you want to call the remote APIs in the way that local APIs are called, implement this macro to encapsulate serialized data into the proxy. The system automatically calls this macro when creating a proxy object.

    Parameters:

    Name

    Description

    service Indicates the pointer to the name of the service to which the function belongs.
    feature Indicates the pointer to the name of the feature to which the function belongs.
    size Indicates the size of the head to be added when a client proxy is created. The required memory capacity is the head size plus the object size.

    Returns:

    void * Returns the applied memory capacity and initialize the memory for the client proxy.

    Destroyer

    1. typedef void(* Destroyer) (const char *service, const char *feature, void *iproxy)

    Description:

    Indicates the destroyer of the customized client proxy.

    This macro destroys local client proxy for remote service APIs. If you want to call the remote APIs in the way that local APIs are called, implement this macro to encapsulate serialized data into the proxy. The system automatically calls this macro when destroying a proxy object.

    Parameters:

    INotify

    Description:

    Called when a client request is responded.

    The client implements this INotify callback to receive response data from the server. owner indicates the client proxy that receives the response data; code indicates the error code of the response data from the server; reply indicates the response data.

    Function Documentation

    SAMGR_GetRemoteIdentity()

      Description:

      Obtains the IPC address of a remote service and feature based on the service name and feature name.

      This function is used when cannot meet your requirements for calling IPCs. For example, if you need to receive the death notification of a remote service or feature, you can call this function to obtain the address of the remote service or feature and subscribe to the death notification from the IPC.

      Parameters:

      Name

      Description

      service Indicates the pointer to the name of the remote service.
      feature Indicates the pointer to the name of the remote feature.

      Returns:

      Returns the IPC address of the remote service or feature. When the handle of the obtained address structure SvcIdentity is 0xFFFFFFFF, the address is invalid.

      Attention:

      This function can be called only after GetFeatureApi in is successfully called. Otherwise, an invalid address is returned. When the service or feature does not support IPC communication, an invalid address will be returned.

      Description:

      Registers the factory method of the client proxy object with the Samgr.

      If you want to call the remote APIs in the way that local APIs are called, implement this function to encapsulate serialized data into the proxy. During system initialization, the module that uses the remote proxy calls the function as required.

      Parameters:

      Name

      Description

      service Indicates the pointer to the service name of the client proxy.
      feature Indicates the pointer to the feature name of the client proxy.
      creator Indicates the Creator function of the client proxy.
      destroyer Indicates the Destroyer function of the client proxy.

      Returns: