Explorar o código

开发门口机功能测试

vothin %!s(int64=2) %!d(string=hai) anos
pai
achega
59160dc01c

+ 16 - 2
i18n/zh_CN.tr

@@ -26,7 +26,7 @@
     <string name="SoftDown">下载</string>
     <string name="SoftVersionCheck">检查更新</string>
     <string name="SoftUpdateNow">立即升级</string>
-    <string name="SipTest">切换成SIP</string>
+    <string name="Test">调试模式</string>
     <string name="Confirm">确定</string>
     <string name="Cancel">取消</string>
     <string name="Save">保存</string>
@@ -93,13 +93,15 @@
     <string name="ServerIPWrong">服务器地址填写有误</string>
     <string name="InputPassword">输入密码</string>
     <string name="PasswordWrong">密码错误</string>
-    <string name="PasswordTag">4位密码</string>
+    <string name="PasswordTag">3位密码</string>
     <string name="Searching">查询中...</string>
     <string name="IsTheLastVersion">已经是最新版本</string>
     <string name="FindNewVersion">发现新版本</string>
     <string name="Downloading">下载中</string>
     <string name="EthernetDisconnect">未连接网络</string>
     <string name="DownloadFailed">下载错误,错误码</string>
+    <string name="PasswordText">3位密码</string>
+    <string name="PasswordInput">输入密码</string>
     <!-- 通话界面 -->
     <string name="RemoteRefuse">对方拒绝</string>
     <string name="RemoteBusy">对方忙线</string>
@@ -110,6 +112,18 @@
     <string name="CallInComing">来电</string>
     <string name="CallOutTitle">呼叫护士</string>
     <string name="Call">呼叫</string>
+    <!-- 测试界面 -->
+    <string name="InputSip">输入目标SIP账号</string>
+    <string name="ChangeToRtc">切换成RTC通话</string>
+    <string name="ChangeToSip">切换成SIP通话</string>
+    <string name="HandleKeys">手柄按键测试</string>
+    <string name="PanelCallKeys">面板呼叫按键测试</string>
+    <string name="PanelCancelKeys">面板取消按键测试</string>
+    <string name="RecordTest">录音测试</string>
+    <string name="RecordText">点击录音测试按钮,测试麦克风</string>
+    <string name="RecordStart">录音开始,录制时间10秒</string>
+    <string name="RecordPlay">录音结束,开始播放</string>
+    <string name="RecordStop">录音播放结束</string>
     <!-- 错误界面 -->
     <string name="NoBedList">当前房间没有床位</string>
     <string name="NoCustomer">当前房间用户入住</string>

+ 43 - 11
jni/activity/sipTestActivity.cpp

@@ -4,9 +4,13 @@
 #include "sipTestActivity.h"
 
 /*TAG:GlobalVariable全局变量*/
-static ZKTextView* mTextView1Ptr;
-static ZKButton* mbackPtr;
-static ZKButton* mButton1Ptr;
+static ZKCheckBox* mPanelCallKeysCheckboxPtr;
+static ZKTextView* mPanelCallKeysTextViewPtr;
+static ZKTextView* mRecordTestTextViewPtr;
+static ZKButton* mRecordTestButtonPtr;
+static ZKTextView* mInputSipTextViewPtr;
+static ZKButton* msys_backPtr;
+static ZKButton* mCallButtonPtr;
 static ZKEditText* mEditTextDestURIPtr;
 static sipTestActivity* mActivityPtr;
 
@@ -45,8 +49,9 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
-    ID_SIPTEST_back, onButtonClick_back,
-    ID_SIPTEST_Button1, onButtonClick_Button1,
+    ID_SIPTEST_RecordTestButton, onButtonClick_RecordTestButton,
+    ID_SIPTEST_sys_back, onButtonClick_sys_back,
+    ID_SIPTEST_CallButton, onButtonClick_CallButton,
 };
 /***************/
 
@@ -107,6 +112,16 @@ static S_VideoViewCallback SVideoViewCallbackTab[] = {
 };
 
 
+typedef void (*CheckboxCallback)(ZKCheckBox*, bool);
+typedef struct {
+  int id;
+  CheckboxCallback onCheckedChanged;
+}S_CheckboxCallback;
+/*TAG:CheckboxCallbackTab*/
+static S_CheckboxCallback SCheckboxCallbackTab[] = {
+    ID_SIPTEST_PanelCallKeysCheckbox, onCheckedChanged_PanelCallKeysCheckbox,
+};
+
 sipTestActivity::sipTestActivity() {
 	//todo add init code here
 	mVideoLoopIndex = -1;
@@ -119,9 +134,13 @@ sipTestActivity::~sipTestActivity() {
     EASYUICONTEXT->unregisterGlobalTouchListener(this);
     onUI_quit();
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
-    mTextView1Ptr = NULL;
-    mbackPtr = NULL;
-    mButton1Ptr = NULL;
+    mPanelCallKeysCheckboxPtr = NULL;
+    mPanelCallKeysTextViewPtr = NULL;
+    mRecordTestTextViewPtr = NULL;
+    mRecordTestButtonPtr = NULL;
+    mInputSipTextViewPtr = NULL;
+    msys_backPtr = NULL;
+    mCallButtonPtr = NULL;
     mEditTextDestURIPtr = NULL;
     mActivityPtr = NULL;
 }
@@ -133,9 +152,13 @@ const char* sipTestActivity::getAppName() const{
 //TAG:onCreate
 void sipTestActivity::onCreate() {
 	Activity::onCreate();
-    mTextView1Ptr = (ZKTextView*)findControlByID(ID_SIPTEST_TextView1);
-    mbackPtr = (ZKButton*)findControlByID(ID_SIPTEST_back);
-    mButton1Ptr = (ZKButton*)findControlByID(ID_SIPTEST_Button1);
+    mPanelCallKeysCheckboxPtr = (ZKCheckBox*)findControlByID(ID_SIPTEST_PanelCallKeysCheckbox);if(mPanelCallKeysCheckboxPtr!= NULL){mPanelCallKeysCheckboxPtr->setCheckedChangeListener(this);}
+    mPanelCallKeysTextViewPtr = (ZKTextView*)findControlByID(ID_SIPTEST_PanelCallKeysTextView);
+    mRecordTestTextViewPtr = (ZKTextView*)findControlByID(ID_SIPTEST_RecordTestTextView);
+    mRecordTestButtonPtr = (ZKButton*)findControlByID(ID_SIPTEST_RecordTestButton);
+    mInputSipTextViewPtr = (ZKTextView*)findControlByID(ID_SIPTEST_InputSipTextView);
+    msys_backPtr = (ZKButton*)findControlByID(ID_SIPTEST_sys_back);
+    mCallButtonPtr = (ZKButton*)findControlByID(ID_SIPTEST_CallButton);
     mEditTextDestURIPtr = (ZKEditText*)findControlByID(ID_SIPTEST_EditTextDestURI);if(mEditTextDestURIPtr!= NULL){mEditTextDestURIPtr->setTextChangeListener(this);}
 	mActivityPtr = this;
 	onUI_init();
@@ -406,4 +429,13 @@ void sipTestActivity::unregisterUserTimer(int id) {
 
 void sipTestActivity::resetUserTimer(int id, int time) {
 	resetTimer(id, time);
+}
+void sipTestActivity::onCheckedChanged(ZKCheckBox* pCheckBox, bool isChecked) {
+    int tablen = sizeof(SCheckboxCallbackTab) / sizeof(S_CheckboxCallback);
+    for (int i = 0; i < tablen; ++i) {
+        if (SCheckboxCallbackTab[i].id == pCheckBox->getID()) {
+        	SCheckboxCallbackTab[i].onCheckedChanged(pCheckBox, isChecked);
+            break;
+        }
+    }
 }

+ 10 - 3
jni/activity/sipTestActivity.h

@@ -23,12 +23,17 @@
 #include "control/ZKSeekBar.h"
 #include "control/ZKEditText.h"
 #include "control/ZKVideoView.h"
+#include "control/ZKCheckbox.h"
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
-#define ID_SIPTEST_TextView1    50001
-#define ID_SIPTEST_back    20002
-#define ID_SIPTEST_Button1    20001
+#define ID_SIPTEST_PanelCallKeysCheckbox    21002
+#define ID_SIPTEST_PanelCallKeysTextView    50003
+#define ID_SIPTEST_RecordTestTextView    50005
+#define ID_SIPTEST_RecordTestButton    20002
+#define ID_SIPTEST_InputSipTextView    50001
+#define ID_SIPTEST_sys_back   100
+#define ID_SIPTEST_CallButton    20001
 #define ID_SIPTEST_EditTextDestURI    51002
 /*TAG:Macro宏ID END*/
 
@@ -38,6 +43,7 @@ class sipTestActivity : public Activity,
                      public ZKListView::AbsListAdapter,
                      public ZKSlideWindow::ISlideItemClickListener,
                      public EasyUIContext::ITouchListener,
+                     public ZKCheckBox::ICheckedChangeListener,
                      public ZKEditText::ITextChangeListener,
                      public ZKVideoView::IVideoPlayerMessageListener
 {
@@ -77,6 +83,7 @@ protected:
     virtual void onSlideItemClick(ZKSlideWindow *pSlideWindow, int index);
 
     virtual bool onTouchEvent(const MotionEvent &ev);
+    virtual void onCheckedChanged(ZKCheckBox* pCheckBox, bool isChecked);
 
     virtual void onTextChanged(ZKTextView *pTextView, const string &text);
 

+ 21 - 4
jni/activity/ui3Activity.cpp

@@ -4,7 +4,12 @@
 #include "ui3Activity.h"
 
 /*TAG:GlobalVariable全局变量*/
-static ZKButton* mSipTestButtonPtr;
+static ZKTextView* mTestErrorTextViewPtr;
+static ZKButton* mTestConfirmButtonPtr;
+static ZKTextView* mTestPasswordTextViewPtr;
+static ZKEditText* mTestPasswordEditTextPtr;
+static ZKWindow* mTestPasswordWindowPtr;
+static ZKButton* mTestButtonPtr;
 static ZKButton* msys_backPtr;
 static ZKTextView* mVoiceDomainPtr;
 static ZKButton* mBtnSoftVerPtr;
@@ -78,7 +83,8 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
-    ID_UI3_SipTestButton, onButtonClick_SipTestButton,
+    ID_UI3_TestConfirmButton, onButtonClick_TestConfirmButton,
+    ID_UI3_TestButton, onButtonClick_TestButton,
     ID_UI3_sys_back, onButtonClick_sys_back,
     ID_UI3_BtnSoftVer, onButtonClick_BtnSoftVer,
     ID_UI3_BtnNetSetting, onButtonClick_BtnNetSetting,
@@ -131,6 +137,7 @@ typedef struct {
 }S_EditTextInputCallback;
 /*TAG:EditTextInputCallback*/
 static S_EditTextInputCallback SEditTextInputCallbackTab[] = {
+    ID_UI3_TestPasswordEditText, onEditTextChanged_TestPasswordEditText,
     ID_UI3_EditTextServerIP, onEditTextChanged_EditTextServerIP,
     ID_UI3_EditTextPwd, onEditTextChanged_EditTextPwd,
 };
@@ -159,7 +166,12 @@ ui3Activity::~ui3Activity() {
     EASYUICONTEXT->unregisterGlobalTouchListener(this);
     onUI_quit();
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
-    mSipTestButtonPtr = NULL;
+    mTestErrorTextViewPtr = NULL;
+    mTestConfirmButtonPtr = NULL;
+    mTestPasswordTextViewPtr = NULL;
+    mTestPasswordEditTextPtr = NULL;
+    mTestPasswordWindowPtr = NULL;
+    mTestButtonPtr = NULL;
     msys_backPtr = NULL;
     mVoiceDomainPtr = NULL;
     mBtnSoftVerPtr = NULL;
@@ -206,7 +218,12 @@ const char* ui3Activity::getAppName() const{
 //TAG:onCreate
 void ui3Activity::onCreate() {
 	Activity::onCreate();
-    mSipTestButtonPtr = (ZKButton*)findControlByID(ID_UI3_SipTestButton);
+    mTestErrorTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_TestErrorTextView);
+    mTestConfirmButtonPtr = (ZKButton*)findControlByID(ID_UI3_TestConfirmButton);
+    mTestPasswordTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_TestPasswordTextView);
+    mTestPasswordEditTextPtr = (ZKEditText*)findControlByID(ID_UI3_TestPasswordEditText);if(mTestPasswordEditTextPtr!= NULL){mTestPasswordEditTextPtr->setTextChangeListener(this);}
+    mTestPasswordWindowPtr = (ZKWindow*)findControlByID(ID_UI3_TestPasswordWindow);
+    mTestButtonPtr = (ZKButton*)findControlByID(ID_UI3_TestButton);
     msys_backPtr = (ZKButton*)findControlByID(ID_UI3_sys_back);
     mVoiceDomainPtr = (ZKTextView*)findControlByID(ID_UI3_VoiceDomain);
     mBtnSoftVerPtr = (ZKButton*)findControlByID(ID_UI3_BtnSoftVer);

+ 6 - 1
jni/activity/ui3Activity.h

@@ -26,7 +26,12 @@
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
-#define ID_UI3_SipTestButton    20007
+#define ID_UI3_TestErrorTextView    50026
+#define ID_UI3_TestConfirmButton    20008
+#define ID_UI3_TestPasswordTextView    50025
+#define ID_UI3_TestPasswordEditText    51003
+#define ID_UI3_TestPasswordWindow    110003
+#define ID_UI3_TestButton    20007
 #define ID_UI3_sys_back   100
 #define ID_UI3_VoiceDomain    50012
 #define ID_UI3_BtnSoftVer    20006

+ 126 - 0
jni/core/wavfile.cpp

@@ -0,0 +1,126 @@
+/*
+A simple sound library for CSE 20211 by Douglas Thain
+For course assignments, you should not change this file.
+For complete documentation, see:
+http://www.nd.edu/~dthain/courses/cse20211/fall2013/wavfile
+*/
+
+#include "wavfile.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+	FILE* wavfile_write_open(const char* filename)
+	{
+		struct wavfile_header header;
+
+		int samples_per_second = WAVFILE_SAMPLES_PER_SECOND;
+		int bits_per_sample = 16;
+
+		strncpy(header.riff_tag, "RIFF", 4);
+		strncpy(header.wave_tag, "WAVE", 4);
+		strncpy(header.fmt_tag, "fmt ", 4);
+		strncpy(header.data_tag, "data", 4);
+
+		header.riff_length = 0;
+		header.fmt_length = 16;
+		header.audio_format = 1;
+		header.num_channels = 1;
+		header.sample_rate = samples_per_second;
+		header.byte_rate = samples_per_second * (bits_per_sample / 8);
+		header.block_align = bits_per_sample / 8;
+		header.bits_per_sample = bits_per_sample;
+		header.data_length = 0;
+
+		FILE* file = fopen(filename, "w+");
+		if (!file) return 0;
+
+		fwrite(&header, sizeof(header), 1, file);
+
+		fflush(file);
+
+		return file;
+	}
+
+	FILE* wavfile_read_open(const char* filename, struct wavfile_header* header)
+	{
+
+		FILE* file = 0;
+		if (header != NULL)
+		{
+			file = fopen(filename, "rb");
+
+			if (!file)
+				return 0;
+
+			int r = fread(header, sizeof(struct wavfile_header), 1, file);
+			r = sizeof(struct wavfile_header);
+			printf("%d\n", r);
+		}
+		else
+		{
+			return 0;
+		}
+
+		return file;
+	}
+
+	long wavfile_read(FILE* file, short data[], int length)
+	{
+		return fread(data, sizeof(short), length, file);
+	}
+
+	void wavfile_write(FILE* file, short data[], int length)
+	{
+		fwrite(data, sizeof(short), length, file);
+	}
+
+	void wavfile_write_close(FILE* file)
+	{
+		int file_length = ftell(file);
+
+		int data_length = file_length - sizeof(struct wavfile_header);
+
+		fseek(file, sizeof(struct wavfile_header) - sizeof(int), SEEK_SET);
+
+		fwrite(&data_length, sizeof(data_length), 1, file);
+
+		int riff_length = file_length - 8;
+
+		fseek(file, 4, SEEK_SET);
+
+		fwrite(&riff_length, sizeof(riff_length), 1, file);
+		fflush(file);
+		fclose(file);
+	}
+
+	/*read the data from specified postion and channel*/
+	static short wavfile_read_pos(FILE* file, int channel_num, int channel_index, int pos)
+	{
+		short value;
+
+
+		long index = 44 + (pos * channel_num + channel_index) * sizeof(short);
+		fseek(file, index, SEEK_SET);
+
+		fread(&value, sizeof(short), 1, file);
+		return value;
+	}
+
+	void wavfile_read_channel(FILE* file, short data[], int channel_num, int channel_index, int start_pos, int length)
+	{
+		int i;
+		for (i = 0; i < length; ++i)
+		{
+			data[i] = wavfile_read_pos(file, channel_num, channel_index, start_pos + i);
+		}
+	}
+
+
+#ifdef __cplusplus
+}
+#endif

+ 84 - 0
jni/core/wavfile.h

@@ -0,0 +1,84 @@
+/*
+A simple sound library for CSE 20211 by Douglas Thain
+For course assignments, you should not change this file.
+For complete documentation, see:
+http://www.nd.edu/~dthain/courses/cse20211/fall2013/wavfile
+*/
+
+#ifndef _WAVFILE_H_
+#define _WAVFILE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stdio.h>
+	//#include <inttypes.h>
+
+	struct wavfile_header {
+		char	riff_tag[4];
+		int	riff_length;
+		char	wave_tag[4];
+		char	fmt_tag[4];
+		int	fmt_length;
+		short	audio_format;
+		short	num_channels;
+		int	sample_rate;
+		int	byte_rate;
+		short	block_align;
+		short	bits_per_sample;
+		char	data_tag[4];
+		int	data_length;
+	};
+
+	/*
+		open an audio file with write flag
+		and write necessary wav header to it;
+
+		input:
+			filename: string of the file name
+		output:
+			the file pointer of the audio file
+	*/
+	FILE* wavfile_write_open(const char* filename);
+
+	/*
+		write data to the audio file
+		input:
+			file: file pointer of the FILE
+			data: the array of data that need to be written to the file
+			length: number of short type numbers that need to be written
+	*/
+	void wavfile_write(FILE* file, short data[], int length);
+
+	/*
+		read data from file
+		input:
+			file:
+				file: file pointer of the file
+				data: the array to store data.
+				length: the number of short type numbers that need to be fetched.
+		output
+			the number of bytes that the function fetched fromt the file.
+	*/
+	long wavfile_read(FILE* file, short data[], int length);
+
+	/*
+		close the audio file and write the length to the header
+	*/
+	void wavfile_write_close(FILE* file);
+
+	/*
+		open an audio file for reading and get the header from file
+	*/
+	FILE* wavfile_read_open(const char* filename, struct wavfile_header* header);
+
+	/*
+		read the data of an channel with the specified postion and length
+	*/
+	void wavfile_read_channel(FILE* file, short data[], int channel_num, int channel_index, int start_pos, int length);
+#define WAVFILE_SAMPLES_PER_SECOND 16000
+
+#ifdef __cplusplus
+}
+#endif
+#endif

+ 153 - 12
jni/logic/sipTestLogic.cc

@@ -4,6 +4,10 @@
 #include "manager/ConfigManager.h"
 #include "core/utilities.h"
 #include "service/BusinessConfig.h"
+
+#include "core/wavfile.h"
+#include "voip/audio_player.h"
+#include "zkaudio.h"
 /*
 *此文件由GUI工具生成
 *文件功能:用于处理用户的逻辑相应代码
@@ -37,6 +41,123 @@
 
 static base::MediaPlayer media_player;
 
+namespace {
+FILE* file = NULL;
+
+class RecordTest : public Thread {
+  public:
+	void recordAudio() {
+        file = wavfile_write_open("/mnt/usb1/record.wav");
+
+        //设置录音(输入)音量
+        zk_audio_input_set_volume_native(0, 0);
+        zk_audio_input_set_volume_native(1, zk_audio_input_volume_native_max());
+
+        if (0 != zk_audio_input_init(2, 8000)) {
+            LOGD("audio input init failed");
+            return;
+        }
+//        //aec apc 初始化
+//        init();
+
+        const int buf_len = zk_audio_input_get_channel_buffer_size();
+        uint8_t* buf[2];
+        buf[0] = (uint8_t*)malloc(buf_len);
+        buf[1] = (uint8_t*)malloc(buf_len);
+
+        time_t deadline = time(NULL) + 10;
+        while (time(NULL) < deadline) {
+        	zk_audio_input_get_frame((uint8_t**)buf);
+
+            wavfile_write(file, ( short*) buf[1],
+                ZK_AUDIO_NUMBER_OF_SAMPLES_PER_FRAME);
+        }
+
+        free(buf[0]);
+        free(buf[1]);
+        zk_audio_input_deinit();
+        wavfile_write_close(file);
+
+		mRecordTestTextViewPtr->setText(LANGUAGEMANAGER->getValue("RecordPlay"));
+    	playAudio();
+	}
+	void playAudio() {
+		zk_audio_output_set_volume_native(zk_audio_output_volume_native_max());
+
+	    std::ifstream ifs("/mnt/usb1/record.wav",
+	        std::ios::binary | std::ios::in);
+	    if (!ifs.is_open()) {
+	    	LOGD("file not found");
+	    	return;
+	    }
+
+	    base::AudioParameter in;
+	    in.number_of_channels = 1;
+	    in.sample_rate = 8000;
+	    in.sample_format = base::SAMPLE_FMT_S16;
+
+	    base::AudioPlayer player(in);
+	    uint8_t buffer[256];
+
+	    player.Play();
+	    while (!ifs.eof()) {
+	      ifs.read((char*)buffer, int(sizeof(buffer)));
+	      int n = ifs.gcount();
+	      player.PutSamples(buffer, n);
+	    }
+	    ifs.close();
+	    player.Stop();
+
+		mRecordTestTextViewPtr->setText(LANGUAGEMANAGER->getValue("RecordStop"));
+	    mRecordTestButtonPtr->setSelected(false);
+	}
+
+	void Record() {
+		if(!isRunning()) {
+			mRecordTestTextViewPtr->setText(LANGUAGEMANAGER->getValue("RecordStart"));
+			play_ = true;
+			this->run("recordTest");
+		}
+	}
+
+	void Play() {
+		if(!isRunning()) {
+			play_ = false;
+			this->run("recordTest");
+		}
+	}
+
+    virtual bool threadLoop() {
+    	if(play_) {
+    		recordAudio();
+    		return false;
+    	}
+    	playAudio ();
+    	return false;
+    }
+  private:
+    bool play_ = true;
+};
+static RecordTest recordTest;
+
+}
+
+
+static bool panelCallKeysCheckbox = false;
+
+void setCheckbox(std::string check) {
+	if (check == "KEY<") {
+		if (panelCallKeysCheckbox) {
+			panelCallKeysCheckbox = false;
+			mPanelCallKeysCheckboxPtr->setChecked(false);
+		}
+		else {
+			panelCallKeysCheckbox = true;
+			mPanelCallKeysCheckboxPtr->setChecked(true);
+		}
+	}
+}
+
 /**
  * 注册定时器
  * 填充数组用于注册定时器
@@ -135,28 +256,48 @@ static bool onsipTestActivityTouchEvent(const MotionEvent &ev) {
 	}
 	return false;
 }
-static bool onButtonClick_Button1(ZKButton *pButton) {
+static void onEditTextChanged_EditTextDestURI(const std::string &text) {
+    //LOGD(" onEditTextChanged_ EditTextDestURI %s !!!\n", text.c_str());
+	StoragePreferences::putString(SIP_REG_DOOR_ACCOUNT, text);
+}
+
+static bool onButtonClick_CallButton(ZKButton *pButton) {
+    LOGD(" ButtonClick CallButton !!!\n");
 	int port = StoragePreferences::getInt(SIP_REG_PORT, SIP_REG_PORT_DEFAULT);
 	std::string domain = StoragePreferences::getString(SIP_REG_DOMAIN, SIP_REG_DOMAIN_DEFAULT);
 	std::string od_number = StoragePreferences::getString(SIP_REG_DOOR_ACCOUNT, SIP_REG_DOOR_ACCOUNT_DEFAULT);
 	std::string od_number_uri = URI(od_number, domain, port);
 	LOGD("od_number_uri: %s", od_number_uri.c_str());
 	GetTelephone()->MakeCall(od_number_uri);
-  return false;
+    return false;
 }
 
-
-static void onEditTextChanged_EditText1(const std::string &text) {
-    //LOGD(" onEditTextChanged_ EditText1 %s !!!\n", text.c_str());
+static bool onButtonClick_sys_back(ZKButton *pButton) {
+    LOGD(" ButtonClick sys_back !!!\n");
+	// 切换回TCP模式
+	StoragePreferences::putString(STORE_SIGNAL_TYPE, "TCP");
+    return false;
 }
-static void onEditTextChanged_EditTextDestURI(const std::string &text) {
-    //LOGD(" onEditTextChanged_ EditTextDestURI %s !!!\n", text.c_str());
-	StoragePreferences::putString(SIP_REG_DOOR_ACCOUNT, text);
+static void onCheckedChanged_Checkbox1(ZKCheckBox* pCheckBox, bool isChecked) {
+    LOGD(" Checkbox Checkbox1 checked %d", isChecked);
+}
+static void onCheckedChanged_HandleKeysCheckbox(ZKCheckBox* pCheckBox, bool isChecked) {
+    LOGD(" Checkbox HandleKeysCheckbox checked %d", isChecked);
 }
 
-static bool onButtonClick_back(ZKButton *pButton) {
-    LOGD(" ButtonClick back !!!\n");
-	StoragePreferences::putString(STORE_SIGNAL_TYPE, "TCP");
-	EASYUICONTEXT->goBack();
+static bool onButtonClick_RecordTestButton(ZKButton *pButton) {
+    LOGD(" ButtonClick RecordTestButton !!!\n");
+
+    // 如果线程在运行,则不能重复运行
+    if(recordTest.isRunning()) {
+		return false;
+	}
+	if(!pButton->isSelected()) {
+		pButton->setSelected(true);
+	}
+	recordTest.Record();
     return false;
 }
+static void onCheckedChanged_PanelCallKeysCheckbox(ZKCheckBox* pCheckBox, bool isChecked) {
+    LOGD(" Checkbox PanelCallKeysCheckbox checked %d", isChecked);
+}

+ 6 - 26
jni/logic/startLogic.cc

@@ -16,8 +16,6 @@
 #include <sys/reboot.h>
 #include "service/BusinessConfig.h"
 
-static bool isRestartTimerRegistered = false;
-static bool isHelpTimerRegistered = false;
 static bool sosTimerRegistered = true;
 static bool isSleepTimerRegistered = false;		// 是否开启息屏定时任务
 static bool isSleep = false;	// 是否在息屏
@@ -186,7 +184,7 @@ void handleMsg(byte* inBytes){
 			LOGD("transfered time : %s", pDate);
 			TimeHelper::setDateTime(pDate);
 
-			dataRefresh();
+//			dataRefresh();
 		}
 	} else if (tcpModel.type == TcpType::REINFORCE){
 		if (tcpModel.action == ReinforceAction::RESPONSED){
@@ -526,24 +524,6 @@ void setSleepTimerRegistered(bool result) {
 	}
 }
 
-void setRestartTimerRegistered(bool result) {
-	if (mActivityPtr == NULL) {
-		return;
-	}
-
-	if (result != isRestartTimerRegistered) {	// 在传过来的值不相等时,才继续进行
-		if (!isRestartTimerRegistered) {	// 如果是false,那就需要开启
-			isRestartTimerRegistered = true;
-			mActivityPtr->registerUserTimer(SYS_RESTART, 180000);
-		}
-		else {	// 如果是true,那就需要关闭
-			isRestartTimerRegistered = false;
-			mActivityPtr->unregisterUserTimer(SYS_RESTART);
-			dataRefresh();
-		}
-	}
-}
-
 void scrrenOn() {
 	isSleep = false;
 	BRIGHTNESSHELPER->screenOn();
@@ -862,6 +842,10 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
 				}
 			}
 			else if (data.cmd == "KEY<") {	//下左3,红
+				if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP") {
+					setCheckbox("KEY<");
+					return;
+				}
 				if (isSleep) {
 					scrrenOn();
 				}
@@ -991,11 +975,7 @@ static bool onUI_Timer(int id){
 		}
 	}
 		break;
-
-
-	case SYS_RESTART:
-		sync();
-		reboot(RB_AUTOBOOT);
+	default:
 		break;
 	}
 	return true;

+ 23 - 9
jni/logic/statusbar.cc

@@ -45,34 +45,52 @@
 
 
 #define SYS_RESTART 10	// 重启
-static bool isRestartTimerRegistered = false;
 
 
 void NavibarSetPartName(const std::string& partName){
 	mPartNamePtr->setText(partName);
 }
 
+
+static int netOffCount = 0;	//断网计数,每秒+1
+static int netOffMax = 300;	//断网300秒,则重启
+static bool isDataRefresh = false;
+
 static void updateNetState(){
+	if (ETHERNETMANAGER->isConnected()){
+		netOffCount = 0;
+		if (isDataRefresh) {
+			dataRefresh();
+			isDataRefresh = false;
+		}
+	} else {
+		netOffCount++;
+		isDataRefresh = true;
+		//5分钟仍然断网,则重启
+		if (netOffCount > netOffMax){
+			netOffCount = 0;
+			//重启
+			sync();
+			reboot(RB_AUTOBOOT);
+		}
+	}
+
 	EEthConnState connState = ETHERNETMANAGER->getConnState();
 	switch (connState){
 	case E_ETH_DISCONNECTED:	// 以太网断开
 		mPainter1Ptr->setBackgroundColor(0xFF949494);
-		setRestartTimerRegistered(true);
 		break;
 	case E_ETH_CONNECTING:		// 以太网连接中
 		mPainter1Ptr->setBackgroundColor(0xFF2F9DF1);
 		break;
 	case E_ETH_CONNECTED:		// 以太网连接
 		mPainter1Ptr->setBackgroundColor(0xFF37C127);
-		setRestartTimerRegistered(false);
 		break;
 	case E_ETH_DISCONNECTING:	// 以太网断开连接中
 		mPainter1Ptr->setBackgroundColor(0xFF949494);
-		setRestartTimerRegistered(true);
 		break;
 	case E_ETH_CONN_UNKNOWN:	// 以太网未知
 		mPainter1Ptr->setBackgroundColor(0xFF949494);
-		setRestartTimerRegistered(true);
 		break;
 	}
 }
@@ -231,10 +249,6 @@ static bool onUI_Timer(int id){
 	case 2:
 		tcpStatus();
 		break;
-	case SYS_RESTART:
-		sync();
-		reboot(RB_AUTOBOOT);
-		break;
 	default:
 		break;
 	}

+ 25 - 4
jni/logic/ui3Logic.cc

@@ -421,10 +421,31 @@ static bool onButtonClick_BackButton(ZKButton *pButton) {
 static bool onButtonClick_sys_back(ZKButton *pButton) {
     LOGD(" ButtonClick sys_back !!!\n");
     return false;
+}static bool onButtonClick_TestButton(ZKButton *pButton) {
+    LOGD(" ButtonClick TestButton !!!\n");
+    mTestPasswordWindowPtr->showWnd();
+    return false;
 }
-static bool onButtonClick_SipTestButton(ZKButton *pButton) {
-    LOGD(" ButtonClick SipTestButton !!!\n");
-	StoragePreferences::putString(STORE_SIGNAL_TYPE, "SIP");
-    EASYUICONTEXT->openActivity("sipTestActivity");
+static bool onButtonClick_TestConfirmButton(ZKButton *pButton) {
+    LOGD(" ButtonClick TestConfirmButton !!!\n");
+    string pwd = mTestPasswordEditTextPtr->getText();
+
+	// 密码为888
+	string cpwd = "888";
+    if (pwd == cpwd){
+    	// 关闭密码输入界面
+        mTestPasswordWindowPtr->hideWnd();
+        // 切换成SIP模式
+    	StoragePreferences::putString(STORE_SIGNAL_TYPE, "SIP");
+    	// 打开SIP调试界面
+        EASYUICONTEXT->openActivity("sipTestActivity");
+		return false;
+    } else {
+    	mTestErrorTextViewPtr->setTextTr("PasswordWrong");
+    }
+
     return false;
 }
+static void onEditTextChanged_TestPasswordEditText(const std::string &text) {
+    //LOGD(" onEditTextChanged_ TestPasswordEditText %s !!!\n", text.c_str());
+}

+ 5 - 5
jni/service/BusinessConfig.h

@@ -51,8 +51,8 @@
 #define STORE_SCREEN_LIGHT "screen_light"
 #define SIGNAL_TYPE "TCP" //TCP,SIP
 
-static std::string version = "v1.0.19";
-static int versionNo = 19;
+static std::string version = "v1.0.20";
+static int versionNo = 20;
 static std::string serverIP = "172.28.100.100";
 static std::string tcpIP = "172.28.100.100";
 static int serverHttpPort = 8006;
@@ -127,9 +127,6 @@ bool getSleepTimerRegistered();
 // 设置是否开启息屏定时任务
 void setSleepTimerRegistered(bool result);
 
-// 设置是否开启重启定时任务
-void setRestartTimerRegistered(bool result);
-
 // 设置护理的tcpModel
 void setNursingTcpModel(TcpModel source);
 /**
@@ -142,6 +139,9 @@ void setBtnHelpVisible(bool visible);
  */
 void cancelAutoBtnHelpTimer();
 
+// 设置调试的按键框
+void setCheckbox(std::string check);
+
 
 enum CallFinishType {
 	CANCEL,

BIN=BIN
libs/armeabi/libzkgui.so


BIN=BIN
obj/activity/DeviceUpdateActivity.o


BIN=BIN
obj/activity/callActivity.o


BIN=BIN
obj/activity/mainActivity.o


BIN=BIN
obj/activity/sipTestActivity.o


BIN=BIN
obj/activity/startActivity.o


BIN=BIN
obj/activity/statusbar.o


BIN=BIN
obj/activity/ui3Activity.o


BIN=BIN
obj/activity/warnActivity.o


BIN=BIN
obj/core/update_assistant.o


BIN=BIN
obj/core/wavfile.o


BIN=BIN
obj/net/tcp_client.o


BIN=BIN
obj/service/BusinessConfig.o


BIN=BIN
obj/service/time.o


BIN=BIN
ui/sipTest.ftu


BIN=BIN
ui/ui3.ftu