lbkit 0.6.8__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lbkit-0.6.8/lbkit.egg-info → lbkit-0.7.0}/PKG-INFO +1 -1
- lbkit-0.7.0/lbkit/__init__.py +2 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/codegen.py +1 -1
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/template/client.c.mako +99 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/template/client.h.mako +83 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/template/server.c.mako +110 -0
- lbkit-0.7.0/lbkit/codegen/template/server.h.mako +153 -0
- {lbkit-0.6.8 → lbkit-0.7.0/lbkit.egg-info}/PKG-INFO +1 -1
- lbkit-0.6.8/lbkit/__init__.py +0 -2
- lbkit-0.6.8/lbkit/codegen/template/server.h.mako +0 -63
- {lbkit-0.6.8 → lbkit-0.7.0}/AUTHORS +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/LICENSE +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/MANIFEST.in +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/README.md +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/build_conan_parallel.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/ci_robot/__init__.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/ci_robot/gitee.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/cli.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/__init__.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/ctype_defination.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/idf_interface.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/renderer.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/template/interface.c.mako +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/template/public.c.mako +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/codegen/template/public.h.mako +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/component/__init__.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/component/arg_parser.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/component/build.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/component/template/conanbase.mako +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/component/template/deploy.mako +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/component/test.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/errors.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/helper.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/integration/__init__.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/integration/build_image.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/integration/build_manifest.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/integration/build_prepare.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/integration/build_rootfs.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/integration/config.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/integration/task.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/integration/template/conanfile.py.mako +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/integration/template/rootfs.py.mako +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/lbkit.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/log.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/misc.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/tools.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/utils/__init__.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/utils/images/__init__.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit/utils/images/emmc.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit.egg-info/SOURCES.txt +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit.egg-info/dependency_links.txt +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit.egg-info/entry_points.txt +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit.egg-info/requires.txt +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/lbkit.egg-info/top_level.txt +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/setup.cfg +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/setup.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/test/__init__.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/test/test_codegen.py +0 -0
- {lbkit-0.6.8 → lbkit-0.7.0}/test/test_helper.py +0 -0
|
@@ -182,6 +182,105 @@ ${class_name}_Properties *${class_name}_properties(void)
|
|
|
182
182
|
return &${properties};
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
% if codegen_version >= 4:
|
|
186
|
+
const ${class_name} *${class_name}_get(const gchar *name)
|
|
187
|
+
{
|
|
188
|
+
return lb_impl._get(&_${class_name}_interface, name);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const ${class_name} *${class_name}_new(const gchar *well_known, const gchar *obj_name)
|
|
192
|
+
{
|
|
193
|
+
LBO *obj = lb_impl._cli_new(&_${class_name}_interface, well_known, obj_name);
|
|
194
|
+
return (const ${class_name} *)obj;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* 减对象引用计数 */
|
|
198
|
+
void ${class_name}_unref(const ${class_name} **obj)
|
|
199
|
+
{
|
|
200
|
+
lb_impl._unref((LBO **)obj);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* 加对象引用计数 */
|
|
204
|
+
const ${class_name} *${class_name}_ref(const ${class_name} *obj)
|
|
205
|
+
{
|
|
206
|
+
return (const ${class_name} *)lb_impl._ref((LBO *)obj);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* 绑定数据 */
|
|
210
|
+
void ${class_name}_bind(const ${class_name} *lb_obj, gpointer data, GDestroyNotify destroy_func)
|
|
211
|
+
{
|
|
212
|
+
lb_impl._bind((LBO *)lb_obj, data, destroy_func);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* 获取绑定数据 */
|
|
216
|
+
gpointer ${class_name}_data(const ${class_name} *lb_obj)
|
|
217
|
+
{
|
|
218
|
+
return lb_impl._data((LBO *)lb_obj);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* @notes 属性对象属性值变更(后)事件 */
|
|
222
|
+
gint ${class_name}_on_prop_changed(const ${class_name} *lb_obj, const gchar *prop, ${class_name}_after_changed_hook pc, gpointer user_data, GDestroyNotify destroy)
|
|
223
|
+
{
|
|
224
|
+
return lb_impl._on_prop_changed((LBO *)lb_obj, prop, (lbo_after_changed_hook)pc, user_data, destroy);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* 取消监听,成功取消监听时会调用监听时设置的destroy回调清除注册时的user_data */
|
|
228
|
+
void ${class_name}_on_prop_changed_cancel(const ${class_name} *lb_obj, const gchar *prop, ${class_name}_after_changed_hook pc, gconstpointer user_data)
|
|
229
|
+
{
|
|
230
|
+
lb_impl._on_prop_changed_cancel((LBO *)lb_obj, prop, (lbo_after_changed_hook)pc, user_data);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/* 对象变更事件 */
|
|
234
|
+
void ${class_name}_on_changed(${class_name}_on_changed_hook cb, gpointer user_data, GDestroyNotify destroy)
|
|
235
|
+
{
|
|
236
|
+
lb_impl._on_changed(&_${class_name}_interface, (LbObjectHook)cb, user_data, destroy);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* 注册对象释放回调 */
|
|
240
|
+
void ${class_name}_before_destroy(const ${class_name} *lb_obj, GHookFunc cb, gpointer user_data)
|
|
241
|
+
{
|
|
242
|
+
lb_impl._before_destroy((LBO *)lb_obj, cb, user_data);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* 查询第n个对象 */
|
|
246
|
+
const ${class_name} *${class_name}_nth(int nth)
|
|
247
|
+
{
|
|
248
|
+
return (const ${class_name} *)lb_impl._nth(&_${class_name}_interface, nth);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* 查询对象名称 */
|
|
252
|
+
const gchar *${class_name}_name(const ${class_name} *obj)
|
|
253
|
+
{
|
|
254
|
+
return lbo_name((LBO *)obj);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* 对象加锁 */
|
|
258
|
+
void ${class_name}_lock(const ${class_name} *obj)
|
|
259
|
+
{
|
|
260
|
+
lbo_lock((LBO *)obj);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* 对象解锁 */
|
|
264
|
+
void ${class_name}_unlock(const ${class_name} *obj)
|
|
265
|
+
{
|
|
266
|
+
lbo_unlock((LBO *)obj);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* 对象列表查询接口 */
|
|
270
|
+
GSList *${class_name}_list(void)
|
|
271
|
+
{
|
|
272
|
+
return lb_impl._list(&_${class_name}_interface);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
% for prop in intf.properties:
|
|
276
|
+
/* 监听属性${prop.name}变更 */
|
|
277
|
+
void ${class_name}_${prop.name}_hook(const ${class_name}_property_hook *hook)
|
|
278
|
+
{
|
|
279
|
+
lb_impl._prop_hook(&${properties}.${prop.name}, (const LBPropertyHook *)hook);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
% endfor
|
|
283
|
+
% endif
|
|
185
284
|
static void __attribute__((constructor(150))) ${class_name}_register(void)
|
|
186
285
|
{
|
|
187
286
|
// 从公共库中复制信号处理函数
|
|
@@ -110,6 +110,89 @@ ${class_name}_Properties *${class_name}_properties(void);
|
|
|
110
110
|
LBInterface *${class_name}_interface(void);
|
|
111
111
|
#define ${hump2underline(class_name).upper()} ${class_name}_interface()
|
|
112
112
|
|
|
113
|
+
% if codegen_version >= 4:
|
|
114
|
+
/* notes: 对象变更加回调函数 */
|
|
115
|
+
typedef void (*${class_name}_on_changed_hook)(const ${class_name} *lb_obj, gpointer user_data);
|
|
116
|
+
/* notes: 属性变更后回调,远程对象或本地对象变更后都会调用 */
|
|
117
|
+
typedef void (*${class_name}_after_changed_hook)(const ${class_name} *object, const LBProperty *prop, GVariant *value, gpointer user_data);
|
|
118
|
+
/* notes: 属性变更前回调,返回-1表示阻止值变更,一般用于值合法性校验,只在被远程操作时才会生效,本地变更值不会回调 */
|
|
119
|
+
typedef gint (*${class_name}_before_change_hook)(const ${class_name} *object, const LBProperty *prop, GVariant *value, gpointer user_data, GError **error);
|
|
120
|
+
|
|
121
|
+
/* 属性值变更回调钩子 */
|
|
122
|
+
typedef struct {
|
|
123
|
+
${class_name}_after_changed_hook after; /* 属性变更(写入对象数据区后)后回调函数 */
|
|
124
|
+
${class_name}_before_change_hook before; /* 属性变更前回调函数,返回0后继续调用,返回非0时中止,所有before都成功时执行属性变更 */
|
|
125
|
+
gpointer user_data;
|
|
126
|
+
} ${class_name}_property_hook;
|
|
127
|
+
/* 查询对象 */
|
|
128
|
+
const ${class_name} *${class_name}_get(const gchar *name);
|
|
129
|
+
/* 创建对象 */
|
|
130
|
+
const ${class_name} *${class_name}_new(const gchar *well_known, const gchar *obj_name);
|
|
131
|
+
/* 减对象引用计数 */
|
|
132
|
+
void ${class_name}_unref(const ${class_name} **obj);
|
|
133
|
+
/* 加对象引用计数 */
|
|
134
|
+
const ${class_name} *${class_name}_ref(const ${class_name} *obj);
|
|
135
|
+
/* 绑定数据 */
|
|
136
|
+
void ${class_name}_bind(const ${class_name} *lb_obj, gpointer data, GDestroyNotify destroy_func);
|
|
137
|
+
/* 获取绑定数据 */
|
|
138
|
+
gpointer ${class_name}_data(const ${class_name} *lb_obj);
|
|
139
|
+
/* @notes 属性对象属性值变更(后)事件 */
|
|
140
|
+
gint ${class_name}_on_prop_changed(const ${class_name} *lb_obj, const gchar *prop, ${class_name}_after_changed_hook pc, gpointer user_data, GDestroyNotify destroy);
|
|
141
|
+
/* 取消监听,成功取消监听时会调用监听时设置的destroy回调清除注册时的user_data */
|
|
142
|
+
void ${class_name}_on_prop_changed_cancel(const ${class_name} *lb_obj, const gchar *prop, ${class_name}_after_changed_hook pc, gconstpointer user_data);
|
|
143
|
+
/* 对象变更事件 */
|
|
144
|
+
void ${class_name}_on_changed(${class_name}_on_changed_hook cb, gpointer user_data, GDestroyNotify destroy);
|
|
145
|
+
/* 注册对象释放回调 */
|
|
146
|
+
void ${class_name}_before_destroy(const ${class_name} *lb_obj, GHookFunc cb, gpointer user_data);
|
|
147
|
+
/*
|
|
148
|
+
* 查询第n个对象
|
|
149
|
+
* @notes: 支持正逆向查询第n个对象,返回的对象需要使用lbo_unref减引用计数
|
|
150
|
+
* 正向查找传入非负n,以0开始计数,表示查找最早创建的第n个对象;
|
|
151
|
+
* 逆向查找传入负数n,以-1开始计数,依次为-2、-3等,表示查找最后创建的第n个对象。
|
|
152
|
+
*/
|
|
153
|
+
const ${class_name} *${class_name}_nth(int nth);
|
|
154
|
+
/* 查询对象名称 */
|
|
155
|
+
const gchar *${class_name}_name(const ${class_name} *obj);
|
|
156
|
+
/* 对象加锁 */
|
|
157
|
+
void ${class_name}_lock(const ${class_name} *obj);
|
|
158
|
+
/* 对象解锁 */
|
|
159
|
+
void ${class_name}_unlock(const ${class_name} *obj);
|
|
160
|
+
/* 对象列表查询接口 */
|
|
161
|
+
GSList *${class_name}_list(void);
|
|
162
|
+
/* 监听属性 */
|
|
163
|
+
% for prop in intf.properties:
|
|
164
|
+
void ${class_name}_${prop.name}_hook(const ${class_name}_property_hook *hook);
|
|
165
|
+
% endfor
|
|
166
|
+
|
|
167
|
+
static inline void ${class_name}_unref_p(const ${class_name} *obj)
|
|
168
|
+
{
|
|
169
|
+
${class_name}_unref(&obj);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
static inline void _cleanup_${class_name}_(const ${class_name} **ptr)
|
|
173
|
+
{
|
|
174
|
+
if (ptr && *ptr) {
|
|
175
|
+
${class_name}_unref(ptr);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static inline void ${class_name}_list_free(GSList **list)
|
|
180
|
+
{
|
|
181
|
+
g_assert(list);
|
|
182
|
+
g_slist_free_full(*list, (GDestroyNotify)${class_name}_unref_p);
|
|
183
|
+
*list = NULL;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
static inline void _cleanup_${class_name}_list(GSList **ptr)
|
|
187
|
+
{
|
|
188
|
+
if (ptr && *ptr) {
|
|
189
|
+
${class_name}_list_free(ptr);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
#define cleanup_${class_name} __attribute__((cleanup(_cleanup_${class_name}_)))
|
|
194
|
+
#define cleanup_${class_name}_list __attribute__((cleanup(_cleanup_${class_name}_list)))
|
|
195
|
+
% endif
|
|
113
196
|
#ifdef __cplusplus
|
|
114
197
|
}
|
|
115
198
|
#endif
|
|
@@ -458,6 +458,116 @@ ${class_name}_Properties *${class_name}_properties(void)
|
|
|
458
458
|
return &${properties};
|
|
459
459
|
}
|
|
460
460
|
|
|
461
|
+
% if codegen_version >= 4:
|
|
462
|
+
const ${class_name} *${class_name}_get(const gchar *name)
|
|
463
|
+
{
|
|
464
|
+
return lb_impl._get(&_${class_name}_interface, name);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const ${class_name} *${class_name}_new(const gchar *name, gboolean *exist)
|
|
468
|
+
{
|
|
469
|
+
LBO *obj = lb_impl._new(&_${class_name}_interface, name, exist);
|
|
470
|
+
return (const ${class_name} *)obj;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
void ${class_name}_unref(const ${class_name} **obj)
|
|
474
|
+
{
|
|
475
|
+
lb_impl._unref((LBO **)obj);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/* 加对象引用计数 */
|
|
479
|
+
const ${class_name} *${class_name}_ref(const ${class_name} *obj)
|
|
480
|
+
{
|
|
481
|
+
return (const ${class_name} *)lb_impl._ref((LBO *)obj);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/* 设置在位状态 */
|
|
485
|
+
void ${class_name}_present_set(const ${class_name} *obj, gboolean present)
|
|
486
|
+
{
|
|
487
|
+
lb_impl._present_set((LBO *)obj, present);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/* 获取在位状态 */
|
|
491
|
+
gboolean ${class_name}_present(const ${class_name} *obj)
|
|
492
|
+
{
|
|
493
|
+
return lb_impl._present((LBO *)obj);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/* 绑定数据 */
|
|
497
|
+
void ${class_name}_bind(const ${class_name} *lb_obj, gpointer data, GDestroyNotify destroy_func)
|
|
498
|
+
{
|
|
499
|
+
lb_impl._bind((LBO *)lb_obj, data, destroy_func);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/* 获取绑定数据 */
|
|
503
|
+
gpointer ${class_name}_data(const ${class_name} *lb_obj)
|
|
504
|
+
{
|
|
505
|
+
return lb_impl._data((LBO *)lb_obj);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/* @notes 属性对象属性值变更(后)事件 */
|
|
509
|
+
gint ${class_name}_on_prop_changed(const ${class_name} *lb_obj, const gchar *prop, ${class_name}_after_changed_hook pc, gpointer user_data, GDestroyNotify destroy)
|
|
510
|
+
{
|
|
511
|
+
return lb_impl._on_prop_changed((LBO *)lb_obj, prop, (lbo_after_changed_hook)pc, user_data, destroy);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/* 取消监听,成功取消监听时会调用监听时设置的destroy回调清除注册时的user_data */
|
|
515
|
+
void ${class_name}_on_prop_changed_cancel(const ${class_name} *lb_obj, const gchar *prop, ${class_name}_after_changed_hook pc, gconstpointer user_data)
|
|
516
|
+
{
|
|
517
|
+
lb_impl._on_prop_changed_cancel((LBO *)lb_obj, prop, (lbo_after_changed_hook)pc, user_data);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/* 对象变更事件 */
|
|
521
|
+
void ${class_name}_on_changed(${class_name}_on_changed_hook cb, gpointer user_data, GDestroyNotify destroy)
|
|
522
|
+
{
|
|
523
|
+
lb_impl._on_changed(&_${class_name}_interface, (LbObjectHook)cb, user_data, destroy);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/* 注册对象释放回调 */
|
|
527
|
+
void ${class_name}_before_destroy(const ${class_name} *lb_obj, GHookFunc cb, gpointer user_data)
|
|
528
|
+
{
|
|
529
|
+
lb_impl._before_destroy((LBO *)lb_obj, cb, user_data);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/* 查询第n个对象 */
|
|
533
|
+
const ${class_name} *${class_name}_nth(int nth)
|
|
534
|
+
{
|
|
535
|
+
return (const ${class_name} *)lb_impl._nth(&_${class_name}_interface, nth);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/* 查询对象名称 */
|
|
539
|
+
const gchar *${class_name}_name(const ${class_name} *obj)
|
|
540
|
+
{
|
|
541
|
+
return lbo_name((LBO *)obj);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/* 对象加锁 */
|
|
545
|
+
void ${class_name}_lock(const ${class_name} *obj)
|
|
546
|
+
{
|
|
547
|
+
lbo_lock((LBO *)obj);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/* 对象解锁 */
|
|
551
|
+
void ${class_name}_unlock(const ${class_name} *obj)
|
|
552
|
+
{
|
|
553
|
+
lbo_unlock((LBO *)obj);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/* 对象列表查询接口 */
|
|
557
|
+
GSList *${class_name}_list(void)
|
|
558
|
+
{
|
|
559
|
+
return lb_impl._list(&_${class_name}_interface);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
% for prop in intf.properties:
|
|
563
|
+
/* 监听属性${prop.name}变更 */
|
|
564
|
+
void ${class_name}_${prop.name}_hook(const ${class_name}_property_hook *hook)
|
|
565
|
+
{
|
|
566
|
+
lb_impl._prop_hook(&${properties}.${prop.name}, (const LBPropertyHook *)hook);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
% endfor
|
|
570
|
+
% endif
|
|
461
571
|
static void __attribute__((constructor(150))) ${class_name}_register(void)
|
|
462
572
|
{
|
|
463
573
|
// 从公共库中复制信号处理函数
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<% from lbkit.tools import hump2underline %>\
|
|
2
|
+
#ifndef __${"_".join(intf.name.upper().split(".", -1))}_SRV_H__
|
|
3
|
+
#define __${"_".join(intf.name.upper().split(".", -1))}_SRV_H__
|
|
4
|
+
|
|
5
|
+
#include <glib-2.0/glib.h>
|
|
6
|
+
#include <glib-2.0/gio/gio.h>
|
|
7
|
+
#include "lb_base.h"
|
|
8
|
+
#include "public/${intf.name}.h"
|
|
9
|
+
|
|
10
|
+
#ifdef __cplusplus
|
|
11
|
+
extern "C" {
|
|
12
|
+
#endif
|
|
13
|
+
<% class_name = intf.alias %>\
|
|
14
|
+
|
|
15
|
+
% for prop in intf.properties:
|
|
16
|
+
/*
|
|
17
|
+
* property: ${prop.name}
|
|
18
|
+
% if len(prop.description.strip()) > 0:
|
|
19
|
+
*
|
|
20
|
+
% for line in prop.description.split("\n"):
|
|
21
|
+
% if len(line.strip()) > 0:
|
|
22
|
+
* ${line.strip()}
|
|
23
|
+
% endif
|
|
24
|
+
% endfor
|
|
25
|
+
% endif
|
|
26
|
+
*/
|
|
27
|
+
% if prop.deprecated:
|
|
28
|
+
__attribute__((__deprecated__)) void ${class_name}_set_${prop.name}(const ${class_name} *object, ${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")});
|
|
29
|
+
% else:
|
|
30
|
+
void ${class_name}_set_${prop.name}(const ${class_name} *object, ${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")});
|
|
31
|
+
% endif
|
|
32
|
+
% endfor
|
|
33
|
+
|
|
34
|
+
% for signal in intf.signals:
|
|
35
|
+
/*
|
|
36
|
+
* signal: ${signal.name}
|
|
37
|
+
% if len(signal.description.strip()) > 0:
|
|
38
|
+
*
|
|
39
|
+
% for line in signal.description.split("\n"):
|
|
40
|
+
% if len(line.strip()) > 0:
|
|
41
|
+
* ${line.strip()}
|
|
42
|
+
% endif
|
|
43
|
+
% endfor
|
|
44
|
+
% endif
|
|
45
|
+
*/
|
|
46
|
+
% if len(signal.properties.parameters) > 0:
|
|
47
|
+
gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const gchar *destination,
|
|
48
|
+
const ${class_name}_${signal.name}_Msg *msg, GError **error);
|
|
49
|
+
% else:
|
|
50
|
+
gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const gchar *destination, GError **error);
|
|
51
|
+
% endif
|
|
52
|
+
% endfor
|
|
53
|
+
|
|
54
|
+
LBInterface *${class_name}_interface(void);
|
|
55
|
+
${class_name}_Properties *${class_name}_properties(void);
|
|
56
|
+
|
|
57
|
+
#define ${hump2underline(class_name).upper()} ${class_name}_interface()
|
|
58
|
+
|
|
59
|
+
% if codegen_version >= 4:
|
|
60
|
+
/* notes: 对象变更加回调函数 */
|
|
61
|
+
typedef void (*${class_name}_on_changed_hook)(const ${class_name} *lb_obj, gpointer user_data);
|
|
62
|
+
/* notes: 属性变更后回调,远程对象或本地对象变更后都会调用 */
|
|
63
|
+
typedef void (*${class_name}_after_changed_hook)(const ${class_name} *object, const LBProperty *prop, GVariant *value, gpointer user_data);
|
|
64
|
+
/* notes: 属性变更前回调,返回-1表示阻止值变更,一般用于值合法性校验,只在被远程操作时才会生效,本地变更值不会回调 */
|
|
65
|
+
typedef gint (*${class_name}_before_change_hook)(const ${class_name} *object, const LBProperty *prop, GVariant *value, gpointer user_data, GError **error);
|
|
66
|
+
|
|
67
|
+
/* 属性值变更回调钩子 */
|
|
68
|
+
typedef struct {
|
|
69
|
+
${class_name}_after_changed_hook after; /* 属性变更(写入对象数据区后)后回调函数 */
|
|
70
|
+
${class_name}_before_change_hook before; /* 属性变更前回调函数,返回0后继续调用,返回非0时中止,所有before都成功时执行属性变更 */
|
|
71
|
+
gpointer user_data;
|
|
72
|
+
} ${class_name}_property_hook;
|
|
73
|
+
/* 查询对象 */
|
|
74
|
+
const ${class_name} *${class_name}_get(const gchar *name);
|
|
75
|
+
/* 创建对象 */
|
|
76
|
+
const ${class_name} *${class_name}_new(const gchar *name, gboolean *exist);
|
|
77
|
+
void ${class_name}_unref(const ${class_name} **obj);
|
|
78
|
+
/* 加对象引用计数 */
|
|
79
|
+
const ${class_name} *${class_name}_ref(const ${class_name} *obj);
|
|
80
|
+
/* 设置在位状态 */
|
|
81
|
+
void ${class_name}_present_set(const ${class_name} *obj, gboolean present);
|
|
82
|
+
/* 获取在位状态 */
|
|
83
|
+
gboolean ${class_name}_present(const ${class_name} *obj);
|
|
84
|
+
/* 绑定数据 */
|
|
85
|
+
void ${class_name}_bind(const ${class_name} *lb_obj, gpointer data, GDestroyNotify destroy_func);
|
|
86
|
+
/* 获取绑定数据 */
|
|
87
|
+
gpointer ${class_name}_data(const ${class_name} *lb_obj);
|
|
88
|
+
/* @notes 属性对象属性值变更(后)事件 */
|
|
89
|
+
gint ${class_name}_on_prop_changed(const ${class_name} *lb_obj, const gchar *prop, ${class_name}_after_changed_hook pc, gpointer user_data, GDestroyNotify destroy);
|
|
90
|
+
/* 取消监听,成功取消监听时会调用监听时设置的destroy回调清除注册时的user_data */
|
|
91
|
+
void ${class_name}_on_prop_changed_cancel(const ${class_name} *lb_obj, const gchar *prop, ${class_name}_after_changed_hook pc, gconstpointer user_data);
|
|
92
|
+
/* 对象添加删除事件 */
|
|
93
|
+
void ${class_name}_on_changed(${class_name}_on_changed_hook cb, gpointer user_data, GDestroyNotify destroy);
|
|
94
|
+
/* 注册对象释放回调 */
|
|
95
|
+
void ${class_name}_before_destroy(const ${class_name} *lb_obj, GHookFunc cb, gpointer user_data);
|
|
96
|
+
/*
|
|
97
|
+
* 查询第n个对象
|
|
98
|
+
* @notes: 支持正逆向查询第n个对象,返回的对象需要使用lbo_unref减引用计数
|
|
99
|
+
* 正向查找传入非负n,以0开始计数,表示查找最早创建的第n个对象;
|
|
100
|
+
* 逆向查找传入负数n,以-1开始计数,依次为-2、-3等,表示查找最后创建的第n个对象。
|
|
101
|
+
*/
|
|
102
|
+
const ${class_name} *${class_name}_nth(int nth);
|
|
103
|
+
/* 查询对象名称 */
|
|
104
|
+
const gchar *${class_name}_name(const ${class_name} *obj);
|
|
105
|
+
/* 对象加锁 */
|
|
106
|
+
void ${class_name}_lock(const ${class_name} *obj);
|
|
107
|
+
/* 对象解锁 */
|
|
108
|
+
void ${class_name}_unlock(const ${class_name} *obj);
|
|
109
|
+
/* 对象列表查询接口
|
|
110
|
+
* @notes: 返回的单链需要lbo_unref减每个单链数据的引用计数
|
|
111
|
+
* 或者调用${class_name}_list_free释放
|
|
112
|
+
* 或者申明GSList时使用cleanup_${class_name}_list在作用域结束时自动释放
|
|
113
|
+
*/
|
|
114
|
+
GSList *${class_name}_list(void);
|
|
115
|
+
/* 监听属性 */
|
|
116
|
+
% for prop in intf.properties:
|
|
117
|
+
void ${class_name}_${prop.name}_hook(const ${class_name}_property_hook *hook);
|
|
118
|
+
% endfor
|
|
119
|
+
|
|
120
|
+
static inline void ${class_name}_unref_p(const ${class_name} *obj)
|
|
121
|
+
{
|
|
122
|
+
${class_name}_unref(&obj);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
static inline void _cleanup_${class_name}_(const ${class_name} **ptr)
|
|
126
|
+
{
|
|
127
|
+
if (ptr && *ptr) {
|
|
128
|
+
${class_name}_unref(ptr);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static inline void ${class_name}_list_free(GSList **list)
|
|
133
|
+
{
|
|
134
|
+
g_assert(list);
|
|
135
|
+
g_slist_free_full(*list, (GDestroyNotify)${class_name}_unref_p);
|
|
136
|
+
*list = NULL;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
static inline void _cleanup_${class_name}_list(GSList **ptr)
|
|
140
|
+
{
|
|
141
|
+
if (ptr && *ptr) {
|
|
142
|
+
${class_name}_list_free(ptr);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#define cleanup_${class_name} __attribute__((cleanup(_cleanup_${class_name}_)))
|
|
147
|
+
#define cleanup_${class_name}_list __attribute__((cleanup(_cleanup_${class_name}_list)))
|
|
148
|
+
% endif
|
|
149
|
+
#ifdef __cplusplus
|
|
150
|
+
}
|
|
151
|
+
#endif
|
|
152
|
+
|
|
153
|
+
#endif /* __${"_".join(intf.name.upper().split(".", -1))}_H__ */
|
lbkit-0.6.8/lbkit/__init__.py
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<% from lbkit.tools import hump2underline %>\
|
|
2
|
-
#ifndef __${"_".join(intf.name.upper().split(".", -1))}_SRV_H__
|
|
3
|
-
#define __${"_".join(intf.name.upper().split(".", -1))}_SRV_H__
|
|
4
|
-
|
|
5
|
-
#include <glib-2.0/glib.h>
|
|
6
|
-
#include <glib-2.0/gio/gio.h>
|
|
7
|
-
#include "lb_base.h"
|
|
8
|
-
#include "public/${intf.name}.h"
|
|
9
|
-
|
|
10
|
-
#ifdef __cplusplus
|
|
11
|
-
extern "C" {
|
|
12
|
-
#endif
|
|
13
|
-
<% class_name = intf.alias %>\
|
|
14
|
-
|
|
15
|
-
% for prop in intf.properties:
|
|
16
|
-
/*
|
|
17
|
-
* property: ${prop.name}
|
|
18
|
-
% if len(prop.description.strip()) > 0:
|
|
19
|
-
*
|
|
20
|
-
% for line in prop.description.split("\n"):
|
|
21
|
-
% if len(line.strip()) > 0:
|
|
22
|
-
* ${line.strip()}
|
|
23
|
-
% endif
|
|
24
|
-
% endfor
|
|
25
|
-
% endif
|
|
26
|
-
*/
|
|
27
|
-
% if prop.deprecated:
|
|
28
|
-
__attribute__((__deprecated__)) void ${class_name}_set_${prop.name}(const ${class_name} *object, ${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")});
|
|
29
|
-
% else:
|
|
30
|
-
void ${class_name}_set_${prop.name}(const ${class_name} *object, ${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")});
|
|
31
|
-
% endif
|
|
32
|
-
% endfor
|
|
33
|
-
|
|
34
|
-
% for signal in intf.signals:
|
|
35
|
-
/*
|
|
36
|
-
* signal: ${signal.name}
|
|
37
|
-
% if len(signal.description.strip()) > 0:
|
|
38
|
-
*
|
|
39
|
-
% for line in signal.description.split("\n"):
|
|
40
|
-
% if len(line.strip()) > 0:
|
|
41
|
-
* ${line.strip()}
|
|
42
|
-
% endif
|
|
43
|
-
% endfor
|
|
44
|
-
% endif
|
|
45
|
-
*/
|
|
46
|
-
% if len(signal.properties.parameters) > 0:
|
|
47
|
-
gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const gchar *destination,
|
|
48
|
-
const ${class_name}_${signal.name}_Msg *msg, GError **error);
|
|
49
|
-
% else:
|
|
50
|
-
gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const gchar *destination, GError **error);
|
|
51
|
-
% endif
|
|
52
|
-
% endfor
|
|
53
|
-
|
|
54
|
-
LBInterface *${class_name}_interface(void);
|
|
55
|
-
${class_name}_Properties *${class_name}_properties(void);
|
|
56
|
-
|
|
57
|
-
#define ${hump2underline(class_name).upper()} ${class_name}_interface()
|
|
58
|
-
|
|
59
|
-
#ifdef __cplusplus
|
|
60
|
-
}
|
|
61
|
-
#endif
|
|
62
|
-
|
|
63
|
-
#endif /* __${"_".join(intf.name.upper().split(".", -1))}_H__ */
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|