Yocto/AGL

[AGL] afb_binding

깡죠 2018. 10. 19. 11:21

afb-binding API 에 대해 파악 하고 자함


#define AFB_BINDING_VERSION 2


afb/afb-api-x3.h 파일에 정의되어 있음

afb/afb-binding-v2.h 다음버전을 살펴봄


afb_verb_v2

struct afb_binding_v2 



  • 바인딩 정의

 struct afb_binding_v2

{

        const char *api;                        /**< api name for the binding */

        const char *specification;              /**< textual specification of the binding, can be NULL */

        const char *info;                       /**< some info about the api, can be NULL */

        const struct afb_verb_v2 *verbs;        /**< array of descriptions of verbs terminated by a NULL name */

        int (*preinit)();                       /**< callback at load of the binding */

        int (*init)();                          /**< callback for starting the service */

        void (*onevent)(const char *event, struct json_object *object); /**< callback for handling events */

        unsigned noconcurrency: 1;              /**< avoids concurrent requests to verbs */

};



//MediaService 예

const struct afb_binding_v2 afbBindingV2 = {

        .api = "mediaplayer",

        .specification = "Mediaplayer API",

        .verbs = binding_verbs,

        .onevent = onevent,

        .init = init,

};


  • 하나의 동작을 연결하기 위한 API version 2

 struct afb_verb_v2

{

        const char *verb;                       /**< name of the verb, NULL only at end of the array */

        void (*callback)(struct afb_req_x1 req);/**< callback function implementing the verb */

        const struct afb_auth *auth;            /**< required authorisation, can be NULL */

        const char *info;                       /**< some info about the verb, can be NULL */

        uint32_t session;                       /**< authorisation and session requirements of the verb */

};






ㄴㄴ