| lh | b07f4e1 | 2022-02-17 22:08:54 -0800 | [diff] [blame] | 1 | //SPDX-License-Identifier: MediaTekProprietary |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 2 | /* Copyright Statement: |
| 3 | * |
| 4 | * This software/firmware and related documentation ("MediaTek Software") are |
| 5 | * protected under relevant copyright laws. The information contained herein |
| 6 | * is confidential and proprietary to MediaTek Inc. and/or its licensors. |
| 7 | * Without the prior written permission of MediaTek inc. and/or its licensors, |
| 8 | * any reproduction, modification, use or disclosure of MediaTek Software, |
| 9 | * and information contained herein, in whole or in part, shall be strictly prohibited. |
| 10 | */ |
| 11 | /* MediaTek Inc. (C) 2010. All rights reserved. |
| 12 | * |
| 13 | * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 14 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 15 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON |
| 16 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 19 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 20 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 21 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH |
| 22 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES |
| 23 | * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES |
| 24 | * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK |
| 25 | * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR |
| 26 | * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND |
| 27 | * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 28 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 29 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO |
| 30 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 31 | * |
| 32 | * The following software/firmware and/or related documentation ("MediaTek Software") |
| 33 | * have been modified by MediaTek Inc. All revisions are subject to any receiver's |
| 34 | * applicable license agreements with MediaTek Inc. |
| 35 | */ |
| 36 | |
| 37 | #include <unistd.h> |
| 38 | #include <string.h> |
| 39 | #include <log/log.h> |
| 40 | #include <vendor-ril/telephony/ril.h> |
| 41 | extern "C" { |
| 42 | #include <gio/gio.h> |
| 43 | #include <glib.h> |
| 44 | } |
| 45 | |
| 46 | #include "common.h" |
| 47 | /*Warren add for t800 ril service 2021/12/25 start*/ |
| 48 | #include "lynq_common.h" |
| 49 | #include "lynq_interface.h" |
| 50 | #include <binder/Parcel.h> |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 51 | #include "ATCI.h" |
| ll | f6e3ffd | 2023-01-12 22:31:29 +0800 | [diff] [blame] | 52 | #include "atci_lynq_data_cmd.h" |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 53 | #ifdef LED_SUPPORT |
| 54 | #include "led.h" |
| 55 | #endif |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 56 | using android::Parcel; |
| 57 | |
| 58 | /*Warren add for t800 ril service 2021/12/25 end*/ |
| 59 | |
| 60 | #define LOG_TAG "DEMO_DATA_GDBUS" |
| 61 | #define TELEPHONY_SERVICE "mtk.telephony" /*well-known bus name */ |
| 62 | #define TELEPHONY_DATA_INTERFACE "mtk.telephony.Data" /*interface name*/ |
| 63 | #define TELEPHONY_DATA_PATH "/mtk/telephony/data" /*object name*/ |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 64 | #define DEBUG 0 |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 65 | |
| 66 | GMainLoop *loop = NULL; |
| 67 | GDBusProxy *proxy = NULL; |
| 68 | MTK_Data_Call_Response_v1 req_response; |
| 69 | MTK_Data_Call_Response_v1 urc_response; |
| ll | 90a255c | 2022-04-07 09:09:55 +0000 | [diff] [blame] | 70 | |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 71 | |
| rjw | 20006d1 | 2022-04-21 16:29:04 +0800 | [diff] [blame] | 72 | /*Typethree add for t800 ril service 2022/04/14 start*/ |
| 73 | |
| 74 | int lynq_data_modify_apn(gchar *reason,int lynq_request_id) |
| 75 | { |
| 76 | Parcel p; |
| 77 | if(reason == NULL) |
| 78 | { |
| 79 | RLOGD("modify apn reason apn"); |
| 80 | return -1; |
| 81 | } |
| 82 | p.writeInt32(1); |
| 83 | p.writeInt32(lynq_request_id); |
| 84 | p.writeInt32(0); |
| 85 | writeStringToParcel(p,reason); |
| rjw | 7ee7bb4 | 2023-01-18 11:34:28 +0800 | [diff] [blame] | 86 | android::LYNQ_RIL_urcBroadcast(p,lynq_request_id); |
| rjw | 20006d1 | 2022-04-21 16:29:04 +0800 | [diff] [blame] | 87 | return 0; |
| 88 | } |
| 89 | |
| 90 | /*Typethree add for t800 ril service 2022/04/14 end*/ |
| 91 | |
| ll | 90a255c | 2022-04-07 09:09:55 +0000 | [diff] [blame] | 92 | /*Warren add for t103 szzt atsvc 2022/1/5 start*/ |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 93 | /*lei modify on 2022/11/16*/ |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 94 | /*lei modify on 2022/11/16*/ |
| ll | 90a255c | 2022-04-07 09:09:55 +0000 | [diff] [blame] | 95 | /*Warren add for t103 szzt atsvc 2022/1/5 end*/ |
| 96 | |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 97 | /*Warren add for t800 ril service 2021/12/25 start*/ |
| 98 | int lynq_data_management(MTK_Data_Call_Response_v1 *urc_response) |
| 99 | { |
| 100 | char apn_t[LYNQ_APN_LEN_MAX] = {}; |
| 101 | char apnType_t[LYNQ_APNTPYE_LEN_MAX] = {}; |
| 102 | char iface_t[LYNQ_APNTPYE_LEN_MAX] = {}; |
| 103 | if(!urc_response) |
| 104 | { |
| 105 | RLOGD("urc_response is null!!!"); |
| 106 | return -1; |
| 107 | } |
| 108 | bool apnHasCreated = FALSE; |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 109 | Parcel p; |
| lh | a62e088 | 2023-10-31 05:17:11 -0700 | [diff] [blame] | 110 | if(urc_response->pdnState == PDN_TIMEOUT_CANCEL) |
| 111 | { |
| 112 | p.writeInt32(1); |
| 113 | p.writeInt32(LYNQ_URC_DATA_CALL_STATUS_IND); |
| 114 | p.writeInt32(0);//temporary plan |
| 115 | p.writeInt32(urc_response->pdnState); |
| 116 | writeStringToParcel(p,urc_response->apnName); |
| 117 | writeStringToParcel(p,urc_response->apnType); |
| 118 | writeStringToParcel(p,urc_response->ifname); |
| 119 | android::LYNQ_RIL_urcBroadcast(p,LYNQ_URC_DATA_CALL_STATUS_IND); |
| 120 | return 0; |
| 121 | } |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 122 | if(urc_response->cId > 0) |
| 123 | { |
| 124 | if(urc_response->pdnState==PDN_DISCONNECTED)//if user disable data call,the pdn state wiil change to disconnected. |
| 125 | { |
| 126 | for(int i = 0;i < LYNQ_APN_CHANNEL_MAX;i++) |
| 127 | { |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 128 | #if DEBUG |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 129 | printf("line %d [PDN_DISCONNECTED]apn_table[%d],apntype:%s,apnstatus:%d,,,urc_response->apnName:%s\n",__LINE__, i,apn_table[i].apntype,apn_table[i].apnstatus,urc_response->apnType); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 130 | #endif |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 131 | RLOGD("[PDN_DISCONNECTED]apn_table[%d],apntype:%s,apnstatus:%d,,,urc_response->apnName:%s\n",i,apn_table[i].apntype,apn_table[i].apnstatus,urc_response->apnType); |
| 132 | if((strcmp(apn_table[i].apntype,urc_response->apnType)==0)&&(apn_table[i].apnstatus==0)) |
| 133 | { |
| 134 | bzero(apn_table[i].apn,LYNQ_APN_LEN_MAX); |
| 135 | bzero(apn_table[i].apntype,LYNQ_APNTPYE_LEN_MAX); |
| xy.he | 5cb8fd2 | 2023-10-23 07:20:54 -0700 | [diff] [blame] | 136 | bzero(apn_table[i].ifaceName,LYNQ_APNTPYE_LEN_MAX); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 137 | apn_table[i].used = 0; |
| 138 | apn_table[i].netId = 0; |
| 139 | apn_table[i].pdpstate = PDN_DISCONNECTED; |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 140 | apn_count--; |
| 141 | p.writeInt32 (1); |
| 142 | p.writeInt32 (LYNQ_URC_DATA_CALL_STATUS_IND); |
| 143 | p.writeInt32 (0);//temporary plan |
| 144 | p.writeInt32(PDN_DISCONNECTED); |
| Hong_Liu | 6149f18 | 2023-05-12 02:15:14 -0700 | [diff] [blame] | 145 | writeStringToParcel(p,urc_response->apnName); |
| rjw | 5d2a50e | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 146 | writeStringToParcel(p,urc_response->apnType); |
| Hong_Liu | 6149f18 | 2023-05-12 02:15:14 -0700 | [diff] [blame] | 147 | writeStringToParcel(p,urc_response->ifname); |
| rjw | 7ee7bb4 | 2023-01-18 11:34:28 +0800 | [diff] [blame] | 148 | android::LYNQ_RIL_urcBroadcast(p,LYNQ_URC_DATA_CALL_STATUS_IND); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 149 | RLOGD("removed apn:%s,apntype:%s",apn_table[i].apn,apn_table[i].apntype); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 150 | break; |
| 151 | } |
| 152 | } |
| 153 | for(int i = 0;i < LYNQ_APN_CHANNEL_MAX;i++) |
| 154 | { |
| 155 | RLOGD("for apn_table[%d].apn:%s,apntype:%s,used:%d,apnstatus:%d\n",i,apn_table[i].apn, |
| 156 | apn_table[i].apntype,apn_table[i].used,apn_table[i].apnstatus); |
| 157 | } |
| 158 | } |
| 159 | else |
| 160 | { |
| 161 | /*if the pdn status change,tele-fwk will send pdn status to me. |
| 162 | **The reason for the status change may be that enable data call, |
| 163 | **the user disable the data call, and the signal is interrupted. |
| 164 | */ |
| 165 | if(apn_count==0)//first new apn has created |
| 166 | { |
| 167 | RLOGD("first apn_count:%d\n",apn_count); |
| 168 | memcpy(apn_table[apn_count].apn,urc_response->apnName,strlen(urc_response->apnName)+1); |
| 169 | memcpy(apn_table[apn_count].apntype,urc_response->apnType,strlen(urc_response->apnType)+1); |
| 170 | memcpy(apn_table[apn_count].ifaceName,urc_response->ifname,strlen(urc_response->ifname)+1); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 171 | memcpy(apn_table[apn_count].address,urc_response->addresses,strlen(urc_response->addresses)+1); |
| 172 | apn_table[apn_count].pdpstate = urc_response->pdnState; |
| 173 | #if DEBUG |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 174 | printf("line %d apn_table[%d].apn:%s,apntype:%s,,,urc_response->apnName:%s,urc_response->apntype:%s\n",__LINE__,apn_count,apn_table[apn_count].apn,apn_table[apn_count].apntype,urc_response->apnName,urc_response->apnType); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 175 | #endif |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 176 | RLOGD("apn_table[%d].apn:%s,apntype:%s,,,urc_response->apnName:%s,urc_response->apntype:%s\n",apn_count,apn_table[apn_count].apn,apn_table[apn_count].apntype,urc_response->apnName,urc_response->apnType); |
| 177 | apn_table[apn_count].apnstatus=1; |
| 178 | apn_table[apn_count].used=1; |
| 179 | apn_table[apn_count].netId=urc_response->netId; |
| 180 | apn_count++; |
| 181 | p.writeInt32(1); |
| 182 | p.writeInt32(LYNQ_URC_DATA_CALL_STATUS_IND); |
| 183 | p.writeInt32(0);//temporary plan |
| 184 | p.writeInt32(PDN_CONNECTED); |
| 185 | writeStringToParcel(p,urc_response->apnName); |
| 186 | writeStringToParcel(p,urc_response->apnType); |
| 187 | writeStringToParcel(p,urc_response->ifname); |
| rjw | 7ee7bb4 | 2023-01-18 11:34:28 +0800 | [diff] [blame] | 188 | android::LYNQ_RIL_urcBroadcast(p,LYNQ_URC_DATA_CALL_STATUS_IND); |
| 189 | #ifdef LED_SUPPORT |
| 190 | mbtk_netled_state_update(GPIO_NETLED_PPP_CONNECT); |
| 191 | #endif |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 192 | } |
| 193 | else |
| 194 | { |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 195 | for(int i = 0;i < LYNQ_APN_CHANNEL_MAX;i++)//means apn state changed,need update |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 196 | { |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 197 | #if DEBUG |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 198 | printf("line %d for apn_table[%d].apn:%s,,,,urc_response->apnName:%s\n",__LINE__,i,apn_table[i].apn,urc_response->apnName); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 199 | #endif |
| Hong_Liu | 8d77acf | 2023-08-30 02:11:09 -0700 | [diff] [blame] | 200 | RLOGD("for apn_table[%d].apntype:%s,,,,urc_response->apnType:%s\n",i,apn_table[i].apntype,urc_response->apnType); |
| 201 | if(strcmp(apn_table[i].apntype,urc_response->apnType)==0) |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 202 | { |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 203 | #if DEBUG |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 204 | printf("line %d This apn has been created update???!!!\n",__LINE__); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 205 | #endif |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 206 | RLOGD("This apn has been created!!!"); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 207 | apnHasCreated = TRUE; |
| 208 | if(apn_table[i].netId!=urc_response->netId) |
| 209 | { |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 210 | #if DEBUG |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 211 | printf("update???\n"); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 212 | #endif |
| 213 | apn_table[i].netId = urc_response->netId; |
| 214 | apn_table[i].pdpstate = urc_response->pdnState; |
| 215 | memcpy(apn_table[i].ifaceName,urc_response->ifname,strlen(urc_response->ifname)+1); |
| 216 | memcpy(apn_table[i].address,urc_response->addresses,strlen(urc_response->addresses)+1); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 217 | memcpy(iface_t,apn_table[i].ifaceName,strlen(apn_table[i].ifaceName)+1); |
| 218 | memcpy(apnType_t,apn_table[i].apntype,strlen(apn_table[i].apntype)+1); |
| 219 | memcpy(apn_t,apn_table[i].apn,strlen(apn_table[i].apn)+1); |
| 220 | /*send urc to client |
| 221 | send apn_t,apnType_t,urc_response->pdnState,iface_t to client |
| 222 | */ |
| 223 | p.writeInt32(1); |
| 224 | p.writeInt32(LYNQ_URC_DATA_CALL_STATUS_IND); |
| 225 | p.writeInt32(0);//temporary plan |
| 226 | p.writeInt32(urc_response->pdnState); |
| 227 | writeStringToParcel(p,apn_t); |
| 228 | writeStringToParcel(p,apnType_t); |
| 229 | writeStringToParcel(p,iface_t); |
| rjw | 7ee7bb4 | 2023-01-18 11:34:28 +0800 | [diff] [blame] | 230 | android::LYNQ_RIL_urcBroadcast(p,LYNQ_URC_DATA_CALL_STATUS_IND); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 231 | } |
| 232 | break; |
| 233 | } |
| 234 | } |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 235 | if(!apnHasCreated)//Multiple APNs are established new apn has created |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 236 | { |
| 237 | bool getLable = FALSE; |
| 238 | int lable = 0; |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 239 | for(lable;lable < LYNQ_APN_CHANNEL_MAX;lable++)//to find not used array element subscript |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 240 | { |
| 241 | if(apn_table[lable].used==0) |
| 242 | { |
| 243 | getLable = TRUE; |
| 244 | break; |
| 245 | } |
| 246 | } |
| 247 | if(getLable) |
| 248 | { |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 249 | #if DEBUG |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 250 | printf("line %d Multiple APNs are established\n", __LINE__); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 251 | #endif |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 252 | RLOGD("[getLable]:label==%d\n",lable); |
| 253 | memcpy(apn_table[lable].apn,urc_response->apnName,strlen(urc_response->apnName)+1); |
| 254 | memcpy(apn_table[lable].apntype,urc_response->apnType,strlen(urc_response->apnType)+1); |
| 255 | memcpy(apn_table[lable].ifaceName,urc_response->ifname,strlen(urc_response->ifname)+1); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 256 | apn_table[lable].pdpstate = urc_response->pdnState; |
| 257 | memcpy(apn_table[lable].address,urc_response->addresses,strlen(urc_response->addresses)+1); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 258 | RLOGD("new apn_table[%d].apn:%s,apntype:%s,,,urc_response->apnName:%s,urc_response->apntype:%s\n",lable,apn_table[lable].apn,apn_table[lable].apntype,urc_response->apnName,urc_response->apnType); |
| 259 | apn_table[lable].apnstatus=1; |
| 260 | apn_table[lable].used=1; |
| 261 | apn_table[lable].netId=urc_response->netId; |
| 262 | apn_count++; |
| 263 | p.writeInt32(1); |
| 264 | p.writeInt32(LYNQ_URC_DATA_CALL_STATUS_IND); |
| 265 | p.writeInt32(0);//temporary plan |
| 266 | p.writeInt32(urc_response->pdnState); |
| 267 | writeStringToParcel(p,urc_response->apnName); |
| 268 | writeStringToParcel(p,urc_response->apnType); |
| 269 | writeStringToParcel(p,urc_response->ifname); |
| rjw | 7ee7bb4 | 2023-01-18 11:34:28 +0800 | [diff] [blame] | 270 | android::LYNQ_RIL_urcBroadcast(p,LYNQ_URC_DATA_CALL_STATUS_IND); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 271 | } |
| 272 | else |
| 273 | { |
| 274 | RLOGD("unkown error"); |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | } |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 280 | else //cid < 0 it means:when at+cfun=0 will into this or when connecting |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 281 | { |
| 282 | apnHasCreated = FALSE; |
| 283 | RLOGD("[cid < 0] apn_count:%d\n",apn_count); |
| Hong_Liu | dc46d41 | 2023-05-18 13:36:26 -0700 | [diff] [blame] | 284 | if(urc_response->pdnState==PDN_DISCONNECTED)//if user disable data call,the pdn state wiil change to disconnected. |
| 285 | { |
| 286 | for(int i = 0;i < LYNQ_APN_CHANNEL_MAX;i++) |
| 287 | { |
| 288 | #if DEBUG |
| 289 | printf("line %d [PDN_DISCONNECTED]apn_table[%d],apntype:%s,apnstatus:%d,,,urc_response->apnName:%s\n",__LINE__, i,apn_table[i].apntype,apn_table[i].apnstatus,urc_response->apnType); |
| 290 | #endif |
| 291 | RLOGD("[PDN_DISCONNECTED]apn_table[%d],apntype:%s,apnstatus:%d,,,urc_response->apnName:%s\n",i,apn_table[i].apntype,apn_table[i].apnstatus,urc_response->apnType); |
| 292 | if((strcmp(apn_table[i].apntype,urc_response->apnType)==0)&&(apn_table[i].apnstatus==0)) |
| 293 | { |
| 294 | bzero(apn_table[i].apn,LYNQ_APN_LEN_MAX); |
| 295 | bzero(apn_table[i].apntype,LYNQ_APNTPYE_LEN_MAX); |
| xy.he | 5cb8fd2 | 2023-10-23 07:20:54 -0700 | [diff] [blame] | 296 | bzero(apn_table[i].ifaceName,LYNQ_APNTPYE_LEN_MAX); |
| Hong_Liu | dc46d41 | 2023-05-18 13:36:26 -0700 | [diff] [blame] | 297 | apn_table[i].used = 0; |
| 298 | apn_table[i].netId = 0; |
| 299 | apn_table[i].pdpstate = PDN_DISCONNECTED; |
| 300 | apn_count--; |
| 301 | p.writeInt32 (1); |
| 302 | p.writeInt32 (LYNQ_URC_DATA_CALL_STATUS_IND); |
| 303 | p.writeInt32 (0);//temporary plan |
| 304 | p.writeInt32(PDN_DISCONNECTED); |
| 305 | writeStringToParcel(p,urc_response->apnName); |
| 306 | writeStringToParcel(p,urc_response->apnType); |
| 307 | writeStringToParcel(p,urc_response->ifname); |
| 308 | android::LYNQ_RIL_urcBroadcast(p,LYNQ_URC_DATA_CALL_STATUS_IND); |
| 309 | RLOGD("removed apn:%s,apntype:%s",apn_table[i].apn,apn_table[i].apntype); |
| 310 | break; |
| 311 | } |
| 312 | } |
| 313 | for(int i = 0;i < LYNQ_APN_CHANNEL_MAX;i++) |
| 314 | { |
| 315 | RLOGD("for apn_table[%d].apn:%s,apntype:%s,used:%d,apnstatus:%d\n",i,apn_table[i].apn, |
| 316 | apn_table[i].apntype,apn_table[i].used,apn_table[i].apnstatus); |
| Hong_Liu | 088a97e | 2023-06-05 07:48:17 -0700 | [diff] [blame] | 317 | if((strcmp(apn_table[i].apntype,urc_response->apnType)==0)) |
| 318 | { |
| 319 | apn_table[i].pdpstate = urc_response->pdnState; |
| 320 | char ptr[1] = ""; |
| 321 | if(NULL == urc_response->ifname) |
| 322 | { |
| Hong_Liu | 8d77acf | 2023-08-30 02:11:09 -0700 | [diff] [blame] | 323 | memset(iface_t,0,LYNQ_APNTPYE_LEN_MAX); |
| 324 | memset(apn_table[i].ifaceName,0,LYNQ_APNTPYE_LEN_MAX); |
| 325 | } |
| 326 | else |
| 327 | { |
| 328 | memcpy(iface_t,urc_response->ifname,strlen(urc_response->ifname)+1); |
| xy.he | 5cb8fd2 | 2023-10-23 07:20:54 -0700 | [diff] [blame] | 329 | memcpy(apn_table[i].ifaceName,urc_response->ifname,strlen(urc_response->ifname)+1); |
| Hong_Liu | 088a97e | 2023-06-05 07:48:17 -0700 | [diff] [blame] | 330 | } |
| 331 | if(NULL == urc_response->addresses) |
| 332 | { |
| Hong_Liu | 8d77acf | 2023-08-30 02:11:09 -0700 | [diff] [blame] | 333 | memset(apn_table[i].address,0,LYNQ_APNTPYE_LEN_MAX); |
| Hong_Liu | 088a97e | 2023-06-05 07:48:17 -0700 | [diff] [blame] | 334 | } |
| Hong_Liu | 8d77acf | 2023-08-30 02:11:09 -0700 | [diff] [blame] | 335 | memcpy(apnType_t,urc_response->apnType,strlen(urc_response->apnType)+1); |
| 336 | memcpy(apn_t,urc_response->apnName,strlen(urc_response->apnName)+1); |
| Hong_Liu | 088a97e | 2023-06-05 07:48:17 -0700 | [diff] [blame] | 337 | p.writeInt32(1); |
| 338 | p.writeInt32(LYNQ_URC_DATA_CALL_STATUS_IND); |
| 339 | p.writeInt32(0);//temporary plan |
| 340 | p.writeInt32(urc_response->pdnState); |
| 341 | writeStringToParcel(p,apn_t); |
| 342 | writeStringToParcel(p,apnType_t); |
| 343 | writeStringToParcel(p,iface_t); |
| 344 | android::LYNQ_RIL_urcBroadcast(p,LYNQ_URC_DATA_CALL_STATUS_IND); |
| 345 | RLOGD("cid is %d apn:%s,apntype:%s",urc_response->cId,apn_table[i].apn,apn_table[i].apntype); |
| 346 | } |
| Hong_Liu | dc46d41 | 2023-05-18 13:36:26 -0700 | [diff] [blame] | 347 | } |
| 348 | return 0; |
| 349 | } |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 350 | if(apn_count>0) |
| 351 | { |
| 352 | int i = 0; |
| 353 | for(i;i < LYNQ_APN_CHANNEL_MAX;i++) |
| 354 | { |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 355 | #if DEBUG |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 356 | printf("line %d don't know\n", __LINE__); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 357 | #endif |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 358 | RLOGD("[cid<0]apn_table[%d].apntype:%s,,,,urc_response->apntype:%s\n",i,apn_table[i].apntype,urc_response->apnType); |
| 359 | if(strcmp(apn_table[i].apntype,urc_response->apnType)==0) |
| 360 | { |
| 361 | RLOGD("apntype:%s PDN status has changed!!!\n",urc_response->apnType); |
| 362 | apnHasCreated = TRUE; |
| 363 | break; |
| 364 | } |
| 365 | } |
| 366 | if(apnHasCreated) |
| 367 | { |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 368 | #if DEBUG |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 369 | printf("line %d don't know\n", __LINE__); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 370 | #endif |
| 371 | apn_table[i].pdpstate = urc_response->pdnState; |
| 372 | char ptr[1] = ""; |
| 373 | if(NULL == urc_response->ifname) |
| 374 | { |
| Hong_Liu | 8d77acf | 2023-08-30 02:11:09 -0700 | [diff] [blame] | 375 | memset(iface_t,0,LYNQ_APNTPYE_LEN_MAX); |
| 376 | memset(apn_table[i].ifaceName,0,LYNQ_APNTPYE_LEN_MAX); |
| 377 | } |
| 378 | else |
| 379 | { |
| 380 | memcpy(iface_t,urc_response->ifname,strlen(urc_response->ifname)+1); |
| xy.he | 5cb8fd2 | 2023-10-23 07:20:54 -0700 | [diff] [blame] | 381 | memcpy(apn_table[i].ifaceName,urc_response->ifname,strlen(urc_response->ifname)+1); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 382 | } |
| 383 | if(NULL == urc_response->addresses) |
| 384 | { |
| Hong_Liu | 8d77acf | 2023-08-30 02:11:09 -0700 | [diff] [blame] | 385 | memset(apn_table[i].address,0,LYNQ_APNTPYE_LEN_MAX); |
| ll | 62a2b40 | 2022-11-16 21:19:04 +0800 | [diff] [blame] | 386 | } |
| Hong_Liu | 8d77acf | 2023-08-30 02:11:09 -0700 | [diff] [blame] | 387 | memcpy(apnType_t,urc_response->apnType,strlen(urc_response->apnType)+1); |
| 388 | memcpy(apn_t,urc_response->apnName,strlen(urc_response->apnName)+1); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 389 | p.writeInt32(1); |
| 390 | p.writeInt32(LYNQ_URC_DATA_CALL_STATUS_IND); |
| 391 | p.writeInt32(0);//temporary plan |
| 392 | p.writeInt32(urc_response->pdnState); |
| 393 | writeStringToParcel(p,apn_t); |
| 394 | writeStringToParcel(p,apnType_t); |
| 395 | writeStringToParcel(p,iface_t); |
| rjw | 7ee7bb4 | 2023-01-18 11:34:28 +0800 | [diff] [blame] | 396 | android::LYNQ_RIL_urcBroadcast(p,LYNQ_URC_DATA_CALL_STATUS_IND); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 397 | } |
| 398 | } |
| 399 | } |
| 400 | return 0; |
| 401 | } |
| 402 | /*Warren add for t800 ril service 2021/12/25 end*/ |
| 403 | void freeMem(MTK_Data_Call_Response_v1 response) |
| 404 | { |
| 405 | g_free(response.apnType); |
| 406 | g_free(response.type); |
| 407 | g_free(response.ifname); |
| 408 | g_free(response.addresses); |
| 409 | g_free(response.dnses); |
| 410 | g_free(response.gateways); |
| 411 | g_free(response.pcscf); |
| 412 | } |
| 413 | |
| 414 | char* apnState2string(RIL_Data_Call_PdnState apnState) { |
| 415 | switch (apnState) { |
| 416 | case RIL_Data_Call_PdnState::PDN_CONNECTED: |
| 417 | return "PDN_CONNECTED"; |
| 418 | case RIL_Data_Call_PdnState::PDN_CONNECTING: |
| 419 | return "PDN_CONNECTING"; |
| 420 | case RIL_Data_Call_PdnState::PDN_DISCONNECTED: |
| 421 | return "PDN_DISCONNECTED"; |
| 422 | case RIL_Data_Call_PdnState::PDN_DISCONNECTING: |
| 423 | return "PDN_DISCONNECTING"; |
| 424 | case RIL_Data_Call_PdnState::PDN_FAILED: |
| 425 | return "PDN_FAILED"; |
| 426 | case RIL_Data_Call_PdnState::PDN_IDLE: |
| 427 | return "PDN_IDLE"; |
| 428 | case RIL_Data_Call_PdnState::PDN_RETRYING: |
| 429 | return "PDN_RETRYING"; |
| 430 | case RIL_Data_Call_PdnState::PDN_SCANNING: |
| 431 | return "PDN_SCANNING"; |
| lh | a62e088 | 2023-10-31 05:17:11 -0700 | [diff] [blame] | 432 | case RIL_Data_Call_PdnState::PDN_TIMEOUT_CANCEL: |
| 433 | return "PDN_TIMEOUT_CANCEL"; |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 434 | default: |
| 435 | return "UNKNOWN"; |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | void dumpResponse(MTK_Data_Call_Response_v1 *dataCallResponse) |
| 440 | { |
| 441 | RLOGD("dumpResponse: netId: %d, pdnState: %s, status: %d, cId: %d, apnType: %s," |
| 442 | " protocolType: %s, ifaceName: %s, address: %s, dns: %s, gateway: %s, pcscf: %s, mtu: %d, apn: %s", |
| 443 | dataCallResponse->netId, apnState2string(RIL_Data_Call_PdnState(dataCallResponse->pdnState)), |
| 444 | dataCallResponse->status, dataCallResponse->cId, dataCallResponse->apnType, dataCallResponse->type, |
| 445 | dataCallResponse->ifname, dataCallResponse->addresses, dataCallResponse->dnses, |
| 446 | dataCallResponse->gateways, dataCallResponse->pcscf, dataCallResponse->mtu, dataCallResponse->apnName); |
| 447 | } |
| 448 | |
| 449 | void parse(GVariant* result, MTK_Data_Call_Response_v1* data) { |
| 450 | g_variant_get(result, "((iiiisssssssis))", &(data->netId), |
| 451 | &(data->pdnState), &(data->status), |
| 452 | &(data->cId), &(data->apnType), &(data->type), |
| 453 | &(data->ifname), &(data->addresses), |
| 454 | &(data->dnses), &(data->gateways), |
| 455 | &(data->pcscf), &(data->mtu),&(data->apnName)); |
| 456 | } |
| 457 | |
| 458 | void proxy_method_cb (GDBusProxy *proxy, |
| 459 | GAsyncResult *res, |
| 460 | gpointer user_data) |
| 461 | { |
| 462 | RLOGD("method call back"); |
| 463 | GError *error; |
| 464 | GVariant *result; |
| 465 | |
| 466 | error = NULL; |
| 467 | result = g_dbus_proxy_call_finish(proxy, res, &error); |
| 468 | |
| 469 | if(error != NULL) |
| 470 | { |
| 471 | RLOGD("method call back error %s", error->message); |
| 472 | g_error_free(error); |
| 473 | return; |
| 474 | } |
| 475 | freeMem(req_response); |
| 476 | parse(result, &req_response); |
| 477 | dumpResponse(&req_response); |
| 478 | g_variant_unref(result); |
| 479 | } |
| 480 | |
| 481 | int enableData (bool isEnable, gchar *apn_type) |
| 482 | { |
| 483 | RLOGD("send: %s, %s", (isEnable ? "TRUE": "FALSE"), apn_type); |
| 484 | g_dbus_proxy_call(proxy, |
| 485 | "enableData", |
| 486 | g_variant_new("(bs)", isEnable, apn_type), |
| 487 | G_DBUS_CALL_FLAGS_NONE, |
| 488 | -1, |
| 489 | NULL, |
| 490 | (GAsyncReadyCallback) proxy_method_cb, |
| 491 | NULL); |
| 492 | return 1; |
| 493 | } |
| rjw | 20006d1 | 2022-04-21 16:29:04 +0800 | [diff] [blame] | 494 | /*Typethree add for t800 RIL Service 2022/04/14 start*/ |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 495 | void modifyApnDB_method_cb (GDBusProxy *proxy, |
| 496 | GAsyncResult *res, |
| 497 | gpointer user_data) |
| 498 | { |
| 499 | RLOGD("method call back"); |
| 500 | GError *error; |
| 501 | GVariant *result; |
| 502 | gchar* reason = NULL; |
| 503 | |
| 504 | error = NULL; |
| 505 | result = g_dbus_proxy_call_finish(proxy, res, &error); |
| 506 | |
| 507 | if(error != NULL) |
| 508 | { |
| 509 | RLOGD("method call back error %s", error->message); |
| 510 | printf("modify apn db error: %s\n", error->message); |
| rjw | 20006d1 | 2022-04-21 16:29:04 +0800 | [diff] [blame] | 511 | lynq_data_modify_apn(error->message,LYNQ_URC_MODIFY_APNDB); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 512 | g_error_free(error); |
| 513 | return; |
| 514 | } |
| 515 | //reason = const_cast<gchar*>(g_variant_dup_string(result, NULL)); |
| 516 | g_variant_get (result, "(&s)", &reason); |
| 517 | RLOGD("modifyApnDB_method_cb reason %s", ((reason == NULL)? "":reason)); |
| 518 | printf("modify apn db success, return message: %s\n", ((reason == NULL)? "":reason)); |
| 519 | //printf("modifyApnDB_method_cb reason %s\n", ((reason == NULL)? "":reason)); |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 520 | /*lei add for AT+LEAPNMOD*/ |
| ll | f6e3ffd | 2023-01-12 22:31:29 +0800 | [diff] [blame] | 521 | if(g_flag_apn) |
| 522 | { |
| 523 | char apn_buf[256]; |
| 524 | sprintf(apn_buf, "+LEAPNMOD:%s", ((reason == NULL)? "":reason)); |
| 525 | ATCIResponseNoToken(0, apn_buf, 666);//tmp plan |
| 526 | } |
| ll | 6e73f20 | 2022-12-28 14:59:46 +0800 | [diff] [blame] | 527 | /*lei add for AT+LEAPNMOD*/ |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 528 | g_variant_unref(result); |
| rjw | 20006d1 | 2022-04-21 16:29:04 +0800 | [diff] [blame] | 529 | lynq_data_modify_apn(reason,LYNQ_URC_MODIFY_APNDB); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 530 | } |
| 531 | |
| 532 | int modifyApnDB(int cmd, gchar *record) { |
| 533 | RLOGD("%s: cmd: %d, record:%s", __FUNCTION__, cmd, record); |
| 534 | g_dbus_proxy_call(proxy, |
| 535 | "modifyApnDB", |
| 536 | g_variant_new("(is)", cmd, record), |
| 537 | G_DBUS_CALL_FLAGS_NONE, |
| 538 | -1, |
| 539 | NULL, |
| 540 | (GAsyncReadyCallback) modifyApnDB_method_cb, |
| 541 | NULL); |
| 542 | return 1; |
| 543 | } |
| 544 | |
| 545 | void resetApnDB_method_cb (GDBusProxy *proxy, |
| 546 | GAsyncResult *res, |
| 547 | gpointer user_data) |
| 548 | { |
| 549 | RLOGD("resetApnDB_method_cb call back"); |
| 550 | GError *error; |
| 551 | GVariant *result; |
| 552 | gchar* reason = NULL; |
| 553 | |
| 554 | error = NULL; |
| 555 | result = g_dbus_proxy_call_finish(proxy, res, &error); |
| 556 | |
| 557 | if(error != NULL) |
| 558 | { |
| 559 | RLOGD("method call back error %s", error->message); |
| 560 | printf("reset apn DB error: %s\n", error->message); |
| rjw | 20006d1 | 2022-04-21 16:29:04 +0800 | [diff] [blame] | 561 | lynq_data_modify_apn(error->message,LYNQ_URC_RESET_APNDB); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 562 | g_error_free(error); |
| 563 | return; |
| 564 | } |
| 565 | g_variant_get (result, "(&s)", &reason); |
| 566 | //reason = const_cast<gchar*>(g_variant_dup_string(result, NULL)); |
| 567 | RLOGD("resetApnDB_method_cb reason %s", ((reason == NULL)? "":reason)); |
| 568 | printf("reset apn DB success, return message: %s\n", ((reason == NULL)? "":reason)); |
| 569 | //printf("resetApnDB_method_cb reason %s\n", ((reason == NULL)? "":reason)); |
| 570 | g_variant_unref(result); |
| rjw | 20006d1 | 2022-04-21 16:29:04 +0800 | [diff] [blame] | 571 | lynq_data_modify_apn(reason,LYNQ_URC_RESET_APNDB); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 572 | } |
| rjw | 20006d1 | 2022-04-21 16:29:04 +0800 | [diff] [blame] | 573 | /*Typethree add for t800 RIL Service 2022/04/14 end*/ |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 574 | |
| 575 | int resetApnDB() { |
| 576 | RLOGD("%s", __FUNCTION__); |
| 577 | g_dbus_proxy_call(proxy, |
| 578 | "resetApnDB",NULL, |
| 579 | G_DBUS_CALL_FLAGS_NONE, |
| 580 | -1, |
| 581 | NULL, |
| 582 | (GAsyncReadyCallback) resetApnDB_method_cb, |
| 583 | NULL); |
| 584 | return 1; |
| 585 | } |
| 586 | |
| ll | 90a255c | 2022-04-07 09:09:55 +0000 | [diff] [blame] | 587 | |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 588 | void proxy_signals_on_signal (GDBusProxy *proxy, |
| 589 | const gchar *sender_name, |
| 590 | const gchar *signal_name, |
| 591 | GVariant *parameters, |
| 592 | gpointer user_data) |
| 593 | { |
| 594 | RLOGD("signal_name: %s", signal_name); |
| 595 | printf("signal_name: %s\n", signal_name); |
| 596 | freeMem(urc_response); |
| 597 | parse(parameters, &urc_response); |
| 598 | dumpResponse(&urc_response); |
| 599 | if(g_strcmp0(signal_name, "lynq_data_resp") == 0) |
| 600 | { |
| 601 | printf("[lynq_data_resp]do something\n"); |
| 602 | return; |
| 603 | } |
| 604 | lynq_data_management(&urc_response); |
| 605 | if(g_strcmp0(signal_name, "LYNQ_TEST") == 0) |
| 606 | { |
| 607 | printf("do something\n"); |
| 608 | } |
| 609 | if(g_strcmp0(signal_name, "default") == 0) |
| 610 | { |
| 611 | if(urc_response.pdnState == RIL_Data_Call_PdnState::PDN_DISCONNECTED) { |
| 612 | notifyDataSignal(); |
| xj | a1c30b8 | 2022-01-25 16:13:48 +0800 | [diff] [blame] | 613 | } else if (urc_response.pdnState == RIL_Data_Call_PdnState::PDN_FAILED) { |
| 614 | updataDataConnectState(get_default_sim_data(), false); |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 615 | } |
| 616 | } |
| 617 | return; |
| 618 | |
| 619 | } |
| 620 | |
| 621 | void proxy_ready(GObject *source, GAsyncResult *result, gpointer user_data) { |
| 622 | GError *error; |
| 623 | |
| 624 | error = NULL; |
| 625 | proxy = g_dbus_proxy_new_for_bus_finish(result, &error); |
| 626 | if (proxy == NULL) { |
| 627 | RLOGE("create proxy fail"); |
| 628 | return ; |
| 629 | } |
| 630 | RLOGD("proxy is ready"); |
| 631 | gulong signal_handler_id; |
| 632 | |
| 633 | signal_handler_id = g_signal_connect(proxy, "g-signal", |
| 634 | G_CALLBACK (proxy_signals_on_signal), NULL); |
| 635 | if (signal_handler_id == 0) { |
| 636 | RLOGE("listen singal fail!"); |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | void* init_data_gdbus_cb(void *param) |
| 641 | { |
| 642 | /* all the tests rely on a shared main loop */ |
| 643 | loop = g_main_loop_new(NULL, FALSE); |
| 644 | |
| 645 | g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, |
| 646 | G_DBUS_PROXY_FLAGS_NONE, |
| 647 | NULL, /* GDBusInterfaceInfo */ |
| 648 | TELEPHONY_SERVICE, /* name */ |
| 649 | TELEPHONY_DATA_PATH, /* object path */ |
| 650 | TELEPHONY_DATA_INTERFACE, /* interface */ |
| 651 | NULL, /* GCancellable */ |
| 652 | proxy_ready, |
| 653 | NULL); |
| 654 | |
| 655 | g_main_loop_run(loop); |
| 656 | |
| 657 | RLOGD("data gdbus main loop run()"); |
| 658 | if(proxy != NULL) { |
| 659 | g_object_unref (proxy); |
| 660 | } |
| 661 | if(loop != NULL) { |
| 662 | g_main_loop_unref(loop); |
| 663 | } |
| xj | a1c30b8 | 2022-01-25 16:13:48 +0800 | [diff] [blame] | 664 | return NULL; |
| lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 665 | } |
| 666 | |