diff --git a/AndroidStudio_projects/.gitignore b/AndroidStudio_projects/.gitignore deleted file mode 100644 index aa724b7..0000000 --- a/AndroidStudio_projects/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.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 -local.properties diff --git a/AndroidStudio_projects/.idea/.gitignore b/AndroidStudio_projects/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/AndroidStudio_projects/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/AndroidStudio_projects/.idea/.name b/AndroidStudio_projects/.idea/.name deleted file mode 100644 index 1a82d1e..0000000 --- a/AndroidStudio_projects/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -Hamburger \ No newline at end of file diff --git a/AndroidStudio_projects/.idea/compiler.xml b/AndroidStudio_projects/.idea/compiler.xml deleted file mode 100644 index fb7f4a8..0000000 --- a/AndroidStudio_projects/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/.idea/deploymentTargetDropDown.xml b/AndroidStudio_projects/.idea/deploymentTargetDropDown.xml deleted file mode 100644 index 6c67e23..0000000 --- a/AndroidStudio_projects/.idea/deploymentTargetDropDown.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/.idea/gradle.xml b/AndroidStudio_projects/.idea/gradle.xml deleted file mode 100644 index a2d7c21..0000000 --- a/AndroidStudio_projects/.idea/gradle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/.idea/misc.xml b/AndroidStudio_projects/.idea/misc.xml deleted file mode 100644 index bdd9278..0000000 --- a/AndroidStudio_projects/.idea/misc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/.gitignore b/AndroidStudio_projects/app/.gitignore deleted file mode 100644 index 42afabf..0000000 --- a/AndroidStudio_projects/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/AndroidStudio_projects/app/.idea/.gitignore b/AndroidStudio_projects/app/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/AndroidStudio_projects/app/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/AndroidStudio_projects/app/.idea/gradle.xml b/AndroidStudio_projects/app/.idea/gradle.xml deleted file mode 100644 index b898c0a..0000000 --- a/AndroidStudio_projects/app/.idea/gradle.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/.idea/misc.xml b/AndroidStudio_projects/app/.idea/misc.xml deleted file mode 100644 index 6ff4d26..0000000 --- a/AndroidStudio_projects/app/.idea/misc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/CMakeLists.txt b/AndroidStudio_projects/app/CMakeLists.txt deleted file mode 100644 index 4fb9716..0000000 --- a/AndroidStudio_projects/app/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -# For more information about using CMake with Android Studio, read the -# documentation: https://d.android.com/studio/projects/add-native-code.html - -# Sets the minimum version of CMake required to build the native library. - -cmake_minimum_required(VERSION 3.4.1) - -# Creates and names a library, sets it as either STATIC -# or SHARED, and provides the relative paths to its source code. -# You can define multiple libraries, and CMake builds them for you. -# Gradle automatically packages shared libraries with your APK. - -add_library( # Sets the name of the library. - native-test - - # Sets the library as a shared library. - SHARED - - # Provides a relative path to your source file(s). - src/main/jni/native-test.c ) - -# Searches for a specified prebuilt library and stores the path as a -# variable. Because CMake includes system libraries in the search path by -# default, you only need to specify the name of the public NDK library -# you want to add. CMake verifies that the library exists before -# completing its build. - -find_library( # Sets the name of the path variable. - log-lib - - # Specifies the name of the NDK library that - # you want CMake to locate. - log ) - -# Specifies libraries CMake should link to your target library. You -# can link multiple libraries, such as libraries you define in this -# build script, prebuilt third-party libraries, or system libraries. - -target_link_libraries( # Specifies the target library. - native-test - - # Links the target library to the log library - # included in the NDK. - ${log-lib} ) \ No newline at end of file diff --git a/AndroidStudio_projects/app/build.gradle b/AndroidStudio_projects/app/build.gradle deleted file mode 100644 index 221593c..0000000 --- a/AndroidStudio_projects/app/build.gradle +++ /dev/null @@ -1,75 +0,0 @@ -plugins { - id 'com.android.application' -} - -android { - namespace 'com.example.hamburger' - compileSdk 32 - - defaultConfig { - applicationId "com.example.hamburger" - minSdk 21 - targetSdk 32 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - externalNativeBuild { - cmake { - cppFlags "" - } - } - - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - externalNativeBuild { - cmake { - path "CMakeLists.txt" - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - buildFeatures { - viewBinding true - } -} - -dependencies { - - - - - implementation 'androidx.appcompat:appcompat:1.4.1' - implementation 'com.google.android.material:material:1.5.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.3' - implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' - implementation 'androidx.navigation:navigation-fragment:2.4.1' - implementation 'androidx.navigation:navigation-ui:2.4.1' - implementation files('libs\\mysql-connector-java-5.1.49.jar') - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - - implementation 'com.jakewharton:butterknife:10.0.0' - annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0' - //noinspection GradleCompatible - androidTestImplementation 'com.android.support.test:runner:1.0.2' - //noinspection GradleCompatible - //implementation 'com.android.support:recyclerview-v7:28.0.0' - implementation 'androidx.appcompat:appcompat:1.0.0' - //noinspection DuplicatePlatformClasses - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation files('libs/json-simple-1.1.jar') - - - -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/libs/eventbus.jar b/AndroidStudio_projects/app/libs/eventbus.jar deleted file mode 100644 index 3e62b44..0000000 Binary files a/AndroidStudio_projects/app/libs/eventbus.jar and /dev/null differ diff --git a/AndroidStudio_projects/app/libs/java_websocket.jar b/AndroidStudio_projects/app/libs/java_websocket.jar deleted file mode 100644 index bb5caeb..0000000 Binary files a/AndroidStudio_projects/app/libs/java_websocket.jar and /dev/null differ diff --git a/AndroidStudio_projects/app/libs/json-simple-1.1.jar b/AndroidStudio_projects/app/libs/json-simple-1.1.jar deleted file mode 100644 index f395f41..0000000 Binary files a/AndroidStudio_projects/app/libs/json-simple-1.1.jar and /dev/null differ diff --git a/AndroidStudio_projects/app/libs/mysql-connector-java-5.1.49.jar b/AndroidStudio_projects/app/libs/mysql-connector-java-5.1.49.jar deleted file mode 100644 index d3c8b41..0000000 Binary files a/AndroidStudio_projects/app/libs/mysql-connector-java-5.1.49.jar and /dev/null differ diff --git a/AndroidStudio_projects/app/proguard-rules.pro b/AndroidStudio_projects/app/proguard-rules.pro deleted file mode 100644 index 481bb43..0000000 --- a/AndroidStudio_projects/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# 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 \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/androidTest/java/com/example/hamburger/ExampleInstrumentedTest.java b/AndroidStudio_projects/app/src/androidTest/java/com/example/hamburger/ExampleInstrumentedTest.java deleted file mode 100644 index 95943b8..0000000 --- a/AndroidStudio_projects/app/src/androidTest/java/com/example/hamburger/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.hamburger; - -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.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 Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - assertEquals("com.example.hamburger", appContext.getPackageName()); - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/debug/ic_launcher-playstore.png b/AndroidStudio_projects/app/src/debug/ic_launcher-playstore.png deleted file mode 100644 index 8fd3645..0000000 Binary files a/AndroidStudio_projects/app/src/debug/ic_launcher-playstore.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml b/AndroidStudio_projects/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index 036d09b..0000000 --- a/AndroidStudio_projects/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml b/AndroidStudio_projects/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 036d09b..0000000 --- a/AndroidStudio_projects/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-hdpi/ic_launcher.png b/AndroidStudio_projects/app/src/debug/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index f479211..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.png b/AndroidStudio_projects/app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.png deleted file mode 100644 index 1a3380f..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png b/AndroidStudio_projects/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 661686f..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-mdpi/ic_launcher.png b/AndroidStudio_projects/app/src/debug/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 9467357..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.png b/AndroidStudio_projects/app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.png deleted file mode 100644 index d089659..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png b/AndroidStudio_projects/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index c82b85b..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-xhdpi/ic_launcher.png b/AndroidStudio_projects/app/src/debug/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 273374d..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.png b/AndroidStudio_projects/app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.png deleted file mode 100644 index 9111144..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png b/AndroidStudio_projects/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 246f4ea..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png b/AndroidStudio_projects/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 703166a..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.png b/AndroidStudio_projects/app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 8224030..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png b/AndroidStudio_projects/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 21c43b6..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png b/AndroidStudio_projects/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 49388fd..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/AndroidStudio_projects/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.png deleted file mode 100644 index b9f9313..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png b/AndroidStudio_projects/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 346e0c7..0000000 Binary files a/AndroidStudio_projects/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/AndroidStudio_projects/app/src/debug/res/values/ic_launcher_background.xml b/AndroidStudio_projects/app/src/debug/res/values/ic_launcher_background.xml deleted file mode 100644 index 1e36900..0000000 --- a/AndroidStudio_projects/app/src/debug/res/values/ic_launcher_background.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - #0E3B53 - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/AndroidManifest.xml b/AndroidStudio_projects/app/src/main/AndroidManifest.xml deleted file mode 100644 index f9b17be..0000000 --- a/AndroidStudio_projects/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/dadac/testrosbridge/RCApplication.java b/AndroidStudio_projects/app/src/main/java/com/dadac/testrosbridge/RCApplication.java deleted file mode 100644 index 2ecc33c..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/dadac/testrosbridge/RCApplication.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.dadac.testrosbridge; - -import android.app.Application; - -import com.jilk.ros.rosbridge.ROSBridgeClient; - -/** - * @ Create by dadac on 2018/10/8. - * @Function: - * @Return: - */ -public class RCApplication extends Application { - - - ROSBridgeClient client; - - @Override - public void onCreate() { - super.onCreate(); - } - - @Override - public void onTerminate() { - if (client != null) - client.disconnect(); - super.onTerminate(); - - } - - public ROSBridgeClient getRosClient() { - return client; - } - - public void setRosClient(ROSBridgeClient client) { - this.client = client; - } - - -} - - - diff --git a/AndroidStudio_projects/app/src/main/java/com/dadac/testrosbridge/RosBridgeActivity.java b/AndroidStudio_projects/app/src/main/java/com/dadac/testrosbridge/RosBridgeActivity.java deleted file mode 100644 index 1249cbe..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/dadac/testrosbridge/RosBridgeActivity.java +++ /dev/null @@ -1,215 +0,0 @@ -package com.dadac.testrosbridge; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.os.Bundle; -import android.util.Log; -import android.view.MotionEvent; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; -import android.widget.TextView; -import android.widget.Toast; - - -import com.example.hamburger.R; -import com.jilk.ros.ROSClient; -import com.jilk.ros.rosbridge.ROSBridgeClient; -import com.jilk.ros.rosbridge.implementation.PublishEvent; - -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; - - -import de.greenrobot.event.EventBus; - - -/** - * @ Create by dadac on 2018/10/8. - * @Function: 开始啪啦啪啦的进行数据的传输,需要放在service里面进行传输,比较保险,可以一直在传输数据 - * @Return: - */ -public class RosBridgeActivity extends Activity implements View.OnClickListener { - - ROSBridgeClient client; - String ip = "10.8.87.23"; //虚拟机的 IP - // String ip = "192.168.10.20"; //半残废机器人的IP - // String ip = "192.168.10.200"; //机器人的IP - String port = "9090"; - - boolean isSubscrible = true; - private static int flagSubscrible = 0; - - private Button DC_Button_Subscrible; - private Button DC_Button_Publish; - private EditText DC_EditText_EnterWord; - private TextView DC_TextView_ShowData; - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_dashboard); - EventBus.getDefault().register(this); - onConnect(ip, port); - subMenuShow(); - } - - //初始化界面的参数 - private void subMenuShow() { - DC_Button_Subscrible = (Button) findViewById(R.id.DC_Button_Subscrible); - DC_Button_Subscrible.setOnClickListener(this); - DC_Button_Publish = (Button) findViewById(R.id.DC_Button_Publish); - DC_Button_Publish.setOnTouchListener(new ComponentOnTouch()); - DC_EditText_EnterWord = (EditText) findViewById(R.id.DC_EditText_EnterWord); - DC_TextView_ShowData = (TextView) findViewById(R.id.DC_TextView_ShowData); - } - - - /** - * @Function: 建立连接 - * @Return: - */ - public void onConnect(String ip, String port) { - - client = new ROSBridgeClient("ws://" + ip + ":" + port); - boolean conneSucc = client.connect(new ROSClient.ConnectionStatusListener() { - @Override - public void onConnect() { - client.setDebug(true); - ((RCApplication) getApplication()).setRosClient(client); - showTip("Connect ROS success"); - Log.d("dachen", "Connect ROS success"); - } - - - @Override - public void onDisconnect(boolean normal, String reason, int code) { - showTip("ROS disconnect"); - Log.d("dachen", "ROS disconnect"); - } - - @Override - public void onError(Exception ex) { - ex.printStackTrace(); - showTip("ROS communication error"); - Log.d("dachen", "ROS communication error"); - } - }); - } - - //接收来自Ros端的数据 - private void ReceiveDataToRos() { - if (isSubscrible == true) { - String msg1 = "{\"op\":\"subscribe\",\"topic\":\"/chatter\"}"; - client.send(msg1); - } else if (isSubscrible == false) { - String msg2 = "{\"op\":\"unsubscribe\",\"topic\":\"/chatter\"}"; - client.send(msg2); - } - } - - //发送数据到ROS端 - private void SendDataToRos(String data) { - String msg1 = "{ \"op\": \"publish\", \"topic\": \"/chatter\", \"msg\": { \"data\": \"" + data + " \" }}"; - // String msg2 = "{\"op\":\"publish\",\"topic\":\"/cmd_vel\",\"msg\":{\"linear\":{\"x\":" + 0 + ",\"y\":" + - // 0 + ",\"z\":0},\"angular\":{\"x\":0,\"y\":0,\"z\":" + 0.5 + "}}}"; - client.send(msg1); - } - - - private void showTip(final String tip) { - runOnUiThread(new Runnable() { - @Override - public void run() { - Toast.makeText(RosBridgeActivity.this, tip, Toast.LENGTH_SHORT).show(); - } - }); - } - - public void onEvent(final PublishEvent event) { - if ("/chatter".equals(event.name)) { - parseChatterTopic(event); - return; - } - Log.d("dachen", event.msg); - } - - private void parseChatterTopic(PublishEvent event) { - try { - JSONParser parser = new JSONParser(); - org.json.simple.JSONObject jsonObject = (org.json.simple.JSONObject) parser.parse(event.msg); - String jsondata = (String) jsonObject.get("data"); - DC_TextView_ShowData.setText(jsondata); - Log.i("dachen", jsondata); - } catch (ParseException e) { - e.printStackTrace(); - } - } - - @SuppressLint("NonConstantResourceId") - @Override - public void onClick(View v) { - switch (v.getId()) { - case R.id.DC_Button_Subscrible: - if (flagSubscrible % 2 == 0) { - isSubscrible = true; - DC_Button_Subscrible.setText("Subscrible"); - } - if (flagSubscrible % 2 == 1) { - isSubscrible = false; - DC_Button_Subscrible.setText("unSubscrible"); - } - flagSubscrible++; - ReceiveDataToRos(); - break; - default: - break; - } - } - - private class ComponentOnTouch implements View.OnTouchListener { - @SuppressLint("NonConstantResourceId") - @Override - public boolean onTouch(View v, MotionEvent event) { - switch (v.getId()) { - case R.id.DC_Button_Publish: - onTouchChange("up", event.getAction()); - break; - default: - break; - } - return true; - } - } - private boolean Btn_LongPress = false; - class MyThread extends Thread { - @Override - public void run() { - while (Btn_LongPress) { - try { - Thread.sleep(10); - } catch (InterruptedException e) { - e.printStackTrace(); - } - SendDataToRos("3"); - } - } - } - private void onTouchChange(String methodName, int eventAction) { - MyThread myThread = new MyThread(); - // 按下松开分别对应启动停止线程方法 - if ("up".equals(methodName)) { - if (eventAction == MotionEvent.ACTION_DOWN) { - myThread.start(); - Btn_LongPress = true; - } else if (eventAction == MotionEvent.ACTION_UP) { - SendDataToRos("stop"); - if (myThread != null) - Btn_LongPress = false; - } - } - } - -} - diff --git a/AndroidStudio_projects/app/src/main/java/com/example/dadac/testrosbridge/JNICallAll.java b/AndroidStudio_projects/app/src/main/java/com/example/dadac/testrosbridge/JNICallAll.java deleted file mode 100644 index 1d04c40..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/dadac/testrosbridge/JNICallAll.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.example.dadac.testrosbridge; - -/** - * @ Create by dadac on 2018/10/8. - * @Function: 存放所有的 JNI 调用的文件 - * @Return: - */ -public class JNICallAll { - - // Used to load the 'native-lib' library on application startup. - static { - System.loadLibrary("native-test"); - } - - /** - * A native method that is implemented by the 'native-lib' native library, - * which is packaged with this application. - */ - public native String stringFromJNI(); - - - -} diff --git a/AndroidStudio_projects/app/src/main/java/com/example/dadac/testrosbridge/TransferSta.java b/AndroidStudio_projects/app/src/main/java/com/example/dadac/testrosbridge/TransferSta.java deleted file mode 100644 index a1dd58a..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/dadac/testrosbridge/TransferSta.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.example.dadac.testrosbridge; - -import android.content.Intent; -//import android.support.v7.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatActivity; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; - -import com.dadac.testrosbridge.RosBridgeActivity; -import com.example.hamburger.R; - -public class TransferSta extends AppCompatActivity { - - private Button DC_Button_JumpToRos; - - /* @Override - /*protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_dashboard); - DC_Button_JumpToRos = (Button) findViewById(R.id.DC_Button_JumpToRos); - } - - - public void JumpToActivity(View view) { - Intent myIntentRos = new Intent(TransferSta.this, RosBridgeActivity.class); - startActivity(myIntentRos); - }*/ -} diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/MainActivity.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/MainActivity.java deleted file mode 100644 index a03505f..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/MainActivity.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.example.hamburger; - -import androidx.appcompat.app.AppCompatActivity; - -import android.content.Intent; -import android.os.Bundle; -import android.widget.EditText; -import android.view.View; -import android.widget.Toast; -import android.widget.Button; -import android.os.Handler; -import android.os.Message; -import android.annotation.SuppressLint; -import com.example.hamburger.dao.UserDao; - -public class MainActivity extends AppCompatActivity { - - //这个类主要用来进行,账号密码的验证,以及监听事件的编写。 - // 所以首先需要将一开始设计的输入文本框id name 和passwd获取。 - EditText name;//创建账号 - EditText passwd;//创建密码 - - private static final String TAG="mysql-hamburger-MainActivity"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - name=findViewById(R.id.name);//获取输入的账号 - passwd=findViewById(R.id.passwd);//获取输入的密码 - - - //这是能够登录的账号密码 - String Usename = "admin"; - String Upwd = "12345"; - - //创建两个String类,储存从输入文本框获取到的内容 - String user = name.getText().toString().trim(); - String pwd = passwd.getText().toString().trim(); - - //获取按钮 - Button button = (Button) findViewById(R.id.button); - Button button_1 = (Button) findViewById(R.id.register); - - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick (View v){ - //监听按钮,如果点击,就跳转 - Intent intent = new Intent(); - //前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面 - intent.setClass(MainActivity.this, MainActivity2.class); - startActivity(intent); - //Toast.makeText(MainActivity.this, "欢迎你", Toast.LENGTH_SHORT).show(); - } - }); - - /*//进行判断,如果两个内容都相等,就显现第一条语句,反之,第二条。 - if(user.equals(Usename) & pwd.equals(Upwd)){ - //按钮进行监听 - - }*/ - //else{ - // Toast.makeText(MainActivity.this, "身份验证错误,禁止访问", Toast.LENGTH_SHORT).show(); - //} - //按钮进行监听 - button_1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //监听按钮,如果点击,就跳转 - Intent intent = new Intent(); - //前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面 - intent.setClass(MainActivity.this, register.class); - startActivity(intent); - } - }); - } - - public void login(View view){ - - EditText EditTextAccount = findViewById(R.id.name); - EditText EditTextPassword = findViewById(R.id.passwd); - - new Thread(){ - @Override - public void run() { - UserDao userDao = new UserDao(); - int msg = userDao.login(EditTextAccount.getText().toString(),EditTextPassword.getText().toString()); - hand1.sendEmptyMessage(msg); - } - }.start(); - - } - - public void reg(View view){ - startActivity(new Intent(getApplicationContext(),register.class)); - } - - @SuppressLint("HandlerLeak") - final Handler hand1 = new Handler() { - @Override - public void handleMessage(Message msg) { - if (msg.what == 0){ - Toast.makeText(getApplicationContext(), "登录失败", Toast.LENGTH_LONG).show(); - } else if (msg.what == 1) { - Toast.makeText(getApplicationContext(), "登录成功", Toast.LENGTH_LONG).show(); - } else if (msg.what == 2){ - Toast.makeText(getApplicationContext(), "密码错误", Toast.LENGTH_LONG).show(); - } else if (msg.what == 3){ - Toast.makeText(getApplicationContext(), "账号不存在", Toast.LENGTH_LONG).show(); - } - } - }; - -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/MainActivity2.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/MainActivity2.java deleted file mode 100644 index 522eda9..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/MainActivity2.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.example.hamburger; - -import android.os.Bundle; - -import com.google.android.material.bottomnavigation.BottomNavigationView; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.navigation.NavController; -import androidx.navigation.Navigation; -import androidx.navigation.ui.AppBarConfiguration; -import androidx.navigation.ui.NavigationUI; - -import com.example.hamburger.databinding.ActivityMain2Binding; - -public class MainActivity2 extends AppCompatActivity { - - private ActivityMain2Binding binding; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - binding = ActivityMain2Binding.inflate(getLayoutInflater()); - setContentView(binding.getRoot()); - - BottomNavigationView navView = findViewById(R.id.nav_view); - // Passing each menu ID as a set of Ids because each - // menu should be considered as top level destinations. - AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( - R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications) - .build(); - NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main2); - NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); - NavigationUI.setupWithNavController(binding.navView, navController); - } - -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/add.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/add.java deleted file mode 100644 index 1866186..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/add.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.example.hamburger; -import androidx.appcompat.app.AppCompatActivity; - -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; - -import com.example.hamburger.R; -import com.example.hamburger.notifications; -import com.example.hamburger.ui.notifications.NotificationsFragment; - -public class add extends AppCompatActivity { - - EditText mytext; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_add); - mytext = findViewById(R.id.mt); - - } - - public void Confirm() { - Button button = (Button) findViewById(R.id.conf); - - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(); - intent.setClass(add.this, NotificationsFragment.class); - startActivity(intent); - } - }); - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/dao/UserDao.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/dao/UserDao.java deleted file mode 100644 index 2ab20f0..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/dao/UserDao.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.example.hamburger.dao; - - -import com.example.hamburger.entity.User; -import com.example.hamburger.utils.JDBCUtils; -import android.util.Log; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.HashMap; - -/** - * author: yan - * date: 2022.02.17 - * **/ -public class UserDao { - - private static final String TAG = "mysql-party-UserDao"; - - /** - * function: 登录 - * */ - public int login(String userAccount, String userPassword){ - - HashMap map = new HashMap<>(); - // 根据数据库名称,建立连接 - Connection connection = JDBCUtils.getConn(); - int msg = 0; - try { - // mysql简单的查询语句。这里是根据user表的userAccount字段来查询某条记录 - String sql = "select * from user where userAccount = ?"; - if (connection != null){// connection不为null表示与数据库建立了连接 - PreparedStatement ps = connection.prepareStatement(sql); - if (ps != null){ - Log.e(TAG,"账号:" + userAccount); - //根据账号进行查询 - ps.setString(1, userAccount); - // 执行sql查询语句并返回结果集 - ResultSet rs = ps.executeQuery(); - int count = rs.getMetaData().getColumnCount(); - //将查到的内容储存在map里 - while (rs.next()){ - // 注意:下标是从1开始的 - for (int i = 1;i <= count;i++){ - String field = rs.getMetaData().getColumnName(i); - map.put(field, rs.getString(field)); - } - } - connection.close(); - ps.close(); - - if (map.size()!=0){ - StringBuilder s = new StringBuilder(); - //寻找密码是否匹配 - for (String key : map.keySet()){ - if(key.equals("userPassword")){ - if(userPassword.equals(map.get(key))){ - msg = 1; //密码正确 - } - else - msg = 2; //密码错误 - break; - } - } - }else { - Log.e(TAG, "查询结果为空"); - msg = 3; - } - }else { - msg = 0; - } - }else { - msg = 0; - } - }catch (Exception e){ - e.printStackTrace(); - Log.d(TAG, "异常login:" + e.getMessage()); - msg = 0; - } - return msg; - } - - - /** - * function: 注册 - * */ - public boolean register(User user){ - HashMap map = new HashMap<>(); - // 根据数据库名称,建立连接 - Connection connection = JDBCUtils.getConn(); - - try { - String sql = "insert into user(userAccount,userPassword,userName,userType,userState,userDel) values (?,?,?,?,?,?)"; - if (connection != null){// connection不为null表示与数据库建立了连接 - PreparedStatement ps = connection.prepareStatement(sql); - if (ps != null){ - - //将数据插入数据库 - ps.setString(1,user.getUserAccount()); - ps.setString(2,user.getUserPassword()); - ps.setString(3,user.getUserName()); - ps.setInt(4,user.getUserType()); - ps.setInt(5, user.getUserState()); - ps.setInt(6,user.getUserDel()); - - // 执行sql查询语句并返回结果集 - int rs = ps.executeUpdate(); - if(rs>0) - return true; - else - return false; - }else { - return false; - } - }else { - return false; - } - }catch (Exception e){ - e.printStackTrace(); - Log.e(TAG, "异常register:" + e.getMessage()); - return false; - } - - } - - /** - * function: 根据账号进行查找该用户是否存在 - * */ - public User findUser(String userAccount) { - - // 根据数据库名称,建立连接 - Connection connection = JDBCUtils.getConn(); - User user = null; - try { - String sql = "select * from user where userAccount = ?"; - if (connection != null){// connection不为null表示与数据库建立了连接 - PreparedStatement ps = connection.prepareStatement(sql); - if (ps != null) { - ps.setString(1, userAccount); - ResultSet rs = ps.executeQuery(); - - while (rs.next()) { - //注意:下标是从1开始 - int id = rs.getInt(1); - String userAccount1 = rs.getString(2); - String userPassword = rs.getString(3); - String userName = rs.getString(4); - int userType = rs.getInt(5); - int userState = rs.getInt(6); - int userDel = rs.getInt(7); - user = new User(id, userAccount1, userPassword, userName, userType, userState, userDel); - } - } - } - }catch (Exception e){ - e.printStackTrace(); - Log.d(TAG, "异常findUser:" + e.getMessage()); - return null; - } - return user; - } - -} - diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/entity/User.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/entity/User.java deleted file mode 100644 index 9534e82..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/entity/User.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.example.hamburger.entity; - -public class User { - - private int id; - private String userAccount; - private String userPassword; - private String userName; - private int userType; - private int userState; - private int userDel; - - - public User() { - } - - public User(int id, String userAccount, String userPassword, String userName, int userType, int userState, int userDel) { - this.id = id; - this.userAccount = userAccount; - this.userPassword = userPassword; - this.userName = userName; - this.userType = userType; - this.userState = userState; - this.userDel = userDel; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getUserAccount() { - return userAccount; - } - - public void setUserAccount(String userAccount) { - this.userAccount = userAccount; - } - - public String getUserPassword() { - return userPassword; - } - - public void setUserPassword(String userPassword) { - this.userPassword = userPassword; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public int getUserType() { - return userType; - } - - public void setUserType(int userType) { - this.userType = userType; - } - - public int getUserState() { - return userState; - } - - public void setUserState(int userState) { - this.userState = userState; - } - - public int getUserDel() { - return userDel; - } - - public void setUserDel(int userDel) { - this.userDel = userDel; - } -} - diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/main_window.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/main_window.java deleted file mode 100644 index 783274d..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/main_window.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.hamburger; - -import android.os.Bundle; - -import androidx.appcompat.app.AppCompatActivity; - -public class main_window extends AppCompatActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - //这个是获取布局文件的,这里是你下一个页面的布局文件//注意这个是跳转界面的不能设置错,应该是第一个 - setContentView(R.layout.main_window); - } - -} diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/notifications.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/notifications.java deleted file mode 100644 index 7bdd418..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/notifications.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.example.hamburger; -import androidx.appcompat.app.AppCompatActivity; - -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.TextView; - -public class notifications extends AppCompatActivity { - - private TextView tv; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_notifications); - - Button button = (Button) findViewById(R.id.btn1); - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(); - intent.setClass(notifications.this, add.class); - startActivity(intent); - } - }); - } - -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/register.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/register.java deleted file mode 100644 index f3997a2..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/register.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.example.hamburger; - -import android.annotation.SuppressLint; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; - -import androidx.appcompat.app.AppCompatActivity; - -public class register extends AppCompatActivity { - - EditText name;//创建账号 - EditText passwd;//创建密码 - EditText ackpasswd; - - @SuppressLint("MissingInflatedId") - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - //这个是获取布局文件的,这里是你下一个页面的布局文件//注意这个是跳转界面的不能设置错,应该是第一个 - setContentView(R.layout.activity_register); - - name=findViewById(R.id.user_name);//获取输入的账号 - passwd=findViewById(R.id.new_passwd);//获取输入的密码 - ackpasswd=findViewById(R.id.ack_passwd); - } - - public void Register_(){ - //获取按钮 - Button button = (Button) findViewById(R.id.register_); - - //按钮进行监听 - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //监听按钮,如果点击,就跳转 - Intent intent = new Intent(); - //前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面 - intent.setClass(register.this, MainActivity.class); - startActivity(intent); - } - }); - } - - public void Ret(){ - //获取按钮 - Button button = (Button) findViewById(R.id.ret); - - //按钮进行监听 - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //监听按钮,如果点击,就跳转 - Intent intent = new Intent(); - //前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面 - intent.setClass(register.this, MainActivity.class); - startActivity(intent); - } - }); - } - -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/dashboard/DashboardFragment.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/dashboard/DashboardFragment.java deleted file mode 100644 index 914176e..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/dashboard/DashboardFragment.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.example.hamburger.ui.dashboard; - -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.lifecycle.ViewModelProvider; - -import com.example.hamburger.databinding.FragmentDashboardBinding; - -public class DashboardFragment extends Fragment { - - private FragmentDashboardBinding binding; - - public View onCreateView(@NonNull LayoutInflater inflater, - ViewGroup container, Bundle savedInstanceState) { - DashboardViewModel dashboardViewModel = - new ViewModelProvider(this).get(DashboardViewModel.class); - - binding = FragmentDashboardBinding.inflate(inflater, container, false); - View root = binding.getRoot(); - - final TextView textView = binding.v1; - dashboardViewModel.getText().observe(getViewLifecycleOwner(), textView::setText); - return root; - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - binding = null; - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/dashboard/DashboardViewModel.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/dashboard/DashboardViewModel.java deleted file mode 100644 index 4ecff72..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/dashboard/DashboardViewModel.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.example.hamburger.ui.dashboard; - -import androidx.lifecycle.LiveData; -import androidx.lifecycle.MutableLiveData; -import androidx.lifecycle.ViewModel; - -public class DashboardViewModel extends ViewModel { - - private final MutableLiveData mText; - - public DashboardViewModel() { - mText = new MutableLiveData<>(); - mText.setValue(""); - } - - public LiveData getText() { - return mText; - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/home/HomeFragment.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/home/HomeFragment.java deleted file mode 100644 index 26a09fb..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/home/HomeFragment.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.example.hamburger.ui.home; - -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.lifecycle.ViewModelProvider; - -import com.example.hamburger.databinding.FragmentHomeBinding; - -public class HomeFragment extends Fragment { - - private FragmentHomeBinding binding; - - public View onCreateView(@NonNull LayoutInflater inflater, - ViewGroup container, Bundle savedInstanceState) { - HomeViewModel homeViewModel = - new ViewModelProvider(this).get(HomeViewModel.class); - - binding = FragmentHomeBinding.inflate(inflater, container, false); - View root = binding.getRoot(); - - final TextView textView = binding.TextView1; - homeViewModel.getText().observe(getViewLifecycleOwner(), textView::setText); - return root; - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - binding = null; - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/home/HomeViewModel.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/home/HomeViewModel.java deleted file mode 100644 index b5dc229..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/home/HomeViewModel.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.example.hamburger.ui.home; - -import androidx.lifecycle.LiveData; -import androidx.lifecycle.MutableLiveData; -import androidx.lifecycle.ViewModel; - -public class HomeViewModel extends ViewModel { - - private final MutableLiveData mText; - - public HomeViewModel() { - mText = new MutableLiveData<>(); - mText.setValue("This is home fragment"); - } - - public LiveData getText() { - return mText; - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/notifications/NotificationsFragment.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/notifications/NotificationsFragment.java deleted file mode 100644 index 1420a42..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/notifications/NotificationsFragment.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.example.hamburger.ui.notifications; - -import android.content.Intent; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.lifecycle.ViewModelProvider; - -import com.example.hamburger.R; -import com.example.hamburger.databinding.FragmentNotificationsBinding; - -public class NotificationsFragment extends Fragment{ - - private FragmentNotificationsBinding binding; - - private NotificationsViewModel notificationsViewModel; - - private TextView tv; - - public View onCreateView(@NonNull LayoutInflater inflater, - ViewGroup container, Bundle savedInstanceState) { - NotificationsViewModel notificationsViewModel = - new ViewModelProvider(this).get(NotificationsViewModel.class); - - binding = FragmentNotificationsBinding.inflate(inflater, container, false); - View root = binding.getRoot(); - - final TextView textView = binding.textNotifications; - notificationsViewModel.getText().observe(getViewLifecycleOwner(), textView::setText); - - final Button button=root.findViewById(R.id.btn1); - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(); - intent.setClass(getActivity(), add.class); - startActivity(intent); - } - }); - - return root; - - } - - - @Override - public void onDestroyView() { - super.onDestroyView(); - binding = null; - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/notifications/NotificationsViewModel.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/notifications/NotificationsViewModel.java deleted file mode 100644 index 3948dfe..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/notifications/NotificationsViewModel.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.example.hamburger.ui.notifications; - -import androidx.lifecycle.LiveData; -import androidx.lifecycle.MutableLiveData; -import androidx.lifecycle.ViewModel; - -public class NotificationsViewModel extends ViewModel { - - private final MutableLiveData mText; - - public NotificationsViewModel() { - mText = new MutableLiveData<>(); - mText.setValue("This is notifications fragment"); - } - - public LiveData getText() { - return mText; - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/notifications/add.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/notifications/add.java deleted file mode 100644 index c0e95e4..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/notifications/add.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.example.hamburger.ui.notifications; -import androidx.appcompat.app.AppCompatActivity; - -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; - -import com.example.hamburger.R; -import com.example.hamburger.notifications; - -public class add extends AppCompatActivity { - - EditText mytext; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_add); - mytext = findViewById(R.id.mt); - - } - - public void Confirm() { - Button button = (Button) findViewById(R.id.conf); - - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(); - intent.setClass(add.this, NotificationsFragment.class); - startActivity(intent); - } - }); - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/utils/JDBCUtils.java b/AndroidStudio_projects/app/src/main/java/com/example/hamburger/utils/JDBCUtils.java deleted file mode 100644 index 350035c..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/example/hamburger/utils/JDBCUtils.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.example.hamburger.utils; - -import java.sql.Connection; -import java.sql.DriverManager; - -/** - * function: 数据库工具类,连接数据库用 - */ -public class JDBCUtils { - private static final String TAG = "mysql-party-JDBCUtils"; - - private static String driver = "com.mysql.jdbc.Driver";// MySql驱动 - - private static String dbName = "Hotel_system";// 数据库名称 - - private static String user = "root";// 用户名 - - private static String password = "123456";// 密码 - - public static Connection getConn(){ - - Connection connection = null; - try{ - Class.forName(driver);// 动态加载类 - String ip = "10.0.2.2";// 写成本机地址,不能写成localhost,同时手机和电脑连接的网络必须是同一个 - - // 尝试建立到给定数据库URL的连接 - connection = DriverManager.getConnection("jdbc:mysql://" + ip + ":3306/" + dbName, - user, password); - - }catch (Exception e){ - e.printStackTrace(); - } - return connection; - } -} - diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/Example.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/Example.java deleted file mode 100644 index 6e0523c..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/Example.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros; - -import com.jilk.ros.message.Clock; -import com.jilk.ros.message.Log; -import com.jilk.ros.rosapi.message.Empty; -import com.jilk.ros.rosapi.message.GetTime; -import com.jilk.ros.rosapi.message.MessageDetails; -import com.jilk.ros.rosapi.message.Type; -import com.jilk.ros.rosbridge.ROSBridgeClient; - -public class Example { - - public Example() {} - - public static void main(String[] args) { - ROSBridgeClient client = new ROSBridgeClient("ws://10.8.87.23:9090"); - client.connect(); - //testTopic(client); - try { - testService(client); - } - catch (RuntimeException ex) { - ex.printStackTrace(); - } - finally { - client.disconnect(); - } - } - - public static void testService(ROSBridgeClient client) { - try { - Service timeService = - new Service("/rosapi/get_time", Empty.class, GetTime.class, client); - timeService.verify(); - //System.out.println("Time (secs): " + timeService.callBlocking(new Empty()).time.sec); - - Service serviceTypeService = - new Service("/rosapi/service_type", - com.jilk.ros.rosapi.message.Service.class, Type.class, client); - serviceTypeService.verify(); - String type = serviceTypeService.callBlocking(new com.jilk.ros.rosapi.message.Service("/rosapi/service_response_details")).type; - - Service serviceDetails = - new Service("/rosapi/service_response_details", - Type.class, MessageDetails.class, client); - serviceDetails.verify(); - //serviceDetails.callBlocking(new Type(type)).print(); - - com.jilk.ros.Topic logTopic = - new com.jilk.ros.Topic("/rosout", Log.class, client); - logTopic.verify(); - - /* - System.out.println("Nodes"); - for (String s : client.getNodes()) - System.out.println(" " + s); - System.out.println("Topics"); - for (String s : client.getTopics()) { - System.out.println(s + ":"); - client.getTopicMessageDetails(s).print(); - } - System.out.println("Services"); - for (String s : client.getServices()) { - System.out.println(s + ":"); - client.getServiceRequestDetails(s).print(); - System.out.println("-----------------"); - client.getServiceResponseDetails(s).print(); - } - */ - } - catch (InterruptedException ex) { - System.out.println("Process was interrupted."); - } - /* - Service topicService = - new Service("/rosapi/topics", Empty.class, Topics.class, client); - Service typeService = - new Service("/rosapi/topic_type", Topic.class, Type.class, client); - Service messageService = - new Service("/rosapi/message_details", Type.class, MessageDetails.class, client); - try { - Topics topics = topicService.callBlocking(new Empty()); - for (String topicString : topics.topics) { - Topic topic = new Topic(); - topic.topic = topicString; - Type type = typeService.callBlocking(topic); - MessageDetails details = messageService.callBlocking(type); - System.out.println("Topic: " + topic.topic + " Type: " + type.type); - details.print(); - System.out.println(); - } - Type type = new Type(); - type.type = "time"; - System.out.print("Single type check on \'time\': "); - messageService.callBlocking(type).print(); - } - catch (InterruptedException ex) { - System.out.println("testService: process was interrupted."); - } - */ - } - - public static void testTopic(ROSBridgeClient client) { - com.jilk.ros.Topic clockTopic = new com.jilk.ros.Topic("/clock", Clock.class, client); - clockTopic.subscribe(); - try { - Thread.sleep(20000);} catch(InterruptedException ex) {} - Clock cl = null; - try { - cl = clockTopic.take(); // just gets one - } - catch (InterruptedException ex) {} - cl.print(); - cl.clock.nsecs++; - clockTopic.unsubscribe(); - clockTopic.advertise(); - clockTopic.publish(cl); - clockTopic.unadvertise(); - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/MessageHandler.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/MessageHandler.java deleted file mode 100644 index f7cdd4d..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/MessageHandler.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros; - -import com.jilk.ros.message.Message; - -public interface MessageHandler { - public void onMessage(T message); -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/ROSClient.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/ROSClient.java deleted file mode 100644 index f3e8f60..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/ROSClient.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros; - -import com.jilk.ros.message.Message; -import com.jilk.ros.rosapi.message.TypeDef; -import com.jilk.ros.rosbridge.FullMessageHandler; -import com.jilk.ros.rosbridge.ROSBridgeClient; -import com.jilk.ros.rosbridge.operation.Operation; - -public abstract class ROSClient { - - public ROSClient() {} - - public static ROSClient create(String uriString) { - // if we ever implement other ROSClient types, we'll key off the URI protocol (e.g., ws://) - // we'd also have to abstract out Topic and Service since they depend on the ROSBridge operations - return new ROSBridgeClient(uriString); - } - - public abstract boolean connect(); - public abstract boolean connect(ConnectionStatusListener listener); - public abstract void disconnect(); - public abstract void send(Operation operation); - public abstract void send(String json); - public abstract void register(Class c, - String s, - Class m, - FullMessageHandler h); - public abstract void unregister(Class c, String s); - public abstract void setDebug(boolean debug); - public abstract String[] getNodes() throws InterruptedException; - public abstract String[] getTopics() throws InterruptedException; - public abstract String[] getServices() throws InterruptedException; - public abstract TypeDef getTopicMessageDetails(String topic) throws InterruptedException; - public abstract TypeDef[] getTopicMessageList(String topic) throws InterruptedException; - public abstract TypeDef getServiceRequestDetails(String service) throws InterruptedException; - public abstract TypeDef[] getServiceRequestList(String service) throws InterruptedException; - public abstract TypeDef getServiceResponseDetails(String service) throws InterruptedException; - public abstract TypeDef[] getServiceResponseList(String service) throws InterruptedException; - public abstract TypeDef getTypeDetails(String type) throws InterruptedException; - public abstract TypeDef[] getTypeList(String type) throws InterruptedException; - public abstract void typeMatch(TypeDef t, Class c) throws InterruptedException; - public abstract Object getUnderlyingClient(); // for debugging - - public interface ConnectionStatusListener { - public void onConnect(); - public void onDisconnect(boolean normal, String reason, int code); - public void onError(Exception ex); - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/Service.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/Service.java deleted file mode 100644 index 8de5db4..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/Service.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros; - -import com.jilk.ros.message.Message; -import com.jilk.ros.rosbridge.FullMessageHandler; -import com.jilk.ros.rosbridge.operation.CallService; -import com.jilk.ros.rosbridge.operation.ServiceResponse; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.CountDownLatch; - -public class Service extends Message implements FullMessageHandler { - private String service; - private Class responseType; - private Class callType; - private ROSClient client; - private Map calls; - - public Service(String service, Class callType, - Class responseType, ROSClient client) { - this.service = service; - this.client = client; - this.responseType = responseType; - this.callType = callType; - calls = new HashMap(); - } - - // A result can only be returned once; it is cleared from the hash before - // being sent/returned. This is to ensure that results do not accumulate - // indefinitely. If callers need to keep these around they can set up their - // own hash. - - @Override - public void onMessage(String id, Message response) { - //System.out.print("Service.onMessage: "); - //response.print(); - CallRecord call = calls.get(id); - if(call == null) { - System.out.print("No caller service response"); - return; - } - if (call.handler != null) { - calls.remove(id); - call.handler.onMessage((ResponseType) response); - } - else { - call.result = (ResponseType) response; - call.latch.countDown(); - } - } - - public String call(CallType args) { - return callImpl(args, null); - } - - public void callWithHandler(CallType args, MessageHandler responseHandler) { - callImpl(args, responseHandler); - } - - public ResponseType callBlocking(CallType args) throws InterruptedException { - return take(call(args)); - } - - private String callImpl(CallType args, MessageHandler responseHandler) { - client.register(ServiceResponse.class, service, responseType, this); // do this once on creation? - CallService messageCallService = new CallService(service, args); - String id = messageCallService.id; - CallRecord callRecord = new CallRecord(responseHandler); - calls.put(id, callRecord); - client.send(messageCallService); - return id; - } - - public ResponseType poll(String id) { - CallRecord call = calls.get(id); - if (call.result != null) - calls.remove(id); - return call.result; - } - - public ResponseType take(String id) throws InterruptedException { - CallRecord call = calls.get(id); - call.latch.await(); - calls.remove(id); - return call.result; - } - - public void verify() throws InterruptedException { - - boolean hasService = false; - for (String s : client.getServices()) { - if (s.equals(service)) { - hasService = true; - break; - } - } - if (!hasService) - throw new RuntimeException("Service \'" + service + "\' not available."); - - client.typeMatch(client.getServiceRequestDetails(service), callType); - client.typeMatch(client.getServiceResponseDetails(service), responseType); - } - - private class CallRecord { - public ResponseType result; - public CountDownLatch latch; - public MessageHandler handler; - - public CallRecord(MessageHandler handler) { - this.result = null; - this.latch = new CountDownLatch(1); - this.handler = handler; - } - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/Topic.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/Topic.java deleted file mode 100644 index 815ea2e..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/Topic.java +++ /dev/null @@ -1,144 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros; - -import com.jilk.ros.message.Message; -import com.jilk.ros.rosbridge.FullMessageHandler; -import com.jilk.ros.rosbridge.operation.Advertise; -import com.jilk.ros.rosbridge.operation.Operation; -import com.jilk.ros.rosbridge.operation.Publish; -import com.jilk.ros.rosbridge.operation.Subscribe; -import com.jilk.ros.rosbridge.operation.Unadvertise; -import com.jilk.ros.rosbridge.operation.Unsubscribe; - -import java.util.concurrent.LinkedBlockingQueue; - - -public class Topic extends LinkedBlockingQueue implements FullMessageHandler { - protected String topic; - private Class type; - private String messageType; - private ROSClient client; - private Thread handlerThread; - - public Topic(String topic, Class type, ROSClient client) { - this.topic = topic; - this.client = client; - this.type = type; - messageType = Message.getMessageType(type); - handlerThread = null; - } - - @Override - public void onMessage(String id, Message message) { - add((T) message); - } - - - // warning: there is a delay between the completion of this method and - // the completion of the subscription; it takes longer than - // publishing multiple other messages, for example. - public void subscribe(MessageHandler handler) { - startRunner(handler); - subscribe(); - } - - public void subscribe() { - client.register(Publish.class, topic, type, this); - send(new Subscribe(topic, messageType)); - } - - public void unsubscribe() { - // need to handle race conditions in incoming message handler - // so that once unsubscribe has happened the handler gets no more - // messages - send(new Unsubscribe(topic)); - client.unregister(Publish.class, topic); - stopRunner(); - } - - private void startRunner(MessageHandler handler) { - stopRunner(); - handlerThread = new Thread(new MessageRunner(handler)); - handlerThread.setName("Message handler for " + topic); - handlerThread.start(); - } - - private void stopRunner() { - if (handlerThread != null) { - handlerThread.interrupt(); - clear(); - handlerThread = null; - } - } - - - public void advertise() { - send(new Advertise(topic, messageType)); - } - - public void publish(T message) { - send(new Publish(topic, message)); - } - - public void unadvertise() { - send(new Unadvertise(topic)); - } - - private void send(Operation operation) { - client.send(operation); - } - - public void verify() throws InterruptedException { - - boolean hasTopic = false; - for (String s : client.getTopics()) { - if (s.equals(topic)) { - hasTopic = true; - break; - } - } - if (!hasTopic) - throw new RuntimeException("Topic \'" + topic + "\' not available."); - - client.typeMatch(client.getTopicMessageDetails(topic), type); - } - - private class MessageRunner implements Runnable { - private MessageHandler handler; - - public MessageRunner(MessageHandler handler) { - this.handler = handler; - } - - @Override - public void run() { - while (!Thread.interrupted()) { - try { - handler.onMessage(take()); - } - catch (InterruptedException ex) { - break; - } - } - } - } - -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/AudioMsg.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/AudioMsg.java deleted file mode 100644 index 29c1e41..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/AudioMsg.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.jilk.ros.message; - -/** - * Created by xxhong on 16-11-17. - */ -@MessageType(string = "std_msgs/Int16MultiArray") -public class AudioMsg extends Message { - public short[] data; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Clock.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Clock.java deleted file mode 100644 index 09505fc..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Clock.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -@MessageType(string = "rosgraph_msgs/Clock") -public class Clock extends Message { - public TimePrimitive clock; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Duration.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Duration.java deleted file mode 100644 index c08953b..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Duration.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -@MessageType(string = "std_msgs/Duration") -public class Duration extends DurationPrimitive { -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/DurationPrimitive.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/DurationPrimitive.java deleted file mode 100644 index 35ae9bb..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/DurationPrimitive.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -@MessageType(string = "duration") -public class DurationPrimitive extends TimePrimitive { - -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Empty.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Empty.java deleted file mode 100644 index 55d5a39..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Empty.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -@MessageType(string = "std_srvs/Empty") -public class Empty extends Message { -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Header.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Header.java deleted file mode 100644 index eb3d856..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Header.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -@MessageType(string = "std_msgs/Header") -public class Header extends Message { - public long seq; - public TimePrimitive stamp; - public String frame_id; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Log.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Log.java deleted file mode 100644 index 2c444d7..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Log.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -@MessageType(string = "rosgraph_msgs/Log") -public class Log extends Message { - public Header header; - public byte level; - public String name; - public String msg; - public String file; - public String function; - public long line; - public String[] topics; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Message.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Message.java deleted file mode 100644 index 0b9f968..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Message.java +++ /dev/null @@ -1,202 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.util.Map; - - -@MessageType(string = "message") -public abstract class Message { - - // Some requirements about message types: - // - It must have a MessageType declaration to be recognized on inbound messages - // - Every field must be explicitly designated as public - // - Every field that is not a primitive or near-primitive must be another Message class - // - If there is a non-empty constructor, you must also have an empty constructor - // - If it is set up as an inner class, it needs an explicit nullary constructor - // (note: I have seen an inner class otherwise fail, I have not tested it with the explicit constructor) - - public static void register(Class c, Map messageClasses) { - try { - typecheck(c); - - // Must register the class and not have duplicate - // This is not recursive because only the top level message class - // needs to be determined from the string - others are top-down. - String messageString = getMessageType(c); - Class existingClass = messageClasses.get(messageString); - if (existingClass != null && !existingClass.equals(c)) - throw new MessageException("Message String \'" + messageString + - "\' is assigned to two different classes (" + - c.getName() + " and " + existingClass.getName() + ")"); - messageClasses.put(messageString, c); - } - catch (MessageException ex) { - // should be changed to be a hooked method to give library user control - System.out.println(ex.getMessage()); - } - } - - public static String getMessageType(Class c) { - return ((MessageType) c.getAnnotation(MessageType.class)).string(); - } - - // this has never been used or tested but kind of belongs here - // commented out because it uses ReflectiveOperationException which is not available on Android - /* - public static Message newInstance(String className) { - try { - Class messageClass = Class.forName(className); - if (Message.class.isAssignableFrom(messageClass)) - return (Message) messageClass.newInstance(); - else throw new ClassCastException(); - } - catch (ReflectiveOperationException ex) { - throw new RuntimeException("Unable to create message of class \'" + className + "\'.", ex); - } - } - */ - - // Could probably do more checking here, but not sure what right now - private static void typecheck(Class c) throws MessageException { - - // Must inherit from Message - if (!Message.class.isAssignableFrom(c)) - throw new MessageException("Class \'" + c.getName() + - "\' does not extend Message"); - - // Must have the MessageType annotation - if (getMessageType(c) == null) - throw new MessageException("Class \'" + c.getName() + - "\' is missing the MessageType annotation"); - - // All fields must also be valid Message classes - // Note that this also serves to force-load all the message classes - // so that they get registered - for (Field f : c.getFields()) { - Class fc = f.getType(); - if (fc.isArray()) { - Class ac = fc.getComponentType(); - if (!isPrimitive(ac)) - typecheck(ac); - } - else if (!isPrimitive(fc)) - typecheck(fc); - } - } - - public void print() { - printMessage(this, ""); - } - - private static void printMessage(Object o, String indent) { - for (Field f : o.getClass().getFields()) { - Class c = f.getType(); - Object fieldObject = getFieldObject(f, o); - if (fieldObject != null) { - if (isPrimitive(c)) - System.out.println(indent + f.getName() + ": " + fieldObject); - else if (c.isArray()) { - System.out.println(indent + f.getName() + ": ["); - printArray(fieldObject, indent + " "); - System.out.println(indent + "]"); - } - else { - System.out.println(indent + f.getName() + ":"); - printMessage(fieldObject, indent + " "); - } - } - } - } - - private static void printArray(Object array, String indent) { - Class arrayClass = array.getClass().getComponentType(); - for (int i = 0; i < Array.getLength(array); i++) { - Object elementObject = Array.get(array, i); - if (elementObject != null) { - if (isPrimitive(arrayClass)) - System.out.println(indent + i + ": " + elementObject); - else if (arrayClass.isArray()) { // this is not actually allowed in ROS - System.out.println(indent + i + ": ["); - printArray(elementObject, indent + " "); - System.out.println(indent + "]"); - } - else { - System.out.println(indent + i + ":"); - printMessage(elementObject, indent + " "); - } - } - } - // remember to print array indices - } - - public static boolean isPrimitive(Class c) { - return (c.isPrimitive() || - c.equals(String.class) || - Number.class.isAssignableFrom(c) || - c.equals(Boolean.class)); - } - - - // Copied from com.jilk.ros.rosbridge.JSON - private static Object getFieldObject(Field f, Object o) { - Object fo = null; - try { - fo = f.get(o); - } - catch (IllegalAccessException ex) { - ex.printStackTrace(); - } - return fo; - } - - public void copyFrom(Message source) { - try { - if (source.getClass() != getClass()) - throw new RuntimeException("Attempt to copy non-matching classes"); - for (Field f : getClass().getFields()) { - Class fc = f.getType(); - if (fc.isArray()) - throw new RuntimeException("copyFrom - array types not implemented"); - else if (!isPrimitive(fc)) - ((Message) f.get(this)).copyFrom((Message) f.get(source)); - else { - Object value = f.get(source); - f.set(this, value); - } - } - } - catch (IllegalAccessException ex) { - throw new RuntimeException("copyFrom error", ex); - } - catch (ClassCastException ex) { - throw new RuntimeException("copyFrom error", ex); - } - // ReflectiveOperationException is not available on Android (Java 1.6) - /* - catch (ReflectiveOperationException ex) { - throw new RuntimeException ("copyFrom error", ex); - } - */ - } - -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/MessageException.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/MessageException.java deleted file mode 100644 index c2aa2f7..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/MessageException.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -public class MessageException extends Exception { - - public MessageException(String message) { - super(message); - } - - public MessageException(String message, Throwable cause) { - super(message, cause); - } -} - diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/MessageType.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/MessageType.java deleted file mode 100644 index 21d3cc0..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/MessageType.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface MessageType { - String string() default ""; -} - diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/SemanticRequest.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/SemanticRequest.java deleted file mode 100644 index 728efa9..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/SemanticRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.jilk.ros.message; - -/** - * Created by xxhong on 16-11-17. - */ -@MessageType(string = "std_msgs/String") -public class SemanticRequest extends Message { - public SemanticRequest(String args) { - jsonStr = args; - } - - public String jsonStr; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/SemanticResponse.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/SemanticResponse.java deleted file mode 100644 index 624c8c6..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/SemanticResponse.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.jilk.ros.message; - -/** - * Created by xxhong on 16-11-17. - */ -@MessageType(string = "std_msgs/String") -public class SemanticResponse extends Message { - public String result; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/StdMsg.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/StdMsg.java deleted file mode 100644 index 570d27f..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/StdMsg.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.jilk.ros.message; - -/** - * Created by xxhong on 16-11-17. - */ -@MessageType(string = "std_msgs/String") -public class StdMsg extends Message { - public String data; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Time.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Time.java deleted file mode 100644 index b0075a0..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/Time.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -@MessageType(string = "std_msgs/Time") -public class Time extends TimePrimitive { -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/TimePrimitive.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/TimePrimitive.java deleted file mode 100644 index 238ca6d..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/message/TimePrimitive.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.message; - -@MessageType(string = "time") -public class TimePrimitive extends Message { - public int secs; // when requesting this format from ROSbridge, it uses 'sec' (no 's') - public int nsecs; // when requesting this format from ROSbridge, it uses 'nsec' -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Empty.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Empty.java deleted file mode 100644 index 6bfe139..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Empty.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosapi.message; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; - -@MessageType(string = "std_msgs/Empty") -public class Empty extends Message { -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/GetTime.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/GetTime.java deleted file mode 100644 index de55c5c..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/GetTime.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosapi.message; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; -import com.jilk.ros.message.TimePrimitive; - - -@MessageType(string = "rosapi/GetTimeResponse") -public class GetTime extends Message { - public TimePrimitive time; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/MessageDetails.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/MessageDetails.java deleted file mode 100644 index c75bb67..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/MessageDetails.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosapi.message; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; - -@MessageType(string = "rosapi/MessageDetails") -public class MessageDetails extends Message { - public TypeDef[] typedefs; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Nodes.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Nodes.java deleted file mode 100644 index 28c87c6..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Nodes.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosapi.message; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; - -@MessageType(string = "rosapi/Nodes") -public class Nodes extends Message { - public String[] nodes; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Service.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Service.java deleted file mode 100644 index a3e8d78..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Service.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosapi.message; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; - -@MessageType(string = "rosapi/Service") -public class Service extends Message { - public String service; - - public Service() {} - - public Service(String service) { - this.service = service; - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Services.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Services.java deleted file mode 100644 index 2503ea5..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Services.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosapi.message; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; - -@MessageType(string = "rosapi/Services") -public class Services extends Message { - public String[] services; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Topic.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Topic.java deleted file mode 100644 index 3ea3ebc..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Topic.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosapi.message; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; - -@MessageType(string = "rosapi/Topic") -public class Topic extends Message { - public String topic; - - public Topic() {} - - public Topic(String topic) { - this.topic = topic; - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Topics.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Topics.java deleted file mode 100644 index 07bab16..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Topics.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosapi.message; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; - -@MessageType(string = "rosapi/Topics") -public class Topics extends Message { - public String[] topics; -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Type.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Type.java deleted file mode 100644 index 73d53b0..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/Type.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosapi.message; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; - -@MessageType(string = "rosapi/Type") -public class Type extends Message { - public String type; - - public Type() {} - - public Type(String type) { - this.type = type; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/TypeDef.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/TypeDef.java deleted file mode 100644 index aff5e47..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosapi/message/TypeDef.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosapi.message; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; - -@MessageType(string = "rosapi/TypeDef") -public class TypeDef extends Message { - public String type; - public String[] fieldnames; - public String[] fieldtypes; - public int[] fieldarraylen; - public String[] examples; - - public static boolean match(String type, Class c) { - boolean result = false; - if ( - (type.equals("bool") && ((boolean.class.equals(c)) || (Boolean.class.equals(c)))) || - (type.equals("int8") && ((byte.class.equals(c)) || (Byte.class.equals(c)))) || - (type.equals("byte") && ((byte.class.equals(c)) || (Byte.class.equals(c)))) || // deprecated - (type.equals("uint8") && ((short.class.equals(c)) || (Short.class.equals(c)))) || - (type.equals("char") && ((short.class.equals(c)) || (Short.class.equals(c)))) || // deprecated - (type.equals("int16") && ((short.class.equals(c)) || (Short.class.equals(c)))) || - (type.equals("uint16") && ((int.class.equals(c)) || (Integer.class.equals(c)))) || - (type.equals("int32") && ((int.class.equals(c)) || (Integer.class.equals(c)))) || - (type.equals("uint32") && ((long.class.equals(c)) || (Long.class.equals(c)))) || - (type.equals("int64") && ((long.class.equals(c)) || (Long.class.equals(c)))) || - (type.equals("float32") && ((float.class.equals(c)) || (Float.class.equals(c)))) || - (type.equals("float64") && ((double.class.equals(c)) || (Double.class.equals(c)))) || - (type.equals("uint64") && (java.math.BigInteger.class.equals(c))) || - (type.equals("string") && (String.class.equals(c))) - ) - result = true; - - return result; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/FullMessageHandler.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/FullMessageHandler.java deleted file mode 100644 index 62580fd..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/FullMessageHandler.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge; - -import com.jilk.ros.message.Message; - -public interface FullMessageHandler { - public void onMessage(String id, T message); -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/ROSBridgeClient.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/ROSBridgeClient.java deleted file mode 100644 index 71cbbe8..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/ROSBridgeClient.java +++ /dev/null @@ -1,260 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge; - -import com.jilk.ros.ROSClient; -import com.jilk.ros.Service; -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; -import com.jilk.ros.rosapi.message.Empty; -import com.jilk.ros.rosapi.message.MessageDetails; -import com.jilk.ros.rosapi.message.Nodes; -import com.jilk.ros.rosapi.message.Services; -import com.jilk.ros.rosapi.message.Topic; -import com.jilk.ros.rosapi.message.Topics; -import com.jilk.ros.rosapi.message.Type; -import com.jilk.ros.rosapi.message.TypeDef; -import com.jilk.ros.rosbridge.implementation.ROSBridgeWebSocketClient; -import com.jilk.ros.rosbridge.operation.Operation; - -import java.lang.reflect.Field; - -public class ROSBridgeClient extends ROSClient { - String uriString; - ROSBridgeWebSocketClient client; - - public ROSBridgeClient(String uriString) { - this.uriString = uriString; - } - - @Override - public boolean connect() { - return connect(null); - } - - @Override - public boolean connect(ROSClient.ConnectionStatusListener listener) { - boolean result = false; - client = ROSBridgeWebSocketClient.create(uriString); - if (client != null) { - client.setListener(listener); - try { - result = client.connectBlocking(); - } - catch (InterruptedException ex) {} - } - return result; - } - - @Override - public void disconnect() { - try { - client.closeBlocking(); - } - catch (InterruptedException ex) {} - } - - @Override - public void send(Operation operation) { - client.send(operation); - } - - @Override - public void send(String json) { - client.send(json); - } - - @Override - public void register(Class c, - String s, - Class m, - FullMessageHandler h) { - client.register(c, s, m, h); - } - - @Override - public void unregister(Class c, String s) { - client.unregister(c, s); - } - - @Override - public void setDebug(boolean debug) { - client.setDebug(debug); - } - - @Override - public String[] getNodes() throws InterruptedException { - Service nodeService = - new Service("/rosapi/nodes", Empty.class, Nodes.class, this); - return nodeService.callBlocking(new Empty()).nodes; - } - - @Override - public String[] getTopics() throws InterruptedException { - Service topicsService = - new Service("/rosapi/topics", Empty.class, Topics.class, this); - return topicsService.callBlocking(new Empty()).topics; - } - - @Override - public String[] getServices() throws InterruptedException { - Service servicesService = - new Service("/rosapi/services", Empty.class, Services.class, this); - return servicesService.callBlocking(new Empty()).services; - } - - @Override - public TypeDef getTopicMessageDetails(String topic) throws InterruptedException { - return getTypeDetails(getTopicType(topic)); - } - - @Override - public TypeDef[] getTopicMessageList(String topic) throws InterruptedException { - return getTypeList(getTopicType(topic)); - } - - @Override - public TypeDef getServiceRequestDetails(String service) throws InterruptedException { - return getTypeDetails(getServiceType(service), "Request", "/rosapi/service_request_details"); - } - - @Override - public TypeDef[] getServiceRequestList(String service) throws InterruptedException { - return getTypeList(getServiceType(service), "Request", "/rosapi/service_request_details"); - } - - @Override - public TypeDef getServiceResponseDetails(String service) throws InterruptedException { - return getTypeDetails(getServiceType(service), "Response", "/rosapi/service_response_details"); - } - - @Override - public TypeDef[] getServiceResponseList(String service) throws InterruptedException { - return getTypeList(getServiceType(service), "Response", "/rosapi/service_response_details"); - } - - @Override - public TypeDef[] getTypeList(String type) throws InterruptedException { - return getTypeList(type, "", "/rosapi/message_details"); - } - - @Override - public TypeDef getTypeDetails(String type) throws InterruptedException { - return getTypeDetails(type, "", "/rosapi/message_details"); - } - - private TypeDef[] getTypeList(String type, String suffix, String serviceName) throws InterruptedException { - Service messageDetailsService = - new Service(serviceName, - Type.class, MessageDetails.class, this); - return messageDetailsService.callBlocking(new Type(type)).typedefs; - } - - private TypeDef getTypeDetails(String type, String suffix, String serviceName) throws InterruptedException { - Service messageDetailsService = - new Service(serviceName, - Type.class, MessageDetails.class, this); - return findType(type + suffix, messageDetailsService.callBlocking(new Type(type)).typedefs); - } - - private String getTopicType(String topic) throws InterruptedException { - Service topicTypeService = - new Service("/rosapi/topic_type", - Topic.class, Type.class, this); - return topicTypeService.callBlocking(new Topic(topic)).type; - } - - private String getServiceType(String service) throws InterruptedException { - Service serviceTypeService = - new Service("/rosapi/service_type", - com.jilk.ros.rosapi.message.Service.class, Type.class, this); - return serviceTypeService.callBlocking(new com.jilk.ros.rosapi.message.Service(service)).type; - } - - private TypeDef findType(String type, TypeDef[] types) { - TypeDef result = null; - for (TypeDef t : types) { - if (t.type.equals(type)) { - result = t; - break; - } - } - //System.out.println("ROSBridgeClient.findType: "); - //result.print(); - return result; - } - - @Override - public void typeMatch(TypeDef t, Class c) throws InterruptedException { - if (c == null) - throw new RuntimeException("No registered message type found for: " + t.type); - Field[] fields = c.getFields(); - for (int i = 0; i < t.fieldnames.length; i++) { - - // Field names - String classFieldName = fields[i].getName(); - String typeFieldName = t.fieldnames[i]; - if (!classFieldName.equals(typeFieldName)) - typeMatchError(t, c, "field name", typeFieldName, classFieldName); - - // Array type of field - boolean typeIsArray = (t.fieldarraylen[i] >= 0); - boolean fieldIsArray = fields[i].getType().isArray(); - if (typeIsArray != fieldIsArray) - typeMatchError(t, c, "array mismatch", typeFieldName, classFieldName); - - // Get base type of field - Class fieldClass = fields[i].getType(); - if (fieldIsArray) - fieldClass = fields[i].getType().getComponentType(); - String type = t.fieldtypes[i]; - - // Field type for primitivesclient - if (Message.isPrimitive(fieldClass)) { - if (!TypeDef.match(type, fieldClass)) - typeMatchError(t, c, "type mismatch", type, fieldClass.getName()); - } - - // Field type for non-primitive classes, and recurse - else { - if (!Message.class.isAssignableFrom(fieldClass)) - throw new RuntimeException("Member " + classFieldName + - " of class " + fieldClass.getName() + " does not extend Message."); - String fieldClassString = ((MessageType) fieldClass.getAnnotation(MessageType.class)).string(); - if (!type.equals(fieldClassString)) - typeMatchError(t, c, "message type mismatch", type, fieldClassString); - typeMatch(getTypeDetails(type), fieldClass); - } - } - } - - private void typeMatchError(TypeDef t, Class c, - String error, String tString, String cString) { - throw new RuntimeException("Type match error between " + - t.type + " and " + c.getName() + ": " + - error + ": \'" + tString + "\' does not match \'" + cString + "\'."); - } - - @Override - public Object getUnderlyingClient() { - return client; - } - -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/Base64.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/Base64.java deleted file mode 100644 index 75eec18..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/Base64.java +++ /dev/null @@ -1,575 +0,0 @@ -package com.jilk.ros.rosbridge.implementation; - -import java.util.Arrays; - -/** A very fast and memory efficient class to encode and decode to and from BASE64 in full accordance - * with RFC 2045.

- * On Windows XP sp1 with 1.4.2_04 and later ;), this encoder and decoder is about 10 times faster - * on small arrays (10 - 1000 bytes) and 2-3 times as fast on larger arrays (10000 - 1000000 bytes) - * compared to sun.misc.Encoder()/Decoder().

- * - * On byte arrays the encoder is about 20% faster than Jakarta Commons Base64 Codec for encode and - * about 50% faster for decoding large arrays. This implementation is about twice as fast on very small - * arrays (< 30 bytes). If source/destination is a String this - * version is about three times as fast due to the fact that the Commons Codec result has to be recoded - * to a String from byte[], which is very expensive.

- * - * This encode/decode algorithm doesn't create any temporary arrays as many other codecs do, it only - * allocates the resulting array. This produces less garbage and it is possible to handle arrays twice - * as large as algorithms that create a temporary array. (E.g. Jakarta Commons Codec). It is unknown - * whether Sun's sun.misc.Encoder()/Decoder() produce temporary arrays but since performance - * is quite low it probably does.

- * - * The encoder produces the same output as the Sun one except that the Sun's encoder appends - * a trailing line separator if the last character isn't a pad. Unclear why but it only adds to the - * length and is probably a side effect. Both are in conformance with RFC 2045 though.
- * Commons codec seem to always att a trailing line separator.

- * - * Note! - * The encode/decode method pairs (types) come in three versions with the exact same algorithm and - * thus a lot of code redundancy. This is to not create any temporary arrays for transcoding to/from different - * format types. The methods not used can simply be commented out.

- * - * There is also a "fast" version of all decode methods that works the same way as the normal ones, but - * har a few demands on the decoded input. Normally though, these fast verions should be used if the source if - * the input is known and it hasn't bee tampered with.

- * - * If you find the code useful or you find a bug, please send me a note at base64 @ miginfocom . com. - * - * Licence (BSD): - * ============== - * - * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (base64 @ miginfocom . com) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * Neither the name of the MiG InfoCom AB nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * @version 2.2 - * @author Mikael Grev - * Date: 2004-aug-02 - * Time: 11:31:11 - */ - -public class Base64 -{ - private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray(); - private static final int[] IA = new int[256]; - static { - Arrays.fill(IA, -1); - for (int i = 0, iS = CA.length; i < iS; i++) - IA[CA[i]] = i; - IA['='] = 0; - } - - // **************************************************************************************** - // * char[] version - // **************************************************************************************** - - /** Encodes a raw byte array into a BASE64 char[] representation i accordance with RFC 2045. - * @param sArr The bytes to convert. If null or length 0 an empty array will be returned. - * @param lineSep Optional "\r\n" after 76 characters, unless end of file.
- * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a - * little faster. - * @return A BASE64 encoded array. Never null. - */ - public final static char[] encodeToChar(byte[] sArr, boolean lineSep) - { - // Check special case - int sLen = sArr != null ? sArr.length : 0; - if (sLen == 0) - return new char[0]; - - int eLen = (sLen / 3) * 3; // Length of even 24-bits. - int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count - int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array - char[] dArr = new char[dLen]; - - // Encode even 24-bits - for (int s = 0, d = 0, cc = 0; s < eLen;) { - // Copy next three bytes into lower 24 bits of int, paying attension to sign. - int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff); - - // Encode the int into four chars - dArr[d++] = CA[(i >>> 18) & 0x3f]; - dArr[d++] = CA[(i >>> 12) & 0x3f]; - dArr[d++] = CA[(i >>> 6) & 0x3f]; - dArr[d++] = CA[i & 0x3f]; - - // Add optional line separator - if (lineSep && ++cc == 19 && d < dLen - 2) { - dArr[d++] = '\r'; - dArr[d++] = '\n'; - cc = 0; - } - } - - // Pad and encode last bits if source isn't even 24 bits. - int left = sLen - eLen; // 0 - 2. - if (left > 0) { - // Prepare the int - int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0); - - // Set last four chars - dArr[dLen - 4] = CA[i >> 12]; - dArr[dLen - 3] = CA[(i >>> 6) & 0x3f]; - dArr[dLen - 2] = left == 2 ? CA[i & 0x3f] : '='; - dArr[dLen - 1] = '='; - } - return dArr; - } - - /** Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with - * and without line separators. - * @param sArr The source array. null or length 0 will return an empty array. - * @return The decoded array of bytes. May be of length 0. Will be null if the legal characters - * (including '=') isn't divideable by 4. (I.e. definitely corrupted). - */ - public final static byte[] decode(char[] sArr) - { - // Check special case - int sLen = sArr != null ? sArr.length : 0; - if (sLen == 0) - return new byte[0]; - - // Count illegal characters (including '\r', '\n') to know what size the returned array will be, - // so we don't have to reallocate & copy it later. - int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...) - for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out. - if (IA[sArr[i]] < 0) - sepCnt++; - - // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045. - if ((sLen - sepCnt) % 4 != 0) - return null; - - int pad = 0; - for (int i = sLen; i > 1 && IA[sArr[--i]] <= 0;) - if (sArr[i] == '=') - pad++; - - int len = ((sLen - sepCnt) * 6 >> 3) - pad; - - byte[] dArr = new byte[len]; // Preallocate byte[] of exact length - - for (int s = 0, d = 0; d < len;) { - // Assemble three bytes into an int from four "valid" characters. - int i = 0; - for (int j = 0; j < 4; j++) { // j only increased if a valid char was found. - int c = IA[sArr[s++]]; - if (c >= 0) - i |= c << (18 - j * 6); - else - j--; - } - // Add the bytes - dArr[d++] = (byte) (i >> 16); - if (d < len) { - dArr[d++]= (byte) (i >> 8); - if (d < len) - dArr[d++] = (byte) i; - } - } - return dArr; - } - - /** Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as - * fast as {@link #decode(char[])}. The preconditions are:
- * + The array must have a line length of 76 chars OR no line separators at all (one line).
- * + Line separator must be "\r\n", as specified in RFC 2045 - * + The array must not contain illegal characters within the encoded string
- * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.
- * @param sArr The source array. Length 0 will return an empty array. null will throw an exception. - * @return The decoded array of bytes. May be of length 0. - */ - public final static byte[] decodeFast(char[] sArr) - { - // Check special case - int sLen = sArr.length; - if (sLen == 0) - return new byte[0]; - - int sIx = 0, eIx = sLen - 1; // Start and end index after trimming. - - // Trim illegal chars from start - while (sIx < eIx && IA[sArr[sIx]] < 0) - sIx++; - - // Trim illegal chars from end - while (eIx > 0 && IA[sArr[eIx]] < 0) - eIx--; - - // get the padding count (=) (0, 1 or 2) - int pad = sArr[eIx] == '=' ? (sArr[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end. - int cCnt = eIx - sIx + 1; // Content count including possible separators - int sepCnt = sLen > 76 ? (sArr[76] == '\r' ? cCnt / 78 : 0) << 1 : 0; - - int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes - byte[] dArr = new byte[len]; // Preallocate byte[] of exact length - - // Decode all but the last 0 - 2 bytes. - int d = 0; - for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { - // Assemble three bytes into an int from four "valid" characters. - int i = IA[sArr[sIx++]] << 18 | IA[sArr[sIx++]] << 12 | IA[sArr[sIx++]] << 6 | IA[sArr[sIx++]]; - - // Add the bytes - dArr[d++] = (byte) (i >> 16); - dArr[d++] = (byte) (i >> 8); - dArr[d++] = (byte) i; - - // If line separator, jump over it. - if (sepCnt > 0 && ++cc == 19) { - sIx += 2; - cc = 0; - } - } - - if (d < len) { - // Decode last 1-3 bytes (incl '=') into 1-3 bytes - int i = 0; - for (int j = 0; sIx <= eIx - pad; j++) - i |= IA[sArr[sIx++]] << (18 - j * 6); - - for (int r = 16; d < len; r -= 8) - dArr[d++] = (byte) (i >> r); - } - - return dArr; - } - - // **************************************************************************************** - // * byte[] version - // **************************************************************************************** - - /** Encodes a raw byte array into a BASE64 byte[] representation i accordance with RFC 2045. - * @param sArr The bytes to convert. If null or length 0 an empty array will be returned. - * @param lineSep Optional "\r\n" after 76 characters, unless end of file.
- * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a - * little faster. - * @return A BASE64 encoded array. Never null. - */ - public final static byte[] encodeToByte(byte[] sArr, boolean lineSep) - { - // Check special case - int sLen = sArr != null ? sArr.length : 0; - if (sLen == 0) - return new byte[0]; - - int eLen = (sLen / 3) * 3; // Length of even 24-bits. - int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count - int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array - byte[] dArr = new byte[dLen]; - - // Encode even 24-bits - for (int s = 0, d = 0, cc = 0; s < eLen;) { - // Copy next three bytes into lower 24 bits of int, paying attension to sign. - int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff); - - // Encode the int into four chars - dArr[d++] = (byte) CA[(i >>> 18) & 0x3f]; - dArr[d++] = (byte) CA[(i >>> 12) & 0x3f]; - dArr[d++] = (byte) CA[(i >>> 6) & 0x3f]; - dArr[d++] = (byte) CA[i & 0x3f]; - - // Add optional line separator - if (lineSep && ++cc == 19 && d < dLen - 2) { - dArr[d++] = '\r'; - dArr[d++] = '\n'; - cc = 0; - } - } - - // Pad and encode last bits if source isn't an even 24 bits. - int left = sLen - eLen; // 0 - 2. - if (left > 0) { - // Prepare the int - int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0); - - // Set last four chars - dArr[dLen - 4] = (byte) CA[i >> 12]; - dArr[dLen - 3] = (byte) CA[(i >>> 6) & 0x3f]; - dArr[dLen - 2] = left == 2 ? (byte) CA[i & 0x3f] : (byte) '='; - dArr[dLen - 1] = '='; - } - return dArr; - } - - /** Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with - * and without line separators. - * @param sArr The source array. Length 0 will return an empty array. null will throw an exception. - * @return The decoded array of bytes. May be of length 0. Will be null if the legal characters - * (including '=') isn't divideable by 4. (I.e. definitely corrupted). - */ - public final static byte[] decode(byte[] sArr) - { - // Check special case - int sLen = sArr.length; - - // Count illegal characters (including '\r', '\n') to know what size the returned array will be, - // so we don't have to reallocate & copy it later. - int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...) - for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out. - if (IA[sArr[i] & 0xff] < 0) - sepCnt++; - - // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045. - if ((sLen - sepCnt) % 4 != 0) - return null; - - int pad = 0; - for (int i = sLen; i > 1 && IA[sArr[--i] & 0xff] <= 0;) - if (sArr[i] == '=') - pad++; - - int len = ((sLen - sepCnt) * 6 >> 3) - pad; - - byte[] dArr = new byte[len]; // Preallocate byte[] of exact length - - for (int s = 0, d = 0; d < len;) { - // Assemble three bytes into an int from four "valid" characters. - int i = 0; - for (int j = 0; j < 4; j++) { // j only increased if a valid char was found. - int c = IA[sArr[s++] & 0xff]; - if (c >= 0) - i |= c << (18 - j * 6); - else - j--; - } - - // Add the bytes - dArr[d++] = (byte) (i >> 16); - if (d < len) { - dArr[d++]= (byte) (i >> 8); - if (d < len) - dArr[d++] = (byte) i; - } - } - - return dArr; - } - - - /** Decodes a BASE64 encoded byte array that is known to be resonably well formatted. The method is about twice as - * fast as {@link #decode(byte[])}. The preconditions are:
- * + The array must have a line length of 76 chars OR no line separators at all (one line).
- * + Line separator must be "\r\n", as specified in RFC 2045 - * + The array must not contain illegal characters within the encoded string
- * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.
- * @param sArr The source array. Length 0 will return an empty array. null will throw an exception. - * @return The decoded array of bytes. May be of length 0. - */ - public final static byte[] decodeFast(byte[] sArr) - { - // Check special case - int sLen = sArr.length; - if (sLen == 0) - return new byte[0]; - - int sIx = 0, eIx = sLen - 1; // Start and end index after trimming. - - // Trim illegal chars from start - while (sIx < eIx && IA[sArr[sIx] & 0xff] < 0) - sIx++; - - // Trim illegal chars from end - while (eIx > 0 && IA[sArr[eIx] & 0xff] < 0) - eIx--; - - // get the padding count (=) (0, 1 or 2) - int pad = sArr[eIx] == '=' ? (sArr[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end. - int cCnt = eIx - sIx + 1; // Content count including possible separators - int sepCnt = sLen > 76 ? (sArr[76] == '\r' ? cCnt / 78 : 0) << 1 : 0; - - int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes - byte[] dArr = new byte[len]; // Preallocate byte[] of exact length - - // Decode all but the last 0 - 2 bytes. - int d = 0; - for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { - // Assemble three bytes into an int from four "valid" characters. - int i = IA[sArr[sIx++]] << 18 | IA[sArr[sIx++]] << 12 | IA[sArr[sIx++]] << 6 | IA[sArr[sIx++]]; - - // Add the bytes - dArr[d++] = (byte) (i >> 16); - dArr[d++] = (byte) (i >> 8); - dArr[d++] = (byte) i; - - // If line separator, jump over it. - if (sepCnt > 0 && ++cc == 19) { - sIx += 2; - cc = 0; - } - } - - if (d < len) { - // Decode last 1-3 bytes (incl '=') into 1-3 bytes - int i = 0; - for (int j = 0; sIx <= eIx - pad; j++) - i |= IA[sArr[sIx++]] << (18 - j * 6); - - for (int r = 16; d < len; r -= 8) - dArr[d++] = (byte) (i >> r); - } - - return dArr; - } - - // **************************************************************************************** - // * String version - // **************************************************************************************** - - /** Encodes a raw byte array into a BASE64 String representation i accordance with RFC 2045. - * @param sArr The bytes to convert. If null or length 0 an empty array will be returned. - * @param lineSep Optional "\r\n" after 76 characters, unless end of file.
- * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a - * little faster. - * @return A BASE64 encoded array. Never null. - */ - public final static String encodeToString(byte[] sArr, boolean lineSep) - { - // Reuse char[] since we can't create a String incrementally anyway and StringBuffer/Builder would be slower. - return new String(encodeToChar(sArr, lineSep)); - } - - /** Decodes a BASE64 encoded String. All illegal characters will be ignored and can handle both strings with - * and without line separators.
- * Note! It can be up to about 2x the speed to call decode(str.toCharArray()) instead. That - * will create a temporary array though. This version will use str.charAt(i) to iterate the string. - * @param str The source string. null or length 0 will return an empty array. - * @return The decoded array of bytes. May be of length 0. Will be null if the legal characters - * (including '=') isn't divideable by 4. (I.e. definitely corrupted). - */ - public final static byte[] decode(String str) - { - // Check special case - int sLen = str != null ? str.length() : 0; - if (sLen == 0) - return new byte[0]; - - // Count illegal characters (including '\r', '\n') to know what size the returned array will be, - // so we don't have to reallocate & copy it later. - int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...) - for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out. - if (IA[str.charAt(i)] < 0) - sepCnt++; - - // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045. - if ((sLen - sepCnt) % 4 != 0) - return null; - - // Count '=' at end - int pad = 0; - for (int i = sLen; i > 1 && IA[str.charAt(--i)] <= 0;) - if (str.charAt(i) == '=') - pad++; - - int len = ((sLen - sepCnt) * 6 >> 3) - pad; - - byte[] dArr = new byte[len]; // Preallocate byte[] of exact length - - for (int s = 0, d = 0; d < len;) { - // Assemble three bytes into an int from four "valid" characters. - int i = 0; - for (int j = 0; j < 4; j++) { // j only increased if a valid char was found. - int c = IA[str.charAt(s++)]; - if (c >= 0) - i |= c << (18 - j * 6); - else - j--; - } - // Add the bytes - dArr[d++] = (byte) (i >> 16); - if (d < len) { - dArr[d++]= (byte) (i >> 8); - if (d < len) - dArr[d++] = (byte) i; - } - } - return dArr; - } - - /** Decodes a BASE64 encoded string that is known to be resonably well formatted. The method is about twice as - * fast as {@link #decode(String)}. The preconditions are:
- * + The array must have a line length of 76 chars OR no line separators at all (one line).
- * + Line separator must be "\r\n", as specified in RFC 2045 - * + The array must not contain illegal characters within the encoded string
- * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.
- * @param s The source string. Length 0 will return an empty array. null will throw an exception. - * @return The decoded array of bytes. May be of length 0. - */ - public final static byte[] decodeFast(String s) - { - // Check special case - int sLen = s.length(); - if (sLen == 0) - return new byte[0]; - - int sIx = 0, eIx = sLen - 1; // Start and end index after trimming. - - // Trim illegal chars from start - while (sIx < eIx && IA[s.charAt(sIx) & 0xff] < 0) - sIx++; - - // Trim illegal chars from end - while (eIx > 0 && IA[s.charAt(eIx) & 0xff] < 0) - eIx--; - - // get the padding count (=) (0, 1 or 2) - int pad = s.charAt(eIx) == '=' ? (s.charAt(eIx - 1) == '=' ? 2 : 1) : 0; // Count '=' at end. - int cCnt = eIx - sIx + 1; // Content count including possible separators - int sepCnt = sLen > 76 ? (s.charAt(76) == '\r' ? cCnt / 78 : 0) << 1 : 0; - - int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes - byte[] dArr = new byte[len]; // Preallocate byte[] of exact length - - // Decode all but the last 0 - 2 bytes. - int d = 0; - for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) { - // Assemble three bytes into an int from four "valid" characters. - int i = IA[s.charAt(sIx++)] << 18 | IA[s.charAt(sIx++)] << 12 | IA[s.charAt(sIx++)] << 6 | IA[s.charAt(sIx++)]; - - // Add the bytes - dArr[d++] = (byte) (i >> 16); - dArr[d++] = (byte) (i >> 8); - dArr[d++] = (byte) i; - - // If line separator, jump over it. - if (sepCnt > 0 && ++cc == 19) { - sIx += 2; - cc = 0; - } - } - - if (d < len) { - // Decode last 1-3 bytes (incl '=') into 1-3 bytes - int i = 0; - for (int j = 0; sIx <= eIx - pad; j++) - i |= IA[s.charAt(sIx++)] << (18 - j * 6); - - for (int r = 16; d < len; r -= 8) - dArr[d++] = (byte) (i >> r); - } - - return dArr; - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/JSON.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/JSON.java deleted file mode 100644 index acbe1d7..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/JSON.java +++ /dev/null @@ -1,335 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.implementation; - -import com.jilk.ros.message.Message; -import com.jilk.ros.rosbridge.indication.Indication; -import com.jilk.ros.rosbridge.operation.Wrapper; - -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; - -import java.io.StringReader; -import java.lang.reflect.Array; -import java.lang.reflect.Field; - - -// The slightly crazy abstractions here are designed to isolate knowledge of -// the JSON library and data types from the Operation details of rosbridge. -// Why is this important? A few reasons I can see. First, we might want -// to change JSON libraries and this encapsulates all use of JSON-simple. -// Second, as much as possible I would like the semantics of the rosbridge -// protocol to be encapsulated in the Operation and its subclasses rather -// than in a module that is essentially about serialization. -// -// Unfortunately the hierarchical Message abstraction is a bit broken -// at the top level. Beginning at the actual operation (e.g., Publish), the -// types of the fields are determined either by the fields themselves or by -// an indicator. However, the type of the operation itself is not determined -// this way, because the indicator is in the object itself, which means it -// would have to be created before its type is known. Rather than build in -// exceptions, I elected to create a "Wrapper" operation type that simply -// wraps the concrete operation and copies its "op" field. -// - -public class JSON { - - /** - * Translates a Message recursively into JSON. Normally the Message is also an - * Operation, but it does not have to be. The caller constructs a complete - * message using @Operation and @Message types. This includes situations - * where one or more fields are marked to be turned into arrays, using @AsArray. - * @param m the @Message object to be recursively translated. - * @return the complete JSON string. - */ - public static String toJSON(Message m) { - JSONObject jo = convertObjectToJSONObject(m); // Object to JSON-Simple - return jo.toJSONString(); // JSON-Simple to string - } - - /** - * Translates JSON into a hierarchical Operation/Message structure. - * This includes handling fields that are @Indicated and @AsArray. If the - * @Class parameter is a @Wrapper, this is a special case whereby the - * object is wrapped to create a consistent hierarchy. - * @param json the source JSON string - * @param c the top level class of the JSON. Normally @Wrapper - * @param r the @Registry containing topic registrations - * @return the fully instantiated message hierarchy represented - * by the JSON string. - */ - public static Message toMessage(String json, Class c, Registry r) { - JSONObject joUnwrapped = convertStringToJSONObject(json); // String to JSON-Simple - JSONObject jo = joUnwrapped; - if (Wrapper.class.isAssignableFrom(c)) - jo = wrap(joUnwrapped, c); // wrap: a hack to make the hierarchy homogeneous - return convertJSONObjectToMessage(jo, c, r); // JSON-Simple to Message - } - - // *** Create JSON from Messages *** // - - // Translate the object into a JSON-Simple object, field-by-field, - // recursively via convertElementToJSON. - // except for the case where AsArray is indicated - private static JSONObject convertObjectToJSONObject(Object o) { - JSONObject result = new JSONObject(); - for (Field f : o.getClass().getFields()) { - Object fieldObject = getFieldObject(f, o); - if (fieldObject != null) { - Object resultObject; - if (Indication.isBase64Encoded(f)) - resultObject = convertByteArrayToBase64JSONString(fieldObject); - else if (Indication.asArray(f)) - resultObject = convertObjectToJSONArray(fieldObject); - else resultObject = convertElementToJSON(fieldObject); - result.put(f.getName(), resultObject); - } - } - return result; - } - - // Convert an array type to a JSON-Simple array, element-by-element, - // recursively via convertElementToJSON. - private static JSONArray convertArrayToJSONArray(Object array) { - JSONArray result = new JSONArray(); - for (int i = 0; i < Array.getLength(array); i++) { - Object elementObject = Array.get(array, i); - if (elementObject != null) { - Object resultObject = convertElementToJSON(elementObject); - result.add(resultObject); - } - } - return result; - } - - // For AsArray objects, convert the object to a JSON-Simple array - // NOTE: This relies on later versions of the JDK providing - // the fields in order. - private static JSONArray convertObjectToJSONArray(Object o) { - JSONArray result = new JSONArray(); - for (Field f : o.getClass().getFields()) { - Object fieldObject = getFieldObject(f, o); - if (fieldObject != null) { - Object resultObject = convertElementToJSON(fieldObject); - result.add(resultObject); - } - } - return result; - } - - // Convert the individual field or array element items recursively - private static Object convertElementToJSON(Object elementObject) { - Class elementClass = elementObject.getClass(); - Object resultObject; - if (Message.isPrimitive(elementClass)) - resultObject = elementObject; - else if (elementClass.isArray()) - resultObject = convertArrayToJSONArray(elementObject); - else - resultObject = convertObjectToJSONObject(elementObject); - return resultObject; - } - - // Special case for Base 64-encoded fields - private static Object convertByteArrayToBase64JSONString(Object fieldObject) { - return Base64.encodeToString((byte[]) fieldObject, false); - } - - // This is just to buffer the code from the exception. Better error - // handling needed here. - private static Object getFieldObject(Field f, Object o) { - Object fo = null; - try { - fo = f.get(o); - } - catch (IllegalAccessException ex) { - ex.printStackTrace(); - } - return fo; - } - - // *** Create Messages from JSON *** // - - // Use the JSON-simple parser to create the JSON-Simple object - private static JSONObject convertStringToJSONObject(String json) { - JSONObject result = null; - StringReader r = new StringReader(json); - JSONParser jp = new JSONParser(); - try { - result = (JSONObject) jp.parse(r); - } - catch (Throwable t) { - System.out.println(t.getMessage()); - } - r.close(); - return result; - } - - // A bit of a hack to create a consistent hierarchy with jsonbridge operations - // At least it does not depend on any specific field names, it just copies the - // Indicator and Indicated fields. - private static JSONObject wrap(JSONObject jo, Class c) { - JSONObject result = new JSONObject(); - String indicatorName = Indication.getIndicatorName(c); - String indicatedName = Indication.getIndicatedName(c); - result.put(indicatorName, jo.get(indicatorName)); - result.put(indicatedName, jo); - return result; - } - - // Convert the JSON-Simple object to the indicated message, field-by-field - // recursively via convertElementToField. - private static Message convertJSONObjectToMessage(JSONObject jo, Class c, Registry r) { - //System.out.println("JSON.convertJSONObjectToMessage: " + jo.toJSONString()); - try { - Message result = (Message) c.newInstance(); - for (Field f : c.getFields()) { - Class fc = getFieldClass(result, jo, f, r); - Object lookup = jo.get(f.getName()); - if (lookup != null) { - Object value = convertElementToField(lookup, fc, f, r); - f.set(result, value); - } - } - return result; - } - catch (Exception ex) { - //ex.printStackTrace(); - return null; - } - } - - // Convert the JSON-Simple array to the indicated message, element-by-element - // recursively via convertElementToField. - private static Object convertJSONArrayToArray(JSONArray ja, Class c, Registry r) { - Object result = Array.newInstance(c, ja.size()); - for (int i = 0; i < ja.size(); i++) { - Object lookup = ja.get(i); - Object value = null; - if (lookup != null) { - if (lookup.getClass().equals(JSONObject.class)) - value = convertJSONObjectToMessage((JSONObject) lookup, c, r); - else if (lookup.getClass().equals(JSONArray.class)) // this is not actually allowed in ROS - value = convertJSONArrayToArray((JSONArray) lookup, c.getComponentType(), r); - else - value = convertJSONPrimitiveToPrimitive(lookup, c); - Array.set(result, i, value); - } - } - - return result; - } - - // Convert a JSON-Simple array to a Message, field-by-field of the Message, - // element-by-element of the array, recursively via convertElementToField. - // NOTE: This relies on later versions of the JDK providing - // the fields in order. - private static Message convertJSONArrayToMessage(JSONArray ja, Class c, Registry r) { - try { - Message result = (Message) c.newInstance(); - int arrayIndex = 0; - for (Field f : c.getFields()) { - Class fc = getFieldClass(result, null, f, r); - Object lookup = ja.get(arrayIndex++); // yes we are assuming that the fields are delivered in order - if (lookup != null) { - Object value = convertElementToField(lookup, fc, f, r); - f.set(result, value); - } - } - - return result; - } - catch (Exception ex) { - ex.printStackTrace(); - return null; - } - } - - // Convert an individual array or object element to a field in the Message, - // recursively, and applying AsArray if needed. - private static Object convertElementToField(Object element, Class fc, Field f, Registry r) { - //System.out.println("JSON.convertElementToField: " + f.getName() + " " + fc.getName()); - Object value; - if (element.getClass().equals(JSONObject.class)) { - //System.out.println("JSON.convertElementToField: JSON Object " + ((JSONObject) element).toJSONString()); - value = convertJSONObjectToMessage((JSONObject) element, fc, r); - } - else if (element.getClass().equals(JSONArray.class)) { - //System.out.println("JSON.convertElementToField: JSON Array " + ((JSONArray) element).toJSONString()); - if (Indication.asArray(f)) - value = convertJSONArrayToMessage((JSONArray) element, fc, r); - else value = convertJSONArrayToArray((JSONArray) element, fc, r); - } - else { - //System.out.println("JSON.convertElementToField: Primitive " + element); - if (Indication.isBase64Encoded(f)) - value = convertBase64JSONStringToByteArray(element); - else value = convertJSONPrimitiveToPrimitive(element, fc); - } - - return value; - } - - // Note that this is not checking ranges - public static Object convertJSONPrimitiveToPrimitive(Object o, Class c) { - Object result = o; - if (c.isPrimitive() || Number.class.isAssignableFrom(c)) { - if (c.equals(double.class) || c.equals(Double.class)) - result = new Double(((Number) o).doubleValue()); - else if (c.equals(float.class) || c.equals(Float.class)) - result = new Float(((Number) o).floatValue()); - else if (c.equals(long.class) || c.equals(Long.class)) - result = new Long(((Number) o).longValue()); - else if (int.class.equals(c) || c.equals(Integer.class)) - result = new Integer(((Number) o).intValue()); - else if (c.equals(short.class) || c.equals(Short.class)) - result = new Short(((Number) o).shortValue()); - else if (c.equals(byte.class) || c.equals(Byte.class)) - result = new Byte(((Number) o).byteValue()); - } - return result; - } - - public static byte[] convertBase64JSONStringToByteArray(Object element) { - return Base64.decode((String) element); - } - - // Determine the target class of a field in the object or array, based - // directly on the field's type, or using the Indicator if applicable, - // The Indicator field only provides the topic/service, so we have to look - // up the Class in the registry. - public static Class getFieldClass(Message parent, JSONObject jo, Field f, Registry r) { - Class fc; - fc = f.getType(); - if (fc.isArray()) - fc = f.getType().getComponentType(); - if (Indication.isIndicated(f) && (jo != null)) { - //fc = Indication.getIndication(parent, - // (String) jo.get(Indication.getIndicatorName(parent.getClass()))); - fc = r.lookup(parent.getClass(), - (String) jo.get(Indication.getIndicatorName(parent.getClass()))); - //System.out.println("JSON.getFieldClass: parent class " + parent.getClass().getName() + - // " Indicator: " + Indication.getIndicatorName(parent.getClass()) + - // " result: " + fc.getName()); - } - return fc; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/PublishEvent.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/PublishEvent.java deleted file mode 100644 index c7df197..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/PublishEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.jilk.ros.rosbridge.implementation; - -import com.jilk.ros.rosbridge.operation.Operation; - -/**EventBus event entity,describe ros server response info - * Created by xxhong on 16-11-22. - */ - -public class PublishEvent { - public String msg; - public String id; - public String name; - public String op; - - - public PublishEvent(Operation operation, String name, String content) { - if(operation != null) { - id = operation.id; - op = operation.op; - } - this.name = name; - msg = content; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/ROSBridgeWebSocketClient.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/ROSBridgeWebSocketClient.java deleted file mode 100644 index 71d1abb..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/ROSBridgeWebSocketClient.java +++ /dev/null @@ -1,202 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - *

- * This file is part of the Java ROSBridge Client. - *

- * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - */ -package com.jilk.ros.rosbridge.implementation; - -import com.jilk.ros.ROSClient; -import com.jilk.ros.message.Message; -import com.jilk.ros.rosbridge.FullMessageHandler; -import com.jilk.ros.rosbridge.operation.Operation; -import com.jilk.ros.rosbridge.operation.Publish; -import com.jilk.ros.rosbridge.operation.ServiceResponse; - -import org.java_websocket.client.WebSocketClient; -import org.java_websocket.framing.CloseFrame; -import org.java_websocket.handshake.ServerHandshake; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; - -import java.lang.reflect.Field; -import java.net.Socket; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.channels.SocketChannel; - -import de.greenrobot.event.EventBus; - -public class ROSBridgeWebSocketClient extends WebSocketClient { - private Registry classes; - private Registry handlers; - private boolean debug; - private ROSClient.ConnectionStatusListener listener; - - ROSBridgeWebSocketClient(URI serverURI) { - super(serverURI); - classes = new Registry(); - handlers = new Registry(); - Operation.initialize(classes); // note, this ensures that the Message Map is initialized too - listener = null; - } - - public static ROSBridgeWebSocketClient create(String URIString) { - ROSBridgeWebSocketClient client = null; - try { - URI uri = new URI(URIString); - client = new ROSBridgeWebSocketClient(uri); - } catch (URISyntaxException ex) { - ex.printStackTrace(); - } - return client; - } - - public void setListener(ROSClient.ConnectionStatusListener listener) { - this.listener = listener; - } - - @Override - public void onOpen(ServerHandshake handshakedata) { - if (listener != null) - listener.onConnect(); - } - - @Override - public void onMessage(String message) { - if (debug) System.out.println(" " + json); - send(json); - } - - public void register(Class c, - String s, - Class m, - FullMessageHandler h) { - Message.register(m, classes.get(Message.class)); - classes.register(c, s, m); - if (h != null) - handlers.register(c, s, h); - } - - public void unregister(Class c, String s) { - handlers.unregister(c, s); - // Note that there is no concept of unregistering a class - it can get replaced is all - } - - public Class getRegisteredMessage(String messageString) { - return classes.lookup(Message.class, messageString); - } - - public void setDebug(boolean debug) { - this.debug = debug; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/Registry.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/Registry.java deleted file mode 100644 index 4747e6d..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/implementation/Registry.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.implementation; - -import java.util.HashMap; -import java.util.Map; - -public class Registry extends HashMap> { - - public void register(Class c, String s, T t) { - Map table = get(c); - if (table == null) { - table = new HashMap(); - put(c, table); - } - table.put(s, t); - } - - public void unregister(Class c, String s) { - Map table = get(c); - if (table != null) - table.remove(s); - } - - public T lookup(Class c, String s) { - T result = null; - Map table = get(c); - if (table != null) - result = table.get(s); - return result; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/AsArray.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/AsArray.java deleted file mode 100644 index f411ec4..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/AsArray.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.indication; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface AsArray { -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Base64Encoded.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Base64Encoded.java deleted file mode 100644 index 5e5e04d..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Base64Encoded.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.indication; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface Base64Encoded { -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indicate.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indicate.java deleted file mode 100644 index 3827ae4..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indicate.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.indication; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface Indicate { - // if later we want multiple indicated fields, use an int here -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indicated.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indicated.java deleted file mode 100644 index f0edc8e..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indicated.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.indication; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface Indicated { - // if later we want multiple indicated fields, use an int here -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indication.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indication.java deleted file mode 100644 index f7c69b7..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indication.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.indication; - -import java.lang.reflect.Field; - -public class Indication { - public static boolean isIndicated(Field f) { - return (f.getAnnotation(Indicated.class) != null); - } - - public static boolean asArray(Field f) { - return (f.getAnnotation(AsArray.class) != null); - } - - public static boolean isBase64Encoded(Field f) { - return ((f.getAnnotation(Base64Encoded.class) != null) && - f.getType().isArray() && - f.getType().getComponentType().equals(byte.class)); - } - - public static String getIndicatorName(Class c) { - return getName(c, Indicator.class); - } - - public static String getIndicatedName(Class c) { - return getName(c, Indicated.class); - } - - private static String getName(Class c, Class annotation) { - String result = null; - for (Field f : c.getFields()) { - if (f.getAnnotation(annotation) != null) { - result = f.getName(); - break; - } - } - return result; - } - - /* - public static Class getIndication(Object o, String s) { - Class c = o.getClass(); - Class result = null; - try { - Method m = getIndicateMethod(c); - result = (Class) (m.invoke(o, s)); - } - catch (ReflectiveOperationException ex) { - ex.printStackTrace(); - } - return result; - } - - private static Method getIndicateMethod(Class c) { - Method result = null; - for (Method m : c.getMethods()) { - if (m.getAnnotation(Indicate.class) != null) { - result = m; - break; - } - } - return result; - } - */ -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indicator.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indicator.java deleted file mode 100644 index d1d2ff9..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/indication/Indicator.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.indication; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface Indicator { - // if later we want multiple indicated fields, use an int here -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Advertise.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Advertise.java deleted file mode 100644 index f41506e..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Advertise.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.MessageType; - -@MessageType(string = "advertise") -public class Advertise extends Operation { - public String topic; - public String type; - - public Advertise() {} - - public Advertise(String topic, String type) { - this.topic = topic; - this.type = type; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Authenticate.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Authenticate.java deleted file mode 100644 index 517e360..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Authenticate.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.MessageType; - -@MessageType(string = "auth") -public class Authenticate extends Operation { - public String mac; - public String client; - public String dest; - public String rand; - public int t; - public String level; - public int end; - - public Authenticate() {} - - public Authenticate( - String mac, - String client, - String dest, - String rand, - int t, - String level, - int end) - { - this.mac = mac; - this.client = client; - this.dest = dest; - this.rand = rand; - this.t = t; - this.level = level; - this.end = end; - - this.id = null; // even though id is on EVERY OTHER operation type - } - -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/CallService.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/CallService.java deleted file mode 100644 index fb9d6fa..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/CallService.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; -import com.jilk.ros.rosbridge.indication.AsArray; -import com.jilk.ros.rosbridge.indication.Indicated; -import com.jilk.ros.rosbridge.indication.Indicator; - -@MessageType(string = "call_service") -public class CallService extends Operation { - @Indicator public String service; - @Indicated @AsArray public Message args; - public Integer fragment_size; // use Integer for optional items - public String compression; - - public CallService() {} - - public CallService(String service, Message args) { - this.service = service; - this.args = args; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Fragment.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Fragment.java deleted file mode 100644 index 0093eae..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Fragment.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.MessageType; - -@MessageType(string = "fragment") -public class Fragment extends Operation { - public String data; - public int num; - public int total; - - public Fragment() {} - - public Fragment(String data, int num, int total) { - this.data = data; - this.num = num; - this.total = total; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Operation.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Operation.java deleted file mode 100644 index 98d4db3..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Operation.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; -import com.jilk.ros.rosbridge.implementation.JSON; -import com.jilk.ros.rosbridge.implementation.Registry; - -@MessageType(string = "operation") -public class Operation extends Message { - private static Long uid = 0L; - - public String op; - public String id; - - public Operation() { - this.op = getMessageType(getClass()); - this.id = nextId(); - } - - private static synchronized String nextId() { - String result = uid.toString(); - uid++; - return result; - } - - public String toJSON() { - return JSON.toJSON(this); - } - - public static Operation toOperation(String json, Registry registry) { - return ((Wrapper) JSON.toMessage(json, Wrapper.class, registry)).msg; - } - - public static void initialize(Registry registry) { - initClass(registry, Advertise.class); - initClass(registry, Authenticate.class); - initClass(registry, CallService.class); - initClass(registry, Fragment.class); - initClass(registry, Operation.class); - initClass(registry, PNG.class); - initClass(registry, Publish.class); - initClass(registry, ServiceResponse.class); - initClass(registry, SetStatusLevel.class); - initClass(registry, Status.class); - initClass(registry, Subscribe.class); - initClass(registry, Unadvertise.class); - initClass(registry, Unsubscribe.class); - initClass(registry, Wrapper.class); - - registry.register(Wrapper.class, Message.getMessageType(Publish.class), Publish.class); - registry.register(Wrapper.class, Message.getMessageType(CallService.class), CallService.class); - registry.register(Wrapper.class, Message.getMessageType(ServiceResponse.class), ServiceResponse.class); - } - - private static void initClass(Registry registry, Class c) { - registry.register(Message.class, Message.getMessageType(c), c); - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/PNG.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/PNG.java deleted file mode 100644 index 7cbda69..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/PNG.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.MessageType; - -@MessageType(string = "png") -public class PNG extends Operation { - public String data; - public Integer num; // use Integer for optional items - public Integer total; // use Integer for optional items - - public PNG() {} - - public PNG(String data) { - this.data = data; - } - - public PNG(String data, int num, int total) { - this.data = data; - this.num = num; - this.total = total; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Publish.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Publish.java deleted file mode 100644 index 8acf725..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Publish.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; -import com.jilk.ros.rosbridge.indication.Indicated; -import com.jilk.ros.rosbridge.indication.Indicator; - -@MessageType(string = "publish") -public class Publish extends Operation { - - @Indicator public String topic; - @Indicated - public Message msg; - - public Publish() {} - - public Publish(String topic, Message msg) { - this.topic = topic; - this.msg = msg; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/ServiceResponse.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/ServiceResponse.java deleted file mode 100644 index 2d7384b..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/ServiceResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.Message; -import com.jilk.ros.message.MessageType; -import com.jilk.ros.rosbridge.indication.Indicated; -import com.jilk.ros.rosbridge.indication.Indicator; - -@MessageType(string = "service_response") -public class ServiceResponse extends Operation { - @Indicator public String service; - public boolean result; - @Indicated public Message values; - - public ServiceResponse() {} - - public ServiceResponse(String service) { - this.service = service; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/SetStatusLevel.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/SetStatusLevel.java deleted file mode 100644 index bf7a16a..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/SetStatusLevel.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.MessageType; - -@MessageType(string = "set_level") -public class SetStatusLevel extends Operation { - public String level; - - public SetStatusLevel() {} - - public SetStatusLevel(String level) { - this.level = null; - if ("none".equals(level) || - "warning".equals(level) || - "error".equals(level) || - "info".equals(level)) - this.level = level; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Status.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Status.java deleted file mode 100644 index 051a48a..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Status.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.MessageType; - -@MessageType(string = "status") -public class Status extends Operation { - String level; - String msg; - - public Status() {} - - public Status(String level, String msg) { - this.level = level; - this.msg = msg; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Subscribe.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Subscribe.java deleted file mode 100644 index a965ced..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Subscribe.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.MessageType; - -@MessageType(string = "subscribe") -public class Subscribe extends Operation { - public String topic; - public String type; - public Integer throttle_rate; // use Integer for optional items - public Integer queue_length; // use Integer for optional items - public Integer fragment_size; // use Integer for optional items - public String compression; - - public Subscribe() {} - - public Subscribe(String topic, String type) { - this.topic = topic; - this.type = type; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Unadvertise.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Unadvertise.java deleted file mode 100644 index 0c5d2f0..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Unadvertise.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.MessageType; - -@MessageType(string = "unadvertise") -public class Unadvertise extends Operation { - public String topic; - - public Unadvertise() {} - - public Unadvertise(String topic) { - this.topic = topic; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Unsubscribe.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Unsubscribe.java deleted file mode 100644 index 94d2810..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Unsubscribe.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.MessageType; - -@MessageType(string = "unsubscribe") -public class Unsubscribe extends Operation { - public String topic; - - public Unsubscribe() {} - - public Unsubscribe(String topic) { - this.topic = topic; - } -} diff --git a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Wrapper.java b/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Wrapper.java deleted file mode 100644 index c14b3d2..0000000 --- a/AndroidStudio_projects/app/src/main/java/com/jilk/ros/rosbridge/operation/Wrapper.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2014 Jilk Systems, Inc. - * - * This file is part of the Java ROSBridge Client. - * - * The Java ROSBridge Client is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Java ROSBridge Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/. - * - */ -package com.jilk.ros.rosbridge.operation; - -import com.jilk.ros.message.MessageType; -import com.jilk.ros.rosbridge.indication.Indicated; -import com.jilk.ros.rosbridge.indication.Indicator; - -@MessageType(string = "wrapper") -public class Wrapper extends Operation { - @Indicator public String op; - @Indicated - public Operation msg; - - public Wrapper() {} -} diff --git a/AndroidStudio_projects/app/src/main/jni/native-test.c b/AndroidStudio_projects/app/src/main/jni/native-test.c deleted file mode 100644 index d375cf9..0000000 --- a/AndroidStudio_projects/app/src/main/jni/native-test.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -JNIEXPORT jstring JNICALL -Java_com_example_dadac_testrosbridge_JNICallAll_stringFromJNI(JNIEnv *env, jobject instance) { - - char *a = "wen"; - - return (*env)->NewStringUTF(env, a); -} \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/AndroidStudio_projects/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/AndroidStudio_projects/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/drawable/hotel_logo.jpg b/AndroidStudio_projects/app/src/main/res/drawable/hotel_logo.jpg deleted file mode 100644 index a9a08d8..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/drawable/hotel_logo.jpg and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/drawable/ic_dashboard_black_24dp.xml b/AndroidStudio_projects/app/src/main/res/drawable/ic_dashboard_black_24dp.xml deleted file mode 100644 index 46fc8de..0000000 --- a/AndroidStudio_projects/app/src/main/res/drawable/ic_dashboard_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/AndroidStudio_projects/app/src/main/res/drawable/ic_home_black_24dp.xml b/AndroidStudio_projects/app/src/main/res/drawable/ic_home_black_24dp.xml deleted file mode 100644 index f8bb0b5..0000000 --- a/AndroidStudio_projects/app/src/main/res/drawable/ic_home_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/AndroidStudio_projects/app/src/main/res/drawable/ic_launcher_background.xml b/AndroidStudio_projects/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9..0000000 --- a/AndroidStudio_projects/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/AndroidStudio_projects/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/AndroidStudio_projects/app/src/main/res/drawable/ic_notifications_black_24dp.xml deleted file mode 100644 index 78b75c3..0000000 --- a/AndroidStudio_projects/app/src/main/res/drawable/ic_notifications_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/AndroidStudio_projects/app/src/main/res/layout/activity_add.xml b/AndroidStudio_projects/app/src/main/res/layout/activity_add.xml deleted file mode 100644 index 1ecaa59..0000000 --- a/AndroidStudio_projects/app/src/main/res/layout/activity_add.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/layout/main_window.xml b/AndroidStudio_projects/app/src/main/res/layout/main_window.xml deleted file mode 100644 index fee78aa..0000000 --- a/AndroidStudio_projects/app/src/main/res/layout/main_window.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/menu/bottom_nav_menu.xml b/AndroidStudio_projects/app/src/main/res/menu/bottom_nav_menu.xml deleted file mode 100644 index fb6d040..0000000 --- a/AndroidStudio_projects/app/src/main/res/menu/bottom_nav_menu.xml +++ /dev/null @@ -1,19 +0,0 @@ - -

- - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/AndroidStudio_projects/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index eca70cf..0000000 --- a/AndroidStudio_projects/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/AndroidStudio_projects/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index eca70cf..0000000 --- a/AndroidStudio_projects/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/AndroidStudio_projects/app/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/AndroidStudio_projects/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/AndroidStudio_projects/app/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d6..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/AndroidStudio_projects/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611d..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/AndroidStudio_projects/app/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a307..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/AndroidStudio_projects/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a695..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/AndroidStudio_projects/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/AndroidStudio_projects/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f50..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/_1.jpg b/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/_1.jpg deleted file mode 100644 index 906e971..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/_1.jpg and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d642..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae3..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/logo.jpg b/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/logo.jpg deleted file mode 100644 index 65ca6fd..0000000 Binary files a/AndroidStudio_projects/app/src/main/res/mipmap-xxxhdpi/logo.jpg and /dev/null differ diff --git a/AndroidStudio_projects/app/src/main/res/navigation/mobile_navigation.xml b/AndroidStudio_projects/app/src/main/res/navigation/mobile_navigation.xml deleted file mode 100644 index 1b30025..0000000 --- a/AndroidStudio_projects/app/src/main/res/navigation/mobile_navigation.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/values-night/themes.xml b/AndroidStudio_projects/app/src/main/res/values-night/themes.xml deleted file mode 100644 index f4c8632..0000000 --- a/AndroidStudio_projects/app/src/main/res/values-night/themes.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/values/colors.xml b/AndroidStudio_projects/app/src/main/res/values/colors.xml deleted file mode 100644 index f8c6127..0000000 --- a/AndroidStudio_projects/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - #FFBB86FC - #FF6200EE - #FF3700B3 - #FF03DAC5 - #FF018786 - #FF000000 - #FFFFFFFF - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/values/dimens.xml b/AndroidStudio_projects/app/src/main/res/values/dimens.xml deleted file mode 100644 index e00c2dd..0000000 --- a/AndroidStudio_projects/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 16dp - 16dp - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/values/strings.xml b/AndroidStudio_projects/app/src/main/res/values/strings.xml deleted file mode 100644 index 5157a57..0000000 --- a/AndroidStudio_projects/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - 酒店智慧管理系统 - MainActivity2 - 个人中心 - 物品需求 - 公告栏 - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/values/themes.xml b/AndroidStudio_projects/app/src/main/res/values/themes.xml deleted file mode 100644 index f946c10..0000000 --- a/AndroidStudio_projects/app/src/main/res/values/themes.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/xml/backup_rules.xml b/AndroidStudio_projects/app/src/main/res/xml/backup_rules.xml deleted file mode 100644 index fa0f996..0000000 --- a/AndroidStudio_projects/app/src/main/res/xml/backup_rules.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/main/res/xml/data_extraction_rules.xml b/AndroidStudio_projects/app/src/main/res/xml/data_extraction_rules.xml deleted file mode 100644 index 9ee9997..0000000 --- a/AndroidStudio_projects/app/src/main/res/xml/data_extraction_rules.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/AndroidStudio_projects/app/src/test/java/com/example/hamburger/ExampleUnitTest.java b/AndroidStudio_projects/app/src/test/java/com/example/hamburger/ExampleUnitTest.java deleted file mode 100644 index 3822adf..0000000 --- a/AndroidStudio_projects/app/src/test/java/com/example/hamburger/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.example.hamburger; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/AndroidStudio_projects/build.gradle b/AndroidStudio_projects/build.gradle deleted file mode 100644 index 71b99f4..0000000 --- a/AndroidStudio_projects/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -plugins { - id 'com.android.application' version '7.3.1' apply false - id 'com.android.library' version '7.3.1' apply false -} \ No newline at end of file diff --git a/AndroidStudio_projects/gradle.properties b/AndroidStudio_projects/gradle.properties deleted file mode 100644 index 15507e8..0000000 --- a/AndroidStudio_projects/gradle.properties +++ /dev/null @@ -1,17 +0,0 @@ -## 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. -# Default value: -Xmx1024m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -# -# 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 -#Sun Nov 06 12:18:57 CST 2022 -android.nonTransitiveRClass=true -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding\=UTF-8 -android.useAndroidX=true -android.enableJetifier=true diff --git a/AndroidStudio_projects/gradle/wrapper/gradle-wrapper.jar b/AndroidStudio_projects/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c..0000000 Binary files a/AndroidStudio_projects/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/AndroidStudio_projects/gradle/wrapper/gradle-wrapper.properties b/AndroidStudio_projects/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 7697d30..0000000 --- a/AndroidStudio_projects/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Tue Oct 18 19:22:46 CST 2022 -distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip -distributionPath=wrapper/dists -zipStorePath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME diff --git a/AndroidStudio_projects/gradlew b/AndroidStudio_projects/gradlew deleted file mode 100644 index 4f906e0..0000000 --- a/AndroidStudio_projects/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## 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='"-Xmx64m" "-Xms64m"' - -# 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 or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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" - -exec "$JAVACMD" "$@" diff --git a/AndroidStudio_projects/gradlew.bat b/AndroidStudio_projects/gradlew.bat deleted file mode 100644 index 107acd3..0000000 --- a/AndroidStudio_projects/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@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 Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@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="-Xmx64m" "-Xms64m" - -@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 execute - -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 execute - -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 - -: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 %* - -: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 diff --git a/AndroidStudio_projects/settings.gradle b/AndroidStudio_projects/settings.gradle deleted file mode 100644 index 19e7d24..0000000 --- a/AndroidStudio_projects/settings.gradle +++ /dev/null @@ -1,16 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - google() - mavenCentral() - } -} -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - google() - mavenCentral() - } -} -rootProject.name = "Hamburger" -include ':app'