Sound Manager
sm-helper.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef AM_HELPER_H
18 #define AM_HELPER_H
19 #define _GNU_SOURCE
20 #define AFB_BINDING_VERSION 2
21 #include <afb/afb-binding.h>
22 #include <stdint.h>
23 #include <glib.h>
24 //#include <errno.h>
25 
26 typedef enum REQ_ERROR
27 {
28  REQ_FAIL = -1,
29  REQ_OK=0,
32 }REQ_ERROR;
33 
34 static const char* cmd_evlist[] = {
35  "volumeChanged",
36  "newMainConnection",
37  "removedMainConnection",
38  "sinkMuteStateChanged",
39  "mainConnectionStateChanged"
40 };
41 
42 static const char* route_evlist[] = {
43  /* Routing event*/
44  "setRoutingReady",
45  "setRoutingRundown",
46  "asyncConnect",
47  "asyncSetSourceState",
48  "asyncDisconnect"
49 };
50 
52  guint16 type;
53  gint16 value;
54 };
56  gint32 availability;
58 };
60  gint32 type;
61  gint32 status;
62  gint16 parameter;
63 };
65  gint32 type; /* am_CustomMainSoundPropertyType_t */
66  gint16 value;
67 };
68 
69 struct domain_data{
70  guint16 domainID;
71  gchar* name;
72  gchar* busname;
73  gchar* nodename;
74  gboolean early;
75  gboolean complete;
76  gint16 state;
77 };
78 
79 REQ_ERROR get_value_uint16(const struct afb_req request, const char *source, uint16_t *out_id);
80 REQ_ERROR get_value_int16(const struct afb_req request, const char *source, int16_t *out_id);
81 REQ_ERROR get_value_int32(const struct afb_req request, const char *source, int32_t *out_id);
82 void sm_add_object_to_json_object(struct json_object* j_obj, int count, ...);
83 void sm_add_object_to_json_object_func(struct json_object* j_obj, const char* verb_name, int count, ...);
84 int sm_search_event_name_index(const char* value);
86 GVariant* create_source_data(guint16 sourceID, guint16 domainID, const char* appname, guint16 sourceClassID,
87  gint32 sourceState, gint16 volume, gboolean visible, struct availability_s availables,
88  guint16 interrupt, struct sound_property_s soundPropertyList, gint32 connectionFormatList,
89  struct main_sound_property_s mainPropertyList, struct notification_config_s NConfRouting,
90  struct notification_config_s NConfCommand);
91 GVariant* create_domain_data(struct domain_data*);
92 
93 
94 #endif /*AM_HELPER_H*/
gchar * nodename
Definition: sm-helper.h:73
void sm_add_object_to_json_object(struct json_object *j_obj, int count,...)
Definition: sm-helper.c:96
gchar * name
Definition: sm-helper.h:71
gint32 availability
Definition: sm-helper.h:56
gint16 state
Definition: sm-helper.h:76
gboolean complete
Definition: sm-helper.h:75
void sm_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: sm-helper.c:110
gint32 avalilable_reason
Definition: sm-helper.h:57
GVariant * create_domain_data(struct domain_data *)
Definition: sm-helper.c:218
guint16 domainID
Definition: sm-helper.h:70
REQ_ERROR get_value_uint16(const struct afb_req request, const char *source, uint16_t *out_id)
Definition: sm-helper.c:24
GVariant * create_source_data(guint16 sourceID, guint16 domainID, const char *appname, guint16 sourceClassID, gint32 sourceState, gint16 volume, gboolean visible, struct availability_s availables, guint16 interrupt, struct sound_property_s soundPropertyList, gint32 connectionFormatList, struct main_sound_property_s mainPropertyList, struct notification_config_s NConfRouting, struct notification_config_s NConfCommand)
Definition: sm-helper.c:159
REQ_ERROR get_value_int32(const struct afb_req request, const char *source, int32_t *out_id)
Definition: sm-helper.c:72
guint16 type
Definition: sm-helper.h:52
int sm_search_routing_event_name_index(const char *value)
Definition: sm-helper.c:143
gboolean early
Definition: sm-helper.h:74
int sm_search_event_name_index(const char *value)
Definition: sm-helper.c:127
gchar * busname
Definition: sm-helper.h:72
REQ_ERROR
Definition: sm-helper.h:26
REQ_ERROR get_value_int16(const struct afb_req request, const char *source, int16_t *out_id)
Definition: sm-helper.c:48