Merge "[Feature][S300AI][task-view-1832][at] add AT+GPIO_IN=<n>"
diff --git a/lynq/R306BR/ap/app/ccapp/cc_proc.c b/lynq/R306BR/ap/app/ccapp/cc_proc.c
index 7d5a910..088312e 100755
--- a/lynq/R306BR/ap/app/ccapp/cc_proc.c
+++ b/lynq/R306BR/ap/app/ccapp/cc_proc.c
@@ -2188,6 +2188,8 @@
             msgBuf.usMsgCmd = ZCC_RELEASE_E;

             msgBuf.src_id = MODULE_ID_SLIC;

             zCc_SendMsgToSub(&msgBuf);

+			

+			sleep(1);

             

             zCc_SendAtHangupReq();

             zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s  zCc_MRingingState: ZCC_RELEASE_E <---\n",__FUNCTION__);

diff --git a/lynq/S300AI/ap/app/ccapp/cc_proc.c b/lynq/S300AI/ap/app/ccapp/cc_proc.c
index 7d5a910..088312e 100755
--- a/lynq/S300AI/ap/app/ccapp/cc_proc.c
+++ b/lynq/S300AI/ap/app/ccapp/cc_proc.c
@@ -2188,6 +2188,8 @@
             msgBuf.usMsgCmd = ZCC_RELEASE_E;

             msgBuf.src_id = MODULE_ID_SLIC;

             zCc_SendMsgToSub(&msgBuf);

+			

+			sleep(1);

             

             zCc_SendAtHangupReq();

             zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s  zCc_MRingingState: ZCC_RELEASE_E <---\n",__FUNCTION__);

diff --git a/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_interface.h b/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_interface.h
index f2d53b7..3e5aba8 100755
--- a/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_interface.h
+++ b/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_interface.h
@@ -250,6 +250,7 @@
 #define GOFORM_MGMT_SNTP "SNTP"
 #define GOFORM_MGMT_SYSLOG  "SYSLOG"
 #define GOFORM_MGMT_SCHEDULE_SETTING "SCHEDULE_SETTING"
+#define GOFORM_MGMT_BATTERY_VOICE_SETTING "BATTERY_VOICE_SETTING"
 //#define GOFORM_HTTP_REDIRECT "HTTP_REDIRECT"
 /*management end*/
 
diff --git a/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_mgmt.c b/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_mgmt.c
index cbb5143..769e9bc 100755
--- a/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_mgmt.c
+++ b/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_mgmt.c
@@ -1376,6 +1376,18 @@
 	return;
 }
 
+void zte_goform_mgmt_battery_voice_setting_process(webs_t wp)
+{
+	char *battery_voice_voltage = NULL;
+
+	battery_voice_voltage = websGetVar(wp, T("battery_voice_voltage"), T(""));
+	cfg_set("battery_voice_voltage", battery_voice_voltage);
+	cfg_save();
+
+	zte_write_result_to_web(wp, SUCCESS);
+	return;
+}
+
 void zte_goform_mamt_cwmp_process(webs_t wp)
 {
 	char *cwmp_enable = NULL;
diff --git a/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_mgmt.h b/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_mgmt.h
index 478be40..a99c32d 100755
--- a/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_mgmt.h
+++ b/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_mgmt.h
@@ -81,6 +81,7 @@
 extern void zte_mgmt_set_devicemode(webs_t wp);
 
 extern void zte_goform_mgmt_schedule_setting_process(webs_t wp);
+extern void zte_goform_mgmt_battery_voice_setting_process(webs_t wp);
 extern void zte_goform_mamt_cwmp_process(webs_t wp);
 
 extern void zte_goform_mgmt_sntp_process(webs_t wp);
diff --git a/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_util.c b/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_util.c
index 2b086b2..3a675b7 100755
--- a/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_util.c
+++ b/lynq/S300AI/ap/app/goahead/interface5.0/zte_web_util.c
@@ -158,6 +158,7 @@
 	//{GOFORM_MGMT_SET_EXTERNAL_NV, zte_goform_set_external_nv},
 	{GOFORM_MGMT_SCHEDULE_SETTING, zte_goform_mgmt_schedule_setting_process},
 	{GOFORM_MGMT_SNTP, zte_goform_mgmt_sntp_process},                           //SNTPÉèÖÃ
+	{GOFORM_MGMT_BATTERY_VOICE_SETTING, zte_goform_mgmt_battery_voice_setting_process},
 	{GOFORM_SNTP_GETDATASTATIC, zte_goform_sntp_getdatastatic_process},         //´¥·¢serverУ׼ʱ¼ä
 	//{GOFORM_MGMT_SYSLOG, zte_goform_mgmt_syslog_process},                       //ϵͳLOG
 
diff --git a/lynq/S300AI/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c b/lynq/S300AI/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c
index 40ada2c..1219e0d 100755
--- a/lynq/S300AI/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c
+++ b/lynq/S300AI/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c
@@ -1046,6 +1046,22 @@
 	return AT_END;

 }

 

+int ext_at_battery_voice_voltage_func(char *at_paras, void ** res_msg)

+{

+	if(at_paras && strlen(at_paras) == 4)

+	{

+		char *at_str = malloc(32);

+		cfg_set("battery_voice_voltage", at_paras);

+		snprintf(at_str, 32, "\r\n+BATTERY_VOICE: %s\r\nOK\r\n", at_paras);

+

+		*res_msg = at_str;

+		return AT_END;

+	}

+

+	*res_msg = at_err_build(ATERR_PARAM_INVALID);

+	return AT_END;

+}

+

 void ext_notelcom_regist()

 {

     register_serv_func2("ZWIFI=", MODULE_ID_WIFI, 

@@ -1089,6 +1105,7 @@
 	register_serv_func("GPIO_IN=", 0, ext_at_gpio_in_func);

 	register_serv_func("WLAN_SS", 0, ext_at_wlan_ss_func);

 	register_serv_func("FMTEST=", 0, ext_at_delay_shut_down_func);

+	register_serv_func("BATTERY_VOICE=", 0, ext_at_battery_voice_voltage_func);

 }

 

 void at_comm_init(void)

diff --git a/lynq/S300AI/ap/app/zte_webui/i18n/Messages_en.properties b/lynq/S300AI/ap/app/zte_webui/i18n/Messages_en.properties
index d013ac3..142c81f 100755
--- a/lynq/S300AI/ap/app/zte_webui/i18n/Messages_en.properties
+++ b/lynq/S300AI/ap/app/zte_webui/i18n/Messages_en.properties
@@ -1817,3 +1817,11 @@
 calling_white_number_list = Whitelist of Outgoing Calls

 add_called_white_number_list = Add Number to Whitelist of Received Calls

 called_white_number_list = Whitelist of Received Calls

+battery_voice_set = Voice Configuration

+battery_voice_info = If battery voltage below set, mute voice, only effective powered by battery

+close_voice_voltage = Close Voice Voltage(mV)

+close_voice_select_0 = Always effective

+close_voice_select_3600 = 3600

+close_voice_select_3700 = 3700

+close_voice_select_3800 = 3800

+close_voice_select_3900 = 3900

diff --git a/lynq/S300AI/ap/app/zte_webui/i18n/Messages_zh-cn.properties b/lynq/S300AI/ap/app/zte_webui/i18n/Messages_zh-cn.properties
index 6bae806..681dcbd 100755
--- a/lynq/S300AI/ap/app/zte_webui/i18n/Messages_zh-cn.properties
+++ b/lynq/S300AI/ap/app/zte_webui/i18n/Messages_zh-cn.properties
@@ -1821,3 +1821,11 @@
 calling_white_number_list = 主叫白名单号码列表

 add_called_white_number_list = 添加被叫白名单号码

 called_white_number_list = 被叫白名单号码列表

+battery_voice_set = 语音配置

+battery_voice_info = 电池电量低于设定值时,关闭语音功能,仅在电池供电时生效

+close_voice_voltage = 关闭语音电压(mV)

+close_voice_select_0 = 直接生效

+close_voice_select_3600 = 3600

+close_voice_select_3700 = 3700

+close_voice_select_3800 = 3800

+close_voice_select_3900 = 3900

diff --git a/lynq/S300AI/ap/app/zte_webui/js/com.js b/lynq/S300AI/ap/app/zte_webui/js/com.js
index e3432ad..68023f1 100755
--- a/lynq/S300AI/ap/app/zte_webui/js/com.js
+++ b/lynq/S300AI/ap/app/zte_webui/js/com.js
@@ -4317,6 +4317,41 @@
             }

         }

     }

+

+    function getBatteryVoiceSetting() {

+        return stuffMake(arguments, {}, prepare, deal, null, false);

+        function prepare(values, isPost) {

+            var valueReq = {};

+            valueReq.cmd = "battery_voice_voltage";

+            return valueReq;

+        }

+        function deal(paramD) {

+            if (paramD) {

+                var result = {};

+                result.battery_voice_voltage = paramD.battery_voice_voltage;

+                return result;

+            } else {

+                return errUnknownObj;

+            }

+        }

+    }

+    function setBatteryVoiceSetting() {

+        return stuffMake(arguments, {}, prepare, deal, null, true);

+        function prepare(values, isPost) {

+            var valueReq = {};

+            valueReq.goformId = "BATTERY_VOICE_SETTING";

+            valueReq.battery_voice_voltage = values.battery_voice_voltage;

+            return valueReq;

+        }

+        function deal(paramD) {

+            if (paramD) {

+                return paramD;

+            } else {

+                return errUnknownObj;

+            }

+        }

+    }

+    

     function getCwmpSetting() {

         return stuffMake(arguments, {}, prepare, deal, null, false);

         function prepare(values, isPost) {

@@ -6447,6 +6482,8 @@
         restart: restart,

         getScheduleSetting: getScheduleSetting,

         setScheduleSetting: setScheduleSetting,

+        getBatteryVoiceSetting: getBatteryVoiceSetting,

+        setBatteryVoiceSetting: setBatteryVoiceSetting,

         getCwmpSetting: getCwmpSetting,

         setCwmpSetting: setCwmpSetting,

         updateTimerFlag: updateTimerFlag,

@@ -7058,6 +7095,10 @@
 			return new Option(item.name, item.value);

 		});

 

+        var batteryVoiceModes = _.map(config.batteryVoiceSetModes, function(item) {

+			return new Option(item.name, item.value);

+		});

+

 		var sv_sntpYears    = [];

 		var sv_sntpMonths   = [];

 		var sv_sntpDates    = [];  //���ݴ�С����������

@@ -7395,7 +7436,22 @@
 				!target.isOther2() && $("#sntp_server2").find(".error").hide();

 			}

 

+            var sv_batteryVoiceInfo = service.getBatteryVoiceSetting();

+            target.batteryVoiceModes = ko.observableArray(batteryVoiceModes);

+            target.currentVoiceMode = ko.observable(sv_batteryVoiceInfo.battery_voice_voltage);

 

+            target.batteryVoiceSave = function () {

+                showLoading();

+                var params = {};

+                params.battery_voice_voltage = target.currentVoiceMode();

+                service.setBatteryVoiceSetting(params, function (result) {

+                    if (result.result != "success") {

+                        errorOverlay();

+                    } else {

+                        successOverlay();

+                    }

+                });

+            };

         }

 

 	    // ��ʼ�� ViewModel����������ͼ��

diff --git a/lynq/S300AI/ap/app/zte_webui/js/ext/set_aic8800d40i.js b/lynq/S300AI/ap/app/zte_webui/js/ext/set_aic8800d40i.js
index 8a83356..b69d09e 100755
--- a/lynq/S300AI/ap/app/zte_webui/js/ext/set_aic8800d40i.js
+++ b/lynq/S300AI/ap/app/zte_webui/js/ext/set_aic8800d40i.js
@@ -72,6 +72,23 @@
                 name: '3G Only',

                 value: 'Only_WCDMA'

             }

+        ],

+        batteryVoiceSetModes: [{

+                name: "Always on",

+                value: "0"

+            }, {

+                name: "3600 mV",

+                value: "3600"

+            }, {

+                name: "3700 mV",

+                value: "3700"

+            }, {

+                name: "3800 mV",

+                value: "3800"

+            }, {

+                name: "3900 mV",

+                value: "3900"

+            }

         ]

     };

 

diff --git a/lynq/S300AI/ap/app/zte_webui/subpg/adm_others.html b/lynq/S300AI/ap/app/zte_webui/subpg/adm_others.html
index 112b09f..7929178 100755
--- a/lynq/S300AI/ap/app/zte_webui/subpg/adm_others.html
+++ b/lynq/S300AI/ap/app/zte_webui/subpg/adm_others.html
@@ -202,6 +202,24 @@
 			</div>

 		</form>

 

+		<form id="frmBatteryVoiceSet">

+            <div class="form-body">

+                <h3 data-trans="battery_voice_set" class="form-title"></h3>

+				<div class="row form-group">

+                    <div data-trans="battery_voice_info" class="col-xs-12"></div>

+                </div>

+                <div class="row form-group">				    

+                    <label class="col-xs-4 side-right" data-trans='close_voice_voltage' for="batteryVoiceSetting"></label>

+					<div class="col-xs-4">

+						<select id="batteryVoiceSetting" class="form-control" data-transid="close_voice_select" data-bind="options: batteryVoiceModes, value: currentVoiceMode, optionsText: transOption('close_voice_select'), optionsValue: 'value'"></select>

+					</div>

+                </div>

+				<div class="form-buttons">

+					<input data-bind="click:batteryVoiceSave" data-trans="apply" type="submit" formmethod="post" class="btn btn-primary margin-right-20"/>

+				</div>

+            </div>

+        </form>

+

         <div class="form-body">

             <div class="content margin-top-20 line-height-30">

                 <div class="row">

diff --git a/lynq/S300AI/ap/project/zx297520v3/prj_cpe/fs/normal/rootfs/etc_ro/default/default_parameter_user b/lynq/S300AI/ap/project/zx297520v3/prj_cpe/fs/normal/rootfs/etc_ro/default/default_parameter_user
index aeb47f3..36d785d 100755
--- a/lynq/S300AI/ap/project/zx297520v3/prj_cpe/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/lynq/S300AI/ap/project/zx297520v3/prj_cpe/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -557,3 +557,4 @@
 call_csp_number=
 #for voice end
 wifi_switch_status=
+battery_voice_voltage=0