| | |
| | | |
| | | import com.anyun.exam.lib.util.DESUtil; |
| | | import com.anyun.exam.lib.util.NetUtils; |
| | | import com.anyun.exam.lib.util.ProperUtil; |
| | | import com.anyun.exam.lib.util.Speaker; |
| | | import com.anyun.exam.lib.util.SpeakerCallback; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.lang.reflect.Method; |
| | | import java.util.ArrayList; |
| | | import java.util.Properties; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | | /** |
| | |
| | | Log.d(TAG, "UnsupportedEncodingException"); |
| | | } |
| | | } else { |
| | | Log.d(TAG, "Process " + Process.myPid() + " Thread " + Thread.currentThread().getId() + " RecvMsgFromMainProc cmd = " + String.format(" %04X ", cmd) + " length " + value.length() + " value " + value.trim()); |
| | | Log.d(TAG, "Process " + Process.myPid() + " Thread " + Thread.currentThread().getId() + " RecvMsgFromMainProc cmd = " + String.format(" %04X ", cmd) + " length " + value.length()); |
| | | MainProcMsgEntry(cmd, value.trim()); |
| | | } |
| | | } |
| | |
| | | |
| | | new Thread(new TestThread()).start(); |
| | | |
| | | new Thread(new AutoUpdateMcuThread(this)).start(); |
| | | |
| | | upgrade = Upgrade.getInstance(getApplicationContext()); |
| | | upgrade.CheckUpgrade(); |
| | | |
| | |
| | | Log.d(TAG, "基带版本 " + getBaseband_Ver()); |
| | | |
| | | String ver = getBaseband_Ver(); |
| | | } |
| | | |
| | | class AutoUpdateMcuThread implements Runnable { |
| | | private Context context; |
| | | |
| | | public AutoUpdateMcuThread(Context context) { |
| | | this.context = context; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | Properties proper = ProperUtil.getProperties(getApplicationContext()); |
| | | if (proper != null) { |
| | | String assetVer = proper.getProperty("mcuVersion"); |
| | | |
| | | if (assetVer != null) { |
| | | try { |
| | | InputStream inputStream = context.getAssets().open("dfu.bin"); |
| | | |
| | | if (inputStream != null) { |
| | | int fileLength = inputStream.available(); |
| | | Log.d(TAG, "AutoUpdateMcu " + fileLength); |
| | | |
| | | if (fileLength > 0) { |
| | | byte[] temp = new byte[fileLength]; |
| | | inputStream.read(temp); |
| | | |
| | | UpgradeMcu(assetVer, temp); |
| | | } |
| | | inputStream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | private void LimitMaxMinVolume() { |
| | |
| | | public native void startNative(); |
| | | public native void MainProcMsgEntry(int cmd, String value); |
| | | public native void MainProcBinMsgEntry(int cmd, byte []data, int length); |
| | | public native void UpgradeMcu(String vercode, byte []rom); |
| | | public native void TextSpeakEnd(int id); |
| | | } |