blob: eef054d7fd73a195b507ef3b31fa6fd53c348f9f [file] [log] [blame]
liubin281ac462023-07-19 14:22:54 +08001
2/**
3 @file
4 ql_common.h
5
6 @brief
7 This file provides the definitions for common functions, and declares the
8 common functions.
9
10*/
11/*============================================================================
12 Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
13 Quectel Wireless Solution Proprietary and Confidential.
14 =============================================================================*/
15/*===========================================================================
16
17 EDIT HISTORY FOR MODULE
18
19This section contains comments describing changes made to the module.
20Notice that changes are listed in reverse chronological order.
21
22
23WHEN WHO WHAT, WHERE, WHY
24---------- ------------ ----------------------------------------------------
2523/08/2019 Nebula.li create
26=============================================================================*/
27
28#ifndef __QL_COMMON_H__
29#define __QL_COMMON_H__
30
31#include <sys/types.h>
32#include <unistd.h>
33#include <sys/syscall.h>
34
35#include <libubox/ustream.h>
36#include <libubox/blobmsg_json.h>
37#include <libubox/kvlist.h>
38#include "libubus.h"
39#include "uci_blob.h"
40#include "libubox/uloop.h"
41#include "rilutil.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47void Ql_Powerdown(int mode);
48
49int ql_start_main_thread();
50int ql_exit_main_thread();
51int ql_ril_sync_request(unsigned int requestid, const void * data, int len,void* priv,void * cb,int timeout);
52int ql_ril_async_request(unsigned int requestid, const void * data, int len,void* priv,void * cb);
53int ql_ubus_sync_request(char *obj_name, char *method,struct blob_buf *blob_buf,void* priv,void *cb,int timeout);
54int ql_ubus_async_request(char *obj_name, char *method,struct blob_buf *blob_buf,void* priv,void *cb);
55int ql_ubus_subscribe_reg(char *subscriber_name, struct ubus_subscriber *event_obj);
56int ql_ubus_subscribe_remove(char *subscriber_name, struct ubus_subscriber *event_obj);
57
58int atcmd_get_line_num(char * result, int result_len);
59char * atcmd_get_line(char * result, int result_len,int index);
60int atcmd_get_para_num(char * line);
61void atcmd_get_para_value_str(char * line,int index, char *para_value);
62void ql_set_response(struct kvlist *result_list,int reqid, int resp_type, int ret, void *data, int data_len);
63int ql_get_response(struct kvlist *result_list,int reqid, int * resp_type, void *data);
64int kvlist_get_len(struct kvlist *kv, const void *data);
65
66int utf8_to_usc2(unsigned char *utf8_data,int utf8_data_len, unsigned int *usc2_data);
67int usc2_to_utf8(unsigned int *usc2_data, int usc2_data_len, unsigned char *utf8_data);
68
69int set_config_option(const char *package, const char *section, const char *option, const char *value);
70char *get_config_option(char *package, char *section, char *option);
71
72#ifdef __cplusplus
73}
74#endif
75
76#endif