PX30SmatekAPI/PX30SmatekAPI/.gitignore
New file @@ -0,0 +1,14 @@ *.iml .gradle /local.properties /.idea/caches /.idea/libraries /.idea/modules.xml /.idea/workspace.xml /.idea/navEditor.xml /.idea/assetWizardSettings.xml .DS_Store /build /captures .externalNativeBuild .cxx PX30SmatekAPI/PX30SmatekAPI/.idea/codeStyles/Project.xml
New file @@ -0,0 +1,116 @@ <component name="ProjectCodeStyleConfiguration"> <code_scheme name="Project" version="173"> <codeStyleSettings language="XML"> <indentOptions> <option name="CONTINUATION_INDENT_SIZE" value="4" /> </indentOptions> <arrangement> <rules> <section> <rule> <match> <AND> <NAME>xmlns:android</NAME> <XML_ATTRIBUTE /> <XML_NAMESPACE>^$</XML_NAMESPACE> </AND> </match> </rule> </section> <section> <rule> <match> <AND> <NAME>xmlns:.*</NAME> <XML_ATTRIBUTE /> <XML_NAMESPACE>^$</XML_NAMESPACE> </AND> </match> <order>BY_NAME</order> </rule> </section> <section> <rule> <match> <AND> <NAME>.*:id</NAME> <XML_ATTRIBUTE /> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> </AND> </match> </rule> </section> <section> <rule> <match> <AND> <NAME>.*:name</NAME> <XML_ATTRIBUTE /> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> </AND> </match> </rule> </section> <section> <rule> <match> <AND> <NAME>name</NAME> <XML_ATTRIBUTE /> <XML_NAMESPACE>^$</XML_NAMESPACE> </AND> </match> </rule> </section> <section> <rule> <match> <AND> <NAME>style</NAME> <XML_ATTRIBUTE /> <XML_NAMESPACE>^$</XML_NAMESPACE> </AND> </match> </rule> </section> <section> <rule> <match> <AND> <NAME>.*</NAME> <XML_ATTRIBUTE /> <XML_NAMESPACE>^$</XML_NAMESPACE> </AND> </match> <order>BY_NAME</order> </rule> </section> <section> <rule> <match> <AND> <NAME>.*</NAME> <XML_ATTRIBUTE /> <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> </AND> </match> <order>ANDROID_ATTRIBUTE_ORDER</order> </rule> </section> <section> <rule> <match> <AND> <NAME>.*</NAME> <XML_ATTRIBUTE /> <XML_NAMESPACE>.*</XML_NAMESPACE> </AND> </match> <order>BY_NAME</order> </rule> </section> </rules> </arrangement> </codeStyleSettings> </code_scheme> </component> PX30SmatekAPI/PX30SmatekAPI/.idea/gradle.xml
New file @@ -0,0 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="GradleSettings"> <option name="linkedExternalProjectsSettings"> <GradleProjectSettings> <compositeConfiguration> <compositeBuild compositeDefinitionSource="SCRIPT" /> </compositeConfiguration> <option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="resolveModulePerSourceSet" value="false" /> <option name="testRunner" value="PLATFORM" /> </GradleProjectSettings> </option> </component> </project> PX30SmatekAPI/PX30SmatekAPI/.idea/misc.xml
New file @@ -0,0 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="JDK" project-jdk-type="JavaSDK"> <output url="file://$PROJECT_DIR$/build/classes" /> </component> <component name="ProjectType"> <option name="id" value="Android" /> </component> </project> PX30SmatekAPI/PX30SmatekAPI/.idea/runConfigurations.xml
New file @@ -0,0 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="RunConfigurationProducerService"> <option name="ignoredProducers"> <set> <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" /> <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" /> <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" /> </set> </option> </component> </project> PX30SmatekAPI/PX30SmatekAPI/app/.gitignore
New file @@ -0,0 +1 @@ /build PX30SmatekAPI/PX30SmatekAPI/app/build.gradle
New file @@ -0,0 +1,29 @@ apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.smatek.px30smatekapi" minSdkVersion 15 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation files('libs/px30_smatek.jar') } PX30SmatekAPI/PX30SmatekAPI/app/libs/px30_smatek.jarBinary files differ
PX30SmatekAPI/PX30SmatekAPI/app/proguard-rules.pro
New file @@ -0,0 +1,21 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the # proguardFiles setting in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} # Uncomment this to preserve the line number information for # debugging stack traces. #-keepattributes SourceFile,LineNumberTable # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile PX30SmatekAPI/PX30SmatekAPI/app/src/androidTest/java/com/smatek/px30smatekapi/ExampleInstrumentedTest.java
New file @@ -0,0 +1,26 @@ package com.smatek.px30smatekapi; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.smatek.px30smatekapi", appContext.getPackageName()); } } PX30SmatekAPI/PX30SmatekAPI/app/src/main/AndroidManifest.xml
New file @@ -0,0 +1,21 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.smatek.px30smatekapi"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> PX30SmatekAPI/PX30SmatekAPI/app/src/main/java/com/smatek/px30smatekapi/MainActivity.java
New file @@ -0,0 +1,587 @@ package com.smatek.px30smatekapi; import android.app.ISmatekListener; import android.app.SmatekManager; import android.content.Context; import android.content.Intent; import android.media.AudioManager; import android.os.Build; import android.os.SystemClock; import android.provider.Settings; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.InputDevice; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; import com.smatek.px30smatekapi.utils.EthernetUtils; import java.lang.reflect.Method; public class MainActivity extends AppCompatActivity implements View.OnClickListener, SeekBar.OnSeekBarChangeListener { private Button btnApiVersion, btnDeviceModel, btnOsVersion, btnRunningMemory, btnInnerStorage, btnFreeStorage, btnKernelVersion, btnBuilderNumber, btnShutDown, btnReboot, btnScreenshot, btnBrightness, btnRotation, btnHeight, btnWidth, btnOpenBackLight, btnCloseBackLight, btnStatusBarShow, btnStatusBarHide, btnEthMacAddress, btnEthIpAddress, btnScardPath, btnUsbPath, btnInner, btnInstall, btnSysTime, btnSysDate, btn24, btn12, btnEthernetConnect, btnSubmitStaticIp, btnSleep, btnScreen, btnScreenOpen, btnMasterClear, btnFilterPermission, btnOta, btnKeyInput, btnCpuGovernor, btnFrequencies, btnCurrentFreq, btnCpuControl, btnDramCurrentFreq, btnDramGovernor, btnWriteGpio, btnReadGpio, btnNetmask, btnGateway, btnDns, btnDisconnectEth, btnConnectEth, btnWwitchDhcp; // btnWatchDogOpen, btnWatchDogClose, private SeekBar sbVolume; private TextView tvContent; private EditText editIpAddress, editGateway, editNetmask, editDns1, editDns2, editBrightness, editRotation, editGovernor, editFrequencies, editCpuNode, editCpuNodeValue, editDramGovernor, editGpioInput, editGpioInputValue; private SmatekManager smatekManager; private static String TAG = "MainActivity"; private MyISmatekListener myISmatekListener; @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); smatekManager = (SmatekManager) getSystemService("smatek"); myISmatekListener = new MyISmatekListener(); smatekManager.addSmatekListener(myISmatekListener); } private void initView() { tvContent = findViewById(R.id.tv_content); btnApiVersion = findViewById(R.id.btn_api_version); btnDeviceModel = findViewById(R.id.btn_device_model); btnOsVersion = findViewById(R.id.btn_os_version); btnRunningMemory = findViewById(R.id.btn_running_memory); btnInnerStorage = findViewById(R.id.btn_inner_storage); btnFreeStorage = findViewById(R.id.btn_free_storage); btnKernelVersion = findViewById(R.id.btn_kernel_version); btnBuilderNumber = findViewById(R.id.btn_builder_number); btnShutDown = findViewById(R.id.btn_shut_down); btnReboot = findViewById(R.id.btn_reboot); btnScreenshot = findViewById(R.id.btn_screenshot); btnBrightness = findViewById(R.id.btn_brightness); btnRotation = findViewById(R.id.btn_rotation); btnHeight = findViewById(R.id.btn_height); btnWidth = findViewById(R.id.btn_width); btnOpenBackLight = findViewById(R.id.btn_open_back_light); btnCloseBackLight = findViewById(R.id.btn_close_back_light); btnStatusBarShow = findViewById(R.id.btn_statusBar_show); btnStatusBarHide = findViewById(R.id.btn_statusBar_hide); btnEthMacAddress = findViewById(R.id.btn_eth_mac_address); btnEthIpAddress = findViewById(R.id.btn_eth_ip_address); btnScardPath = findViewById(R.id.btn_sdcard); btnUsbPath = findViewById(R.id.btn_usb); btnInner = findViewById(R.id.btn_inner); btnInstall = findViewById(R.id.btn_install); // btnWatchDogOpen = findViewById(R.id.btn_watch_dog_open); // btnWatchDogClose = findViewById(R.id.btn_watch_dog_close); btnSysTime = findViewById(R.id.btn_sys_time); btnSysDate = findViewById(R.id.btn_sys_date); btn24 = findViewById(R.id.btn_24); btn12 = findViewById(R.id.btn_12); btnEthernetConnect = findViewById(R.id.btn_ethernet_connect); editRotation = findViewById(R.id.edit_rotation); sbVolume = findViewById(R.id.sb_volume); sbVolume.setOnSeekBarChangeListener(this); editIpAddress = findViewById(R.id.edit_ip_address); editGateway = findViewById(R.id.edit_gateway);//网关 editNetmask = findViewById(R.id.edit_netmask);//掩码 editDns1 = findViewById(R.id.edit_dns1); editDns2 = findViewById(R.id.edit_dns2); btnSubmitStaticIp = findViewById(R.id.btn_submit_static_ip); btnSleep = findViewById(R.id.btn_sleep); btnScreen = findViewById(R.id.btn_screen); btnScreenOpen = findViewById(R.id.btn_screen_open); editBrightness = findViewById(R.id.edit_brightness); btnMasterClear = findViewById(R.id.btn_master_clear); btnFilterPermission = findViewById(R.id.btn_filter_permission); btnOta = findViewById(R.id.btn_ota); btnKeyInput = findViewById(R.id.btn_key_input); editGovernor = findViewById(R.id.edit_cpu_governor); editFrequencies = findViewById(R.id.edit_cpu_frequencies); btnCpuGovernor = findViewById(R.id.btn_cpu_governor); btnFrequencies = findViewById(R.id.btn_cpu_frequencies); btnCurrentFreq = findViewById(R.id.btn_current_freq); editCpuNode = findViewById(R.id.edit_cpu_node); editCpuNodeValue = findViewById(R.id.edit_cpu_node_value); btnCpuControl = findViewById(R.id.btn_cpu_control); btnDramCurrentFreq = findViewById(R.id.btn_dram_current_freq); editDramGovernor = findViewById(R.id.edit_dram_governor); btnDramGovernor = findViewById(R.id.btn_dram_governor); editGpioInput = findViewById(R.id.edit_gpio_input); btnWriteGpio = findViewById(R.id.btn_write_gpio); btnReadGpio = findViewById(R.id.btn_read_gpio); editGpioInputValue = findViewById(R.id.edit_gpio_input_value); btnNetmask = findViewById(R.id.btn_netmask); btnGateway = findViewById(R.id.btn_gateway); btnDns = findViewById(R.id.btn_dns); btnDisconnectEth = findViewById(R.id.btn_disconnect_eth); btnConnectEth = findViewById(R.id.btn_connect_eth); btnWwitchDhcp = findViewById(R.id.btn_switch_dhcp); btnApiVersion.setOnClickListener(this); btnDeviceModel.setOnClickListener(this); btnOsVersion.setOnClickListener(this); btnRunningMemory.setOnClickListener(this); btnInnerStorage.setOnClickListener(this); btnFreeStorage.setOnClickListener(this); btnKernelVersion.setOnClickListener(this); btnBuilderNumber.setOnClickListener(this); btnShutDown.setOnClickListener(this); btnReboot.setOnClickListener(this); btnScreenshot.setOnClickListener(this); btnBrightness.setOnClickListener(this); btnRotation.setOnClickListener(this); btnHeight.setOnClickListener(this); btnWidth.setOnClickListener(this); btnOpenBackLight.setOnClickListener(this); btnCloseBackLight.setOnClickListener(this); btnStatusBarShow.setOnClickListener(this); btnStatusBarHide.setOnClickListener(this); btnEthMacAddress.setOnClickListener(this); btnEthIpAddress.setOnClickListener(this); btnScardPath.setOnClickListener(this); btnUsbPath.setOnClickListener(this); btnInner.setOnClickListener(this); btnInstall.setOnClickListener(this); // btnWatchDogOpen.setOnClickListener(this); // btnWatchDogClose.setOnClickListener(this); btnSysTime.setOnClickListener(this); btnSysDate.setOnClickListener(this); btn24.setOnClickListener(this); btn12.setOnClickListener(this); btnEthernetConnect.setOnClickListener(this); btnSubmitStaticIp.setOnClickListener(this); btnSleep.setOnClickListener(this); btnScreen.setOnClickListener(this); btnScreenOpen.setOnClickListener(this); btnMasterClear.setOnClickListener(this); btnFilterPermission.setOnClickListener(this); btnOta.setOnClickListener(this); btnKeyInput.setOnClickListener(this); btnCpuGovernor.setOnClickListener(this); btnFrequencies.setOnClickListener(this); btnCurrentFreq.setOnClickListener(this); btnCpuControl.setOnClickListener(this); btnDramCurrentFreq.setOnClickListener(this); btnDramGovernor.setOnClickListener(this); btnReadGpio.setOnClickListener(this); btnWriteGpio.setOnClickListener(this); btnNetmask.setOnClickListener(this); btnGateway.setOnClickListener(this); btnDns.setOnClickListener(this); btnDisconnectEth.setOnClickListener(this); btnConnectEth.setOnClickListener(this); btnWwitchDhcp.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_api_version: String apiVersion = smatekManager.getAPIVersion(); Log.e(TAG, "apiVersion :" + apiVersion); tvContent.setText(apiVersion); Toast.makeText(this, "aip版本 :" + apiVersion, Toast.LENGTH_SHORT).show(); break; case R.id.btn_device_model: String deviceModel = smatekManager.getDeviceModel(); Log.e(TAG, "deviceModel :" + deviceModel); tvContent.setText(deviceModel); Toast.makeText(this, "设备model :" + deviceModel, Toast.LENGTH_SHORT).show(); break; case R.id.btn_os_version: String androidOSVersion = smatekManager.getAndroidOSVersion(); Log.e(TAG, "androidOSVersion :" + androidOSVersion); tvContent.setText(androidOSVersion); Toast.makeText(this, "系统版本 :" + androidOSVersion, Toast.LENGTH_SHORT).show(); break; case R.id.btn_running_memory: String runningMemory = smatekManager.getRunningMemory(); Log.e(TAG, "runningMemory :" + runningMemory); tvContent.setText(runningMemory); Toast.makeText(this, "运行内存 :" + runningMemory, Toast.LENGTH_SHORT).show(); break; case R.id.btn_inner_storage: String internalStorageMemory = smatekManager.getInternalStorageMemory(); Log.e(TAG, "internalStorageMemory :" + internalStorageMemory); tvContent.setText(internalStorageMemory); Toast.makeText(this, "内部存储路径 :" + internalStorageMemory, Toast.LENGTH_SHORT).show(); break; case R.id.btn_free_storage: String internalFreeStorageMemory = smatekManager.getInternalFreeStorageMemory(); Log.e(TAG, "internalFreeStorageMemory :" + internalFreeStorageMemory); tvContent.setText(internalFreeStorageMemory); Toast.makeText(this, "内部存储可用容量 :" + internalFreeStorageMemory, Toast.LENGTH_SHORT).show(); break; case R.id.btn_kernel_version: String kernelVersion = smatekManager.getKernelVersion(); Log.e(TAG, "kernelVersion :" + kernelVersion); tvContent.setText(kernelVersion); Toast.makeText(this, "kernel版本信息 :" + kernelVersion, Toast.LENGTH_SHORT).show(); break; case R.id.btn_builder_number: String builderNumberDisplay = smatekManager.getBuilderNumberDisplay(); Log.e(TAG, "builderNumberDisplay :" + builderNumberDisplay); tvContent.setText(builderNumberDisplay); Toast.makeText(this, "DisplayId :" + builderNumberDisplay, Toast.LENGTH_SHORT).show(); break; case R.id.btn_shut_down: smatekManager.shutdown(); break; case R.id.btn_reboot: smatekManager.reboot(); break; case R.id.btn_screenshot: smatekManager.screenshots("/storage/emulated/0/", "test##.png"); break; case R.id.btn_brightness: String trim = editBrightness.getText().toString().trim(); if (!TextUtils.isEmpty(trim)) { smatekManager.setBrightness(Integer.parseInt(trim)); } else { Toast.makeText(MainActivity.this, "情输入亮度值", Toast.LENGTH_LONG).show(); } break; case R.id.btn_rotation: String rotation = editRotation.getText().toString().trim(); smatekManager.setRotation(rotation); break; case R.id.btn_height: int screenHeight = smatekManager.getScreenHeight(this); Log.e(TAG, "screenHeight :" + screenHeight); tvContent.setText(screenHeight + ""); Toast.makeText(this, "高 :" + screenHeight, Toast.LENGTH_SHORT).show(); break; case R.id.btn_width: int screenWidth = smatekManager.getScreenWidth(this); Log.e(TAG, "screenWidth :" + screenWidth); tvContent.setText(screenWidth + ""); Toast.makeText(this, "宽 :" + screenWidth, Toast.LENGTH_SHORT).show(); break; case R.id.btn_open_back_light: smatekManager.setLcdBlackLight(true); break; case R.id.btn_close_back_light: smatekManager.setLcdBlackLight(false); break; case R.id.btn_statusBar_show: Intent intent = new Intent(); intent.setAction("com.smatek.show.navigationbar"); intent.putExtra("show_navigationbar", true);//auto true 为显示 ,false 为 隐藏 sendBroadcast(intent); break; case R.id.btn_statusBar_hide: Intent intent1 = new Intent(); intent1.setAction("com.smatek.show.navigationbar"); intent1.putExtra("show_navigationbar", false);//auto true 为显示 ,false 为 隐藏 sendBroadcast(intent1); break; case R.id.btn_eth_mac_address: String ethMacAddress = smatekManager.getEthMacAddress(); Log.e(TAG, "ethMacAddress :" + ethMacAddress); tvContent.setText(ethMacAddress); Toast.makeText(this, "Mac 地址 :" + ethMacAddress, Toast.LENGTH_SHORT).show(); break; case R.id.btn_eth_ip_address: String ethIPAddress = smatekManager.getEthIPAddress(); Log.e(TAG, "ethIPAddress :" + ethIPAddress); tvContent.setText(ethIPAddress); Toast.makeText(this, "以太网ip地址 :" + ethIPAddress, Toast.LENGTH_SHORT).show(); break; case R.id.btn_inner: String primaryStoragePath = smatekManager.getPrimaryStoragePath(); Log.e(TAG, "primaryStoragePath :" + primaryStoragePath); tvContent.setText(primaryStoragePath); Toast.makeText(this, "内部存储路径 :" + primaryStoragePath, Toast.LENGTH_SHORT).show(); break; case R.id.btn_sdcard: String sdcardPath = smatekManager.getSdcardPath(); Log.e(TAG, "sdcardPath :" + sdcardPath); tvContent.setText(sdcardPath); Toast.makeText(this, "sdcard路径 :" + sdcardPath, Toast.LENGTH_SHORT).show(); break; case R.id.btn_usb: String usbPath = smatekManager.getUSBPath(); Log.e(TAG, "usbPath :" + usbPath); tvContent.setText(usbPath); Toast.makeText(this, "usb 路径 :" + usbPath, Toast.LENGTH_SHORT).show(); break; case R.id.btn_install: Intent intent3 = new Intent(); intent3.setAction("com.smatek.silentInstall"); intent3.putExtra("com.smatek.silentInstall.path", "/storage/emulated/0/GPS_Test.apk"); intent3.putExtra("com.smatek.silentInstall.packageName", "com.chartcross.gpstest"); sendBroadcast(intent3); break; case R.id.btn_sys_time: smatekManager.setSystemTime(16, 5); break; case R.id.btn_sys_date: smatekManager.setSystemDate(2019, 11, 5); break; case R.id.btn_24: smatekManager.setDateTime24hour(true); break; case R.id.btn_12: smatekManager.setDateTime24hour(false); break; case R.id.btn_ethernet_connect: int ethernetLinkStatus = smatekManager.getEthernetLinkStatus(); Log.e(TAG, "ethernetLinkStatus :" + ethernetLinkStatus); Toast.makeText(this, "以太网链接状态 :" + ethernetLinkStatus, Toast.LENGTH_SHORT).show(); break; case R.id.btn_submit_static_ip: //设置静态ip String ipAddress = editIpAddress.getText().toString().trim(); String gateway = editGateway.getText().toString().trim(); String netmask = editNetmask.getText().toString().trim(); String dns1 = editDns1.getText().toString().trim(); String dns2 = editDns2.getText().toString().trim(); EthernetUtils ethernetUtils = new EthernetUtils(); boolean b = ethernetUtils.checkIPValue(ipAddress, gateway, netmask, dns1, dns2); if (b) { smatekManager.setStaticIp(ipAddress, netmask, gateway, dns1, dns2); } break; case R.id.btn_sleep: smatekManager.goToSleep(); break; case R.id.btn_screen: smatekManager.openOrCloseScreen(true); break; case R.id.btn_screen_open: smatekManager.openOrCloseScreen(false); break; case R.id.btn_master_clear: smatekManager.eraseAllData(); break; case R.id.btn_filter_permission: smatekManager.setFilterPermissionPackageName("com.smatek.px30smatekapi"); Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 0); break; case R.id.btn_ota: Intent intent2 = new Intent(); intent2.setAction("com.smatek.ota.download.complete"); intent2.putExtra("com.smatek.ota.download.path", "/storage/emulated/0/px30_evb-ota-115442.zip"); sendBroadcast(intent2); break; case R.id.btn_key_input: // 模拟键值输入 long now = SystemClock.uptimeMillis(); KeyEvent down = new KeyEvent(now, now, KeyEvent.ACTION_DOWN, 25, 0); KeyEvent up = new KeyEvent(now, now, KeyEvent.ACTION_UP, 25, 0); smatekManager.injectInputEvent(down); smatekManager.injectInputEvent(up); // //模拟触摸点触摸 // MotionEvent event = MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN, 960, 540, 0); // MotionEvent event1 = MotionEvent.obtain(now, now, MotionEvent.ACTION_UP, 960, 540, 0); // if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == 0) { // event.setSource(InputDevice.SOURCE_TOUCHSCREEN); // } // // if ((event1.getSource() & InputDevice.SOURCE_CLASS_POINTER) == 0) { // event1.setSource(InputDevice.SOURCE_TOUCHSCREEN); // } // smatekManager.injectInputEvent(event); // smatekManager.injectInputEvent(event1); break; case R.id.btn_current_freq: String currentFreq = smatekManager.getDataFromNode("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"); Log.e(TAG, "currentFreq :" + currentFreq); Toast.makeText(this, "cpu当前频率 :" + currentFreq, Toast.LENGTH_SHORT).show(); break; case R.id.btn_cpu_governor: String cpuGovernor = editGovernor.getText().toString().trim(); Log.e(TAG, cpuGovernor); if (cpuGovernor != null) { smatekManager.writeToNode("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", cpuGovernor); } break; case R.id.btn_cpu_frequencies: String dataFromNode = smatekManager.getDataFromNode("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies"); String[] spit = dataFromNode.trim().split(" "); // 126000, 216000, 408000, 600000, 696000, 816000, 1008000, 1200000, 1416000, 1512000, 1608000 smatekManager.writeToNode("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", "userspace"); // 首先将cpu策略设置为userspace模式 smatekManager.writeToNode("/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed", spit[0]); //设置频率,spit[0] 是可用频率中的一个 break; case R.id.btn_cpu_control: String cpuNode = editCpuNode.getText().toString().trim(); String nodeValue = editCpuNodeValue.getText().toString().trim(); if (cpuNode != null && nodeValue != null) { smatekManager.writeToNode(cpuNode, nodeValue); } break; case R.id.btn_dram_current_freq: String dramFreq = smatekManager.getDataFromNode("/sys/devices/platform/dmc/devfreq/dmc/cur_freq"); Log.e(TAG, "dramFreq :" + dramFreq); Toast.makeText(this, "dram 当前频率 :" + dramFreq, Toast.LENGTH_SHORT).show(); break; case R.id.btn_dram_governor: String dramGovernor = editDramGovernor.getText().toString().trim(); if (dramGovernor != null) { smatekManager.writeToNode("/sys/class/devfreq/dmc/governor", dramGovernor);// dramGovernor可传入 dmc_ondemand、userspace、powersave、performance、simple_ondemand } break; case R.id.btn_write_gpio: String gpio = editGpioInput.getText().toString().trim(); String gpioValue = editGpioInputValue.getText().toString().trim(); if (!TextUtils.isEmpty(gpio)) { smatekManager.writeToNode(gpio, gpioValue); } else { Toast.makeText(this, "请输入节点", Toast.LENGTH_LONG).show(); } break; case R.id.btn_read_gpio: String gpiotest = editGpioInput.getText().toString().trim(); if (!TextUtils.isEmpty(gpiotest)) { String dataFromNode1 = smatekManager.getDataFromNode(gpiotest); Toast.makeText(this, "当前的节点值:" + dataFromNode1, Toast.LENGTH_LONG).show(); } else { Toast.makeText(this, "请输入节点", Toast.LENGTH_LONG).show(); } break; case R.id.btn_netmask: //子网掩码 String netmask1 = smatekManager.getNetmask(); Toast.makeText(this, "子网掩码:" + netmask1, Toast.LENGTH_LONG).show(); break; case R.id.btn_gateway: //网关 String gateway1 = smatekManager.getGateway(); Toast.makeText(this, "网关:" + gateway1, Toast.LENGTH_LONG).show(); break; case R.id.btn_dns://dns String dns = smatekManager.getDns(); Toast.makeText(this, "dns:" + dns, Toast.LENGTH_LONG).show(); break; case R.id.btn_disconnect_eth: //断开以太网 smatekManager.disconnectEth("eth0"); break; case R.id.btn_connect_eth: //链接以太网 smatekManager.connectEth("eth0"); break; case R.id.btn_switch_dhcp: //切换动态ip smatekManager.switchDHCP(); break; } } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { switch (seekBar.getId()) { case R.id.sb_volume: // smatekManager.setSystemVolume(progress); AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); int streamMaxVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); int i = (progress * streamMaxVolume / 100); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, i, AudioManager.FLAG_PLAY_SOUND); break; } } } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } private class MyISmatekListener implements ISmatekListener { @Override public void onKeyEvent(int i, int i1) { Log.e(TAG, " i :" + i + " i1 :" + i1); } @Override public void ethernetLinkState(int i) { Log.e(TAG, "ethernetLinkState i :" + i); } } @Override protected void onDestroy() { super.onDestroy(); if (myISmatekListener != null) { smatekManager.removeSmatekListener(myISmatekListener); } } } PX30SmatekAPI/PX30SmatekAPI/app/src/main/java/com/smatek/px30smatekapi/utils/EthernetUtils.java
New file @@ -0,0 +1,63 @@ package com.smatek.px30smatekapi.utils; import android.text.TextUtils; import android.util.Log; import java.util.regex.Pattern; public class EthernetUtils { public boolean checkIPValue(String ipAddr, String gateway, String netMask, String dns1, String dns2) { boolean enable = false; Pattern pattern = Pattern.compile("(^((\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])$)|^(\\d|[1-2]\\d|3[0-2])$"); /*check subnet mask*/ if (isValidIpAddress(ipAddr) && isValidIpAddress(gateway) && isValidIpAddress(dns1) && (pattern.matcher(netMask).matches())) { if (TextUtils.isEmpty(dns2)) { // 为空可以不考虑 enable = true; } else { if (isValidIpAddress(dns2)) { enable = true; } else { enable = false; } } } else { enable = false; } return enable; } private boolean isValidIpAddress(String value) { int start = 0; int end = value.indexOf('.'); int numBlocks = 0; while (start < value.length()) { if (-1 == end) { end = value.length(); } try { int block = Integer.parseInt(value.substring(start, end)); if ((block > 255) || (block < 0)) { Log.w("EthernetIP", "isValidIpAddress() : invalid 'block', block = " + block); return false; } } catch (NumberFormatException e) { Log.w("EthernetIP", "isValidIpAddress() : e = " + e); return false; } numBlocks++; start = end + 1; end = value.indexOf('.', start); } return numBlocks == 4; } } PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
New file @@ -0,0 +1,34 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" android:width="108dp" android:height="108dp" android:viewportWidth="108" android:viewportHeight="108"> <path android:fillType="evenOdd" android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z" android:strokeWidth="1" android:strokeColor="#00000000"> <aapt:attr name="android:fillColor"> <gradient android:endX="78.5885" android:endY="90.9159" android:startX="48.7653" android:startY="61.0927" android:type="linear"> <item android:color="#44000000" android:offset="0.0" /> <item android:color="#00000000" android:offset="1.0" /> </gradient> </aapt:attr> </path> <path android:fillColor="#FFFFFF" android:fillType="nonZero" android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z" android:strokeWidth="1" android:strokeColor="#00000000" /> </vector> PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/drawable/ic_launcher_background.xml
New file @@ -0,0 +1,170 @@ <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="108dp" android:height="108dp" android:viewportWidth="108" android:viewportHeight="108"> <path android:fillColor="#008577" android:pathData="M0,0h108v108h-108z" /> <path android:fillColor="#00000000" android:pathData="M9,0L9,108" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M19,0L19,108" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M29,0L29,108" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M39,0L39,108" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M49,0L49,108" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M59,0L59,108" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M69,0L69,108" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M79,0L79,108" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M89,0L89,108" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M99,0L99,108" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M0,9L108,9" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M0,19L108,19" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M0,29L108,29" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M0,39L108,39" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M0,49L108,49" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M0,59L108,59" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M0,69L108,69" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M0,79L108,79" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M0,89L108,89" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M0,99L108,99" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M19,29L89,29" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M19,39L89,39" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M19,49L89,49" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M19,59L89,59" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M19,69L89,69" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M19,79L89,79" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M29,19L29,89" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M39,19L39,89" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M49,19L49,89" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M59,19L59,89" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M69,19L69,89" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> <path android:fillColor="#00000000" android:pathData="M79,19L79,89" android:strokeWidth="0.8" android:strokeColor="#33FFFFFF" /> </vector> PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/layout/activity_main.xml
New file @@ -0,0 +1,698 @@ <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:id="@+id/tv_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="10dp" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_api_version" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="当前API版本" /> <Button android:id="@+id/btn_device_model" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="设备model" /> <Button android:id="@+id/btn_os_version" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="android系统版本" /> <Button android:id="@+id/btn_running_memory" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="运行内存" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_inner_storage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="内部存储空间" /> <Button android:id="@+id/btn_free_storage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="内部存储可用容量" /> <Button android:id="@+id/btn_kernel_version" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="获取当Kernel版本" /> </LinearLayout> <Button android:id="@+id/btn_builder_number" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="获取设备的固件系统版本和编译日期" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_shut_down" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="关机" /> <Button android:id="@+id/btn_reboot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="重启" /> <Button android:id="@+id/btn_screenshot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="截屏" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/edit_brightness" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:hint="取值0~255" android:inputType="number" /> <Button android:id="@+id/btn_brightness" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="设置屏幕亮度" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/edit_rotation" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="输入方向 0、90、180、270 " android:inputType="number" /> <Button android:id="@+id/btn_rotation" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="设置屏幕方向" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_height" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="获取屏幕Y像素" /> <Button android:id="@+id/btn_width" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="获取屏幕X像素" /> <Button android:id="@+id/btn_open_back_light" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="打开背光" /> <Button android:id="@+id/btn_close_back_light" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="关闭背光" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_statusBar_show" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="状态栏显示" /> <Button android:id="@+id/btn_statusBar_hide" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="状态栏隐藏" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_eth_mac_address" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="以太网 mac地址" /> <Button android:id="@+id/btn_eth_ip_address" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="以太网 ip地址" /> <Button android:id="@+id/btn_inner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="内部存储 路径" /> <Button android:id="@+id/btn_sdcard" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="sdcard 路径" /> <Button android:id="@+id/btn_usb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="usb 路径" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_install" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="静默安装" /> <!-- <Button--> <!-- android:id="@+id/btn_watch_dog_open"--> <!-- android:layout_width="wrap_content"--> <!-- android:layout_height="wrap_content"--> <!-- android:layout_weight="1"--> <!-- android:text="看门狗打开" />--> <!-- <Button--> <!-- android:id="@+id/btn_watch_dog_close"--> <!-- android:layout_width="wrap_content"--> <!-- android:layout_height="wrap_content"--> <!-- android:layout_weight="1"--> <!-- android:text="看门狗关闭" />--> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_sys_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="设置系统时间" /> <Button android:id="@+id/btn_sys_date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="设置系统日期" /> <Button android:id="@+id/btn_24" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="24小时制" /> <Button android:id="@+id/btn_12" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="12小时制" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="10dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="调节系统音量" /> <SeekBar android:id="@+id/sb_volume" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_ethernet_connect" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="以太网链接状态" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ip地址:" /> <EditText android:id="@+id/edit_ip_address" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="192.168.0.123" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="网关:" /> <EditText android:id="@+id/edit_gateway" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="192.168.0.1" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="netmask:" /> <EditText android:id="@+id/edit_netmask" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="255.255.225.0" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="dns1:" /> <EditText android:id="@+id/edit_dns1" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="192.168.0.1" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="dns2:" /> <EditText android:id="@+id/edit_dns2" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="0.0.0.0" /> </LinearLayout> <Button android:id="@+id/btn_submit_static_ip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="设置以太网静态IP" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_sleep" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="休眠" /> <Button android:id="@+id/btn_screen" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="关屏" /> <Button android:id="@+id/btn_screen_open" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="亮屏" /> <Button android:id="@+id/btn_master_clear" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="恢复出厂设置" /> <Button android:id="@+id/btn_filter_permission" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="过滤权限" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_ota" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ota升级" /> <Button android:id="@+id/btn_key_input" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="模拟屏幕触摸点触摸" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_current_freq" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="cpu当前频率" /> <Button android:id="@+id/btn_dram_current_freq" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="dram 当前频率" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/edit_cpu_governor" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:hint="可传入conservative、ondemand、userspace、powersave、interactive、performance" /> <Button android:id="@+id/btn_cpu_governor" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="CPU策略" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/edit_cpu_frequencies" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /> <Button android:id="@+id/btn_cpu_frequencies" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="CPU频率设置" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/edit_cpu_node" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:hint="被控制cpu节点" /> <EditText android:id="@+id/edit_cpu_node_value" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:hint="值" /> <Button android:id="@+id/btn_cpu_control" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="控制cpu1~cpu3 开关" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/edit_dram_governor" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:hint="可传入 dmc_ondemand、userspace、powersave、performance、simple_ondemand" /> <Button android:id="@+id/btn_dram_governor" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="dram策略控制" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/edit_gpio_input" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:hint="请输入节点" /> <EditText android:id="@+id/edit_gpio_input_value" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:hint="请输入值" /> <Button android:id="@+id/btn_write_gpio" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="写入" /> <Button android:id="@+id/btn_read_gpio" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="读出" /> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:id="@+id/btn_netmask" android:text="子网掩码" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:id="@+id/btn_gateway" android:text="网关" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:id="@+id/btn_dns" android:text="DNS" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:id="@+id/btn_disconnect_eth" android:text="断开以太网" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:id="@+id/btn_connect_eth" android:text="连接以太网" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> <Button android:id="@+id/btn_switch_dhcp" android:text="切换DHCP" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> </ScrollView> PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <background android:drawable="@drawable/ic_launcher_background" /> <foreground android:drawable="@drawable/ic_launcher_foreground" /> </adaptive-icon> PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <background android:drawable="@drawable/ic_launcher_background" /> <foreground android:drawable="@drawable/ic_launcher_foreground" /> </adaptive-icon> PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-hdpi/ic_launcher.png
PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-mdpi/ic_launcher.png
PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-xhdpi/ic_launcher.png
PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/values/colors.xml
New file @@ -0,0 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> <color name="colorPrimary">#008577</color> <color name="colorPrimaryDark">#00574B</color> <color name="colorAccent">#D81B60</color> </resources> PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/values/strings.xml
New file @@ -0,0 +1,3 @@ <resources> <string name="app_name">PX30SmatekAPI</string> </resources> PX30SmatekAPI/PX30SmatekAPI/app/src/main/res/values/styles.xml
New file @@ -0,0 +1,11 @@ <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> </resources> PX30SmatekAPI/PX30SmatekAPI/app/src/test/java/com/smatek/px30smatekapi/ExampleUnitTest.java
New file @@ -0,0 +1,17 @@ package com.smatek.px30smatekapi; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } } PX30SmatekAPI/PX30SmatekAPI/build.gradle
New file @@ -0,0 +1,27 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.5.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } PX30SmatekAPI/PX30SmatekAPI/gradle.properties
New file @@ -0,0 +1,15 @@ # Project-wide Gradle settings. # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true PX30SmatekAPI/PX30SmatekAPI/gradle/wrapper/gradle-wrapper.jarBinary files differ
PX30SmatekAPI/PX30SmatekAPI/gradle/wrapper/gradle-wrapper.properties
New file @@ -0,0 +1,6 @@ #Fri Dec 13 09:07:19 CST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip PX30SmatekAPI/PX30SmatekAPI/gradlew
New file @@ -0,0 +1,172 @@ #!/usr/bin/env sh ############################################################################## ## ## Gradle start up script for UN*X ## ############################################################################## # Attempt to set APP_HOME # Resolve links: $0 may be a link PRG="$0" # Need this for relative symlinks. while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG=`dirname "$PRG"`"/$link" fi done SAVED="`pwd`" cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME="`pwd -P`" cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS="" # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" warn () { echo "$*" } die () { echo echo "$*" echo exit 1 } # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false case "`uname`" in CYGWIN* ) cygwin=true ;; Darwin* ) darwin=true ;; MINGW* ) msys=true ;; NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else JAVACMD="java" which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi # Increase the maximum file descriptors if we can. if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then MAX_FD="$MAX_FD_LIMIT" fi ulimit -n $MAX_FD if [ $? -ne 0 ] ; then warn "Could not set maximum file descriptor limit: $MAX_FD" fi else warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" fi fi # For Darwin, add options to specify how the application appears in the dock if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi # For Cygwin, switch paths to Windows format before running java if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` SEP="" for dir in $ROOTDIRSRAW ; do ROOTDIRS="$ROOTDIRS$SEP$dir" SEP="|" done OURCYGPATTERN="(^($ROOTDIRS))" # Add a user-defined pattern to the cygpath arguments if [ "$GRADLE_CYGPATTERN" != "" ] ; then OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" fi # Now convert the arguments - kludge to limit ourselves to /bin/sh i=0 for arg in "$@" ; do CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` else eval `echo args$i`="\"$arg\"" fi i=$((i+1)) done case $i in (0) set -- ;; (1) set -- "$args0" ;; (2) set -- "$args0" "$args1" ;; (3) set -- "$args0" "$args1" "$args2" ;; (4) set -- "$args0" "$args1" "$args2" "$args3" ;; (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi # Escape application args save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } APP_ARGS=$(save "$@") # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then cd "$(dirname "$0")" fi exec "$JAVACMD" "$@" PX30SmatekAPI/PX30SmatekAPI/gradlew.bat
New file @@ -0,0 +1,84 @@ @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @rem @rem ########################################################################## @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS= @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if "%ERRORLEVEL%" == "0" goto init echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo. echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation. goto fail :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto init echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo. echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation. goto fail :init @rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args :win9xME_args @rem Slurp the command line arguments. set CMD_LINE_ARGS= set _SKIP=2 :win9xME_args_slurp if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% :end @rem End local scope for the variables with windows NT shell if "%ERRORLEVEL%"=="0" goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 exit /b 1 :mainEnd if "%OS%"=="Windows_NT" endlocal :omega PX30SmatekAPI/PX30SmatekAPI/settings.gradle
New file @@ -0,0 +1,2 @@ include ':app' rootProject.name='PX30SmatekAPI'