├── AndroidPlugin ├── app │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── values │ │ │ │ │ ├── strings.xml │ │ │ │ │ ├── colors.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── drawable-v24 │ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ │ └── drawable │ │ │ │ │ └── ic_launcher_background.xml │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── gmurru │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── com │ │ │ └── gmurru │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── bleframework │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ └── values │ │ │ │ │ └── strings.xml │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── gmurru │ │ │ │ └── bleframework │ │ │ │ ├── RBLGattAttributes.java │ │ │ │ └── RBLService.java │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── gmurru │ │ │ │ └── bleframework │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── com │ │ │ └── gmurru │ │ │ └── bleframework │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── settings.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── .idea │ ├── encodings.xml │ ├── vcs.xml │ ├── misc.xml │ ├── runConfigurations.xml │ └── gradle.xml ├── .gitignore ├── build.gradle ├── gradle.properties ├── gradlew.bat └── gradlew ├── BleFramework ├── ProjectSettings │ ├── ProjectVersion.txt │ ├── ClusterInputManager.asset │ ├── PresetManager.asset │ ├── NetworkManager.asset │ ├── TimeManager.asset │ ├── VFXManager.asset │ ├── AudioManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── TagManager.asset │ ├── DynamicsManager.asset │ ├── UnityConnectSettings.asset │ ├── NavMeshAreas.asset │ ├── Physics2DSettings.asset │ ├── GraphicsSettings.asset │ ├── QualitySettings.asset │ └── InputManager.asset ├── Assets │ ├── Sprites │ │ ├── backButton.png │ │ ├── CloseButton.png │ │ ├── forwardButton.png │ │ ├── loadingIndicatorWhite.png │ │ ├── CloseButton.png.meta │ │ ├── backButton.png.meta │ │ ├── forwardButton.png.meta │ │ └── loadingIndicatorWhite.png.meta │ ├── Fonts │ │ ├── play │ │ │ ├── Play-Bold.ttf │ │ │ ├── Play-Regular.ttf │ │ │ ├── OFL.txt.meta │ │ │ ├── METADATA.json.meta │ │ │ ├── DESCRIPTION.en_us.html.meta │ │ │ ├── DESCRIPTION.en_us.html │ │ │ ├── Play-Bold.ttf.meta │ │ │ ├── Play-Regular.ttf.meta │ │ │ ├── METADATA.json │ │ │ └── OFL.txt │ │ └── play.meta │ ├── Scenes │ │ ├── MeteoStation.unity.meta │ │ └── RobotServer.unity.meta │ ├── Plugins │ │ ├── Android.meta │ │ ├── iOS.meta │ │ └── iOS │ │ │ ├── BLE.meta │ │ │ └── BLE │ │ │ ├── BLEFramework.h │ │ │ ├── BLEDefines.h.meta │ │ │ ├── BLEFramework.h.meta │ │ │ ├── BLEFramework.mm.meta │ │ │ ├── BLE.h.meta │ │ │ ├── BLE.m.meta │ │ │ ├── BLEDefines.h │ │ │ ├── BLE.h │ │ │ └── BLEFramework.mm │ ├── BLE.meta │ ├── Fonts.meta │ ├── BLE │ │ ├── BLEControllerEventHandler.prefab.meta │ │ ├── BLEControllerInitializer.prefab.meta │ │ ├── Utils.meta │ │ ├── BLEController.cs.meta │ │ ├── Utils │ │ │ └── MiniJSON.cs.meta │ │ ├── BLEControllerEventHandler.cs.meta │ │ ├── BLEControllerInitializer.cs.meta │ │ ├── BLEControllerInitializer.cs │ │ ├── BLEControllerEventHandler.prefab │ │ ├── BLEControllerInitializer.prefab │ │ ├── BLEControllerEventHandler.cs │ │ └── BLEController.cs │ ├── Plugins.meta │ ├── Prefabs.meta │ ├── Prefabs │ │ ├── Activity Indicator UI.prefab.meta │ │ ├── BLE Device Connect Button.prefab.meta │ │ ├── Activity Indicator UI.prefab │ │ └── BLE Device Connect Button.prefab │ ├── Scenes.meta │ ├── Scripts.meta │ ├── Sprites.meta │ └── Scripts │ │ ├── MeteoStationBehaviour.cs.meta │ │ ├── RobotServerBehaviour.cs.meta │ │ ├── DisconnectButtonBehaviour.cs.meta │ │ ├── AppControllerBehaviour.cs.meta │ │ ├── UserInterfaceBehaviour.cs.meta │ │ ├── ActivityIndicatorUIBehavior.cs.meta │ │ ├── SearchBLEDevicesBehaviour.cs.meta │ │ ├── BleDeviceConnectButtonBehaviour.cs.meta │ │ ├── SearchBLEDevicesBehaviour.cs │ │ ├── DisconnectButtonBehaviour.cs │ │ ├── SearchBleDevicesListResultBehaviour.cs.meta │ │ ├── ActivityIndicatorUIBehavior.cs │ │ ├── BleDeviceConnectButtonBehaviour.cs │ │ ├── UserInterfaceBehaviour.cs │ │ ├── SearchBleDevicesListResultBehaviour.cs │ │ ├── RobotServerBehaviour.cs │ │ ├── MeteoStationBehaviour.cs │ │ └── AppControllerBehaviour.cs ├── .gitignore ├── Logs │ └── Packages-Update.log └── Packages │ └── manifest.json ├── Arduino ├── RobotClient │ ├── IRSensor.h │ ├── IRSensor.cpp │ ├── CarController.h │ ├── RobotClient.ino │ └── CarController.cpp └── MeteoServer │ ├── SparkFun_RHT03.h │ ├── SparkFun_RHT03.cpp │ └── MeteoServer.ino ├── .gitignore ├── LICENSE.md └── README.md /AndroidPlugin/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /AndroidPlugin/bleframework/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /AndroidPlugin/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':bleframework' 2 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.4.1f1 2 | -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | unity 3 | 4 | -------------------------------------------------------------------------------- /BleFramework/Assets/Sprites/backButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/BleFramework/Assets/Sprites/backButton.png -------------------------------------------------------------------------------- /AndroidPlugin/bleframework/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BleFramework 3 | 4 | -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play/Play-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/BleFramework/Assets/Fonts/play/Play-Bold.ttf -------------------------------------------------------------------------------- /BleFramework/Assets/Sprites/CloseButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/BleFramework/Assets/Sprites/CloseButton.png -------------------------------------------------------------------------------- /BleFramework/Assets/Sprites/forwardButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/BleFramework/Assets/Sprites/forwardButton.png -------------------------------------------------------------------------------- /AndroidPlugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play/Play-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/BleFramework/Assets/Fonts/play/Play-Regular.ttf -------------------------------------------------------------------------------- /BleFramework/Assets/Sprites/loadingIndicatorWhite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/BleFramework/Assets/Sprites/loadingIndicatorWhite.png -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidPlugin/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giomurru/ble-framework/HEAD/AndroidPlugin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /AndroidPlugin/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scenes/MeteoStation.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0c8aa9e3d2ae4a83978b0a9b86d477c 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scenes/RobotServer.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 94e8dad31960b4ecba5c14d14900a7b6 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/Android.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98b094fbc1dfa4a478ef9d805ab12aeb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play/OFL.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b091bf7fbb5724f8c8f471a266ffeec4 3 | timeCreated: 1444290169 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: .0199999996 7 | Maximum Allowed Timestep: .333333343 8 | m_TimeScale: 1 9 | -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play/METADATA.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9317780a91a094862b8c0363bd3b67c9 3 | timeCreated: 1444290169 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ec4de63380904516a321772cd670373 3 | folderAsset: yes 4 | timeCreated: 1444036179 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a2393a940d1940d4a7f1c562c48e356 3 | folderAsset: yes 4 | timeCreated: 1444289995 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play/DESCRIPTION.en_us.html.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5247d8001559942a0bc14fddf066359f 3 | timeCreated: 1444290169 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/BLEControllerEventHandler.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e2317bf6ae324e228f529fa81f5a6d1 3 | timeCreated: 1444747124 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/BLEControllerInitializer.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fca333b2805e1493f8deea0e38d7f6d9 3 | timeCreated: 1444473714 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1cf7f4edccdf49e7af9a34f5115ec9a 3 | folderAsset: yes 4 | timeCreated: 1444473725 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f7633c74ebdc4d1fa5b8c2496bba76c 3 | folderAsset: yes 4 | timeCreated: 1444290169 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dffe49d35205845ea95c293b7cc8efa2 3 | folderAsset: yes 4 | timeCreated: 1444035947 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d0a6a8e0f04dd482c8f73e92736396c9 3 | folderAsset: yes 4 | timeCreated: 1444740206 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Prefabs/Activity Indicator UI.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7a099140d36e4f56a1e5c33033859e7 3 | timeCreated: 1444740206 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1ec2fff06c774f16ba331a7732d11af 3 | folderAsset: yes 4 | timeCreated: 1444050615 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 659c981933aec473eaba2f569cb1ea9c 3 | folderAsset: yes 4 | timeCreated: 1444050609 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Sprites.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a01105acc9c4f4c458badc36d4fe5812 3 | folderAsset: yes 4 | timeCreated: 1444738961 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/iOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6116d716cff4a4870b14a8818c3fb2c3 3 | folderAsset: yes 4 | timeCreated: 1444035965 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/iOS/BLE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23896d13de6ec494aa453290d40fae63 3 | folderAsset: yes 4 | timeCreated: 1444035965 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /BleFramework/Assets/Prefabs/BLE Device Connect Button.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c060328db026b416c989b44e26284b45 3 | timeCreated: 1444757333 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /AndroidPlugin/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | -------------------------------------------------------------------------------- /AndroidPlugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Jun 16 19:06:06 CEST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/MeteoStationBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b2d17ac8b90049bab82e40e1af1638c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/RobotServerBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5896f2872dc14644923bb33bc1a83bb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/DisconnectButtonBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aadc6bf20ea9040b5b527e84c69e71dd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/BLEController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 019114f49d32e4043a60f42f45a97226 3 | timeCreated: 1444471114 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/Utils/MiniJSON.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1159759a5ccf42f3bf3f36d3ea5feac 3 | timeCreated: 1444472999 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/BLEControllerEventHandler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ffc7c5d3a2cfb4faca07200e62f913d8 3 | timeCreated: 1444741393 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/BLEControllerInitializer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0615a0bb59fe04c03b626b56bf047b06 3 | timeCreated: 1444471114 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/AppControllerBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa89589ce06624795b31ed1b1b70fdb6 3 | timeCreated: 1444473947 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/UserInterfaceBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f0c14fab799b4eff93e2780b3f42500 3 | timeCreated: 1444747422 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/ActivityIndicatorUIBehavior.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21677c95d22944f8f90c3c5b44b1f31b 3 | timeCreated: 1444753077 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/SearchBLEDevicesBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a71d9c38f4f74a8d98dc277ff0dc9bd 3 | timeCreated: 1444473947 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/BleDeviceConnectButtonBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cbc0af9d2e60f410f99b76df65c1dbf4 3 | timeCreated: 1444750975 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /AndroidPlugin/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /Arduino/RobotClient/IRSensor.h: -------------------------------------------------------------------------------- 1 | #ifndef IRSensor_h 2 | #define IRSensor_h 3 | 4 | #include "Arduino.h" 5 | 6 | class IRSensor 7 | { 8 | public: 9 | IRSensor(int pin); 10 | int rawValue(void); 11 | byte byteValue(void); 12 | private: 13 | int _pin;//pin number of Arduino that is connected with SIG pin of IR sensor. 14 | int value;//the raw value of the sensor 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/SearchBLEDevicesBehaviour.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class SearchBLEDevicesBehaviour : MonoBehaviour 4 | { 5 | public delegate void SearchBLEDevicesEventDelegate(); 6 | public static event SearchBLEDevicesEventDelegate SearchBLEDevicesEvent; 7 | // Use this for initialization 8 | public void ExecuteSearchBLEDevices() 9 | { 10 | SearchBLEDevicesEvent?.Invoke(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/DisconnectButtonBehaviour.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class DisconnectButtonBehaviour : MonoBehaviour 4 | { 5 | public delegate void DisconnectButtonEventDelegate(); 6 | public static event DisconnectButtonEventDelegate DisconnectButtonEvent; 7 | // Use this for initialization 8 | public void ExecuteDisconnectAction() 9 | { 10 | DisconnectButtonEvent?.Invoke(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/SearchBleDevicesListResultBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17a945ffc8fff4681b01f0972c5c7609 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: 7 | - buttonPrefab: {instanceID: 0} 8 | - buttonsPanel: {instanceID: 0} 9 | - infoMessage: {instanceID: 0} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 0 9 | path: Assets/Scenes/RobotServer.unity 10 | guid: 94e8dad31960b4ecba5c14d14900a7b6 11 | - enabled: 1 12 | path: Assets/Scenes/MeteoStation.unity 13 | guid: e0c8aa9e3d2ae4a83978b0a9b86d477c 14 | m_configObjects: {} 15 | -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play/DESCRIPTION.en_us.html: -------------------------------------------------------------------------------- 1 |

Play is a minimalistic sans serif typeface designed by Jonas Hecksher, Type Director of Playtype™ Type Foundry. All letters in Play derive from the 'O' – square and circular at the same time. Play is designed with large, open counters, ample lowercase x-heights and a corporate, yet friendly appearance. The combination of these qualities give Play both a high legibility and readability.

-------------------------------------------------------------------------------- /AndroidPlugin/app/src/test/java/com/gmurru/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.gmurru; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /AndroidPlugin/bleframework/src/test/java/com/gmurru/bleframework/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.gmurru.bleframework; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play/Play-Bold.ttf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4f6e789ebc194b77962b890ae54b879 3 | timeCreated: 1444290169 4 | licenseType: Free 5 | TrueTypeFontImporter: 6 | serializedVersion: 2 7 | fontSize: 16 8 | forceTextureCase: -2 9 | characterSpacing: 1 10 | characterPadding: 0 11 | includeFontData: 1 12 | use2xBehaviour: 0 13 | fontNames: [] 14 | fallbackFontReferences: [] 15 | customCharacters: 16 | fontRenderingMode: 0 17 | userData: 18 | assetBundleName: 19 | assetBundleVariant: 20 | -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play/Play-Regular.ttf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e9c3f7b8ccb04a1ebde2388d68a6e80 3 | timeCreated: 1444290169 4 | licenseType: Free 5 | TrueTypeFontImporter: 6 | serializedVersion: 2 7 | fontSize: 16 8 | forceTextureCase: -2 9 | characterSpacing: 1 10 | characterPadding: 0 11 | includeFontData: 1 12 | use2xBehaviour: 0 13 | fontNames: [] 14 | fallbackFontReferences: [] 15 | customCharacters: 16 | fontRenderingMode: 0 17 | userData: 18 | assetBundleName: 19 | assetBundleVariant: 20 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/iOS/BLE/BLEFramework.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | extern NSString *const BLEUnityMessageName_OnBleDidInitialize; 5 | extern NSString *const BLEUnityMessageName_OnBleDidCompletePeripheralScan; 6 | extern NSString *const BLEUnityMessageName_OnBleDidConnect; 7 | extern NSString *const BLEUnityMessageName_OnBleDidDisconnect; 8 | extern NSString *const BLEUnityMessageName_OnBleDidReceiveData; 9 | 10 | @interface BLEFrameworkDelegate : NSObject 11 | 12 | @property (readonly, strong, nonatomic) NSData *dataRx; 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_WebSecurityEmulationEnabled: 0 10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d 11 | m_DefaultBehaviorMode: 1 12 | m_SpritePackerMode: 2 13 | m_SpritePackerPaddingPower: 1 14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 15 | m_ProjectGenerationRootNamespace: 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # =============== # 2 | # Unity generated # 3 | # =============== # 4 | Unity/Temp/ 5 | Unity/Library/ 6 | 7 | # ============ # 8 | # OS generated # 9 | # ============ # 10 | .DS_Store 11 | .DS_Store? 12 | ._* 13 | .Spotlight-V100 14 | .Trashes 15 | ehthumbs.db 16 | Thumbs.db 17 | 18 | # ============ # 19 | # Added by me # 20 | # ============ # 21 | Unity/Export/ 22 | AndroidPlugin/gen/ 23 | AndroidPlugin/bin/ 24 | Unity/Assets/Editor/ 25 | _Export/ 26 | 27 | bleframework-release.aar 28 | bleframework-release.aar.meta 29 | 30 | BleFramework/Assets/Editor.meta 31 | BleFramework/Assets/Editor/ -------------------------------------------------------------------------------- /BleFramework/.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Visual Studio cache directory 9 | .vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | *.opendb 26 | 27 | # Unity3D generated meta files 28 | *.pidb.meta 29 | *.pdb.meta 30 | 31 | # Unity3D Generated File On Crash Reports 32 | sysinfo.txt 33 | 34 | # Builds 35 | *.apk 36 | *.unitypackage -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /AndroidPlugin/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /AndroidPlugin/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/BLEControllerInitializer.cs: -------------------------------------------------------------------------------- 1 | namespace BLEFramework.Unity 2 | { 3 | using UnityEngine; 4 | using System.Collections; 5 | 6 | public class BLEControllerInitializer : MonoBehaviour 7 | { 8 | 9 | public static BLEControllerInitializer Instance; 10 | 11 | 12 | void Awake() 13 | { 14 | if(Instance == null) 15 | { 16 | Instance = this; 17 | gameObject.name = "BLEControllerInitializer"; 18 | DontDestroyOnLoad(this.gameObject); 19 | } 20 | else 21 | { 22 | Destroy(this.gameObject); 23 | } 24 | } 25 | 26 | public void InitBLEFramework() 27 | { 28 | BLEController.InitBLEFramework(); 29 | } 30 | 31 | } 32 | } -------------------------------------------------------------------------------- /AndroidPlugin/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.4.1' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /Arduino/RobotClient/IRSensor.cpp: -------------------------------------------------------------------------------- 1 | #include "IRSensor.h" 2 | #include "Arduino.h" 3 | 4 | IRSensor::IRSensor(int pin) 5 | { 6 | _pin = pin; 7 | } 8 | 9 | /*The measured distance from the range 0 to 400 Centimeters*/ 10 | int IRSensor::rawValue(void) 11 | { 12 | int v = analogRead(_pin); 13 | if ( v < 80 ) 14 | { 15 | v = 80; 16 | } 17 | else if ( v > 500 ) 18 | { 19 | v = 500; 20 | } 21 | 22 | return v; 23 | } 24 | 25 | byte IRSensor::byteValue(void) 26 | { 27 | int v = analogRead(_pin); 28 | if ( v < 80 ) 29 | { 30 | v = 80; 31 | } 32 | else if ( v > 500 ) 33 | { 34 | v = 500; 35 | } 36 | byte db = map(v, 80, 500, 1, 254); 37 | return db; 38 | } 39 | -------------------------------------------------------------------------------- /AndroidPlugin/bleframework/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/iOS/BLE/BLEDefines.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 098f1b92914bb447aaf46e9660fead87 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | Any: 13 | second: 14 | enabled: 0 15 | settings: {} 16 | - first: 17 | Editor: Editor 18 | second: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | - first: 23 | iPhone: iOS 24 | second: 25 | enabled: 1 26 | settings: 27 | AddToEmbeddedBinaries: false 28 | userData: 29 | assetBundleName: 30 | assetBundleVariant: 31 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/iOS/BLE/BLEFramework.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d11ea8655866f4e3389521f7ab97558e 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | Any: 13 | second: 14 | enabled: 0 15 | settings: {} 16 | - first: 17 | Editor: Editor 18 | second: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | - first: 23 | iPhone: iOS 24 | second: 25 | enabled: 1 26 | settings: 27 | AddToEmbeddedBinaries: false 28 | userData: 29 | assetBundleName: 30 | assetBundleVariant: 31 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/iOS/BLE/BLEFramework.mm.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7394d7a2a1e29489491be869ce81f2b5 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | Any: 13 | second: 14 | enabled: 0 15 | settings: {} 16 | - first: 17 | Editor: Editor 18 | second: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | - first: 23 | iPhone: iOS 24 | second: 25 | enabled: 1 26 | settings: 27 | AddToEmbeddedBinaries: false 28 | userData: 29 | assetBundleName: 30 | assetBundleVariant: 31 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/ActivityIndicatorUIBehavior.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using UnityEngine.UI; 4 | 5 | public class ActivityIndicatorUIBehavior : MonoBehaviour { 6 | 7 | public Sprite[] animationSprites; 8 | 9 | int currentSprite; 10 | float timeBetweenUpdates; 11 | // Use this for initialization 12 | void Start () { 13 | currentSprite = 0; 14 | timeBetweenUpdates = 0.0f; 15 | } 16 | 17 | // Update is called once per frame 18 | void Update () 19 | { 20 | timeBetweenUpdates += Time.deltaTime; 21 | if ((timeBetweenUpdates) >= 1.0f/15.0f) 22 | { 23 | timeBetweenUpdates = 0.0f; 24 | transform.GetComponent().sprite = animationSprites[currentSprite]; 25 | currentSprite++; 26 | 27 | if (currentSprite >= animationSprites.Length) currentSprite = 0; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AndroidPlugin/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /AndroidPlugin/bleframework/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /AndroidPlugin/app/src/androidTest/java/com/gmurru/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.gmurru; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.InstrumentationRegistry; 6 | import androidx.test.runner.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getTargetContext(); 24 | 25 | assertEquals("com.gmurru", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | m_AutoSimulation: 1 20 | m_AutoSyncTransforms: 1 21 | -------------------------------------------------------------------------------- /AndroidPlugin/bleframework/src/androidTest/java/com/gmurru/bleframework/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.gmurru.bleframework; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.InstrumentationRegistry; 6 | import androidx.test.runner.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getTargetContext(); 24 | 25 | assertEquals("com.gmurru.bleframework.test", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Arduino/RobotClient/CarController.h: -------------------------------------------------------------------------------- 1 | #ifndef CarController_h 2 | #define CarController_h 3 | #include 4 | 5 | #include "Arduino.h" 6 | 7 | class CarController 8 | { 9 | public: 10 | CarController(int frontLeft, int rearLeft, int frontRight, int rearRight); 11 | void Init(); 12 | void SetRightWheelSpeed(int wheelSpeed); 13 | void SetLeftWheelSpeed(int wheelSpeed); 14 | void SetFrontRightWheelSpeed(int wheelSpeed); 15 | void SetFrontLeftWheelSpeed(int wheelSpeed); 16 | void SetRearLeftWheelSpeed(int wheelSpeed); 17 | void SetRearRightWheelSpeed(int wheelSpeed); 18 | void Stop(); 19 | private: 20 | Adafruit_MotorShield _AFMS; 21 | Adafruit_DCMotor *_frontLeftWheelMotor; 22 | Adafruit_DCMotor *_frontRightWheelMotor; 23 | Adafruit_DCMotor *_rearLeftWheelMotor; 24 | Adafruit_DCMotor *_rearRightWheelMotor; 25 | bool _4wd; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /AndroidPlugin/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "28.0.3" 6 | defaultConfig { 7 | applicationId "com.gmurru" 8 | minSdkVersion 18 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | implementation fileTree(dir: 'libs', include: ['*.jar']) 24 | implementation 'androidx.appcompat:appcompat:1.0.2' 25 | testImplementation 'junit:junit:4.12' 26 | androidTestImplementation 'androidx.test:runner:1.2.0' 27 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 28 | } 29 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/BleDeviceConnectButtonBehaviour.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using UnityEngine.UI; 4 | 5 | public class BleDeviceConnectButtonBehaviour : MonoBehaviour { 6 | 7 | 8 | public delegate void BleDevicesListButtonConnectEventDelegate(int buttonIndex); 9 | public static event BleDevicesListButtonConnectEventDelegate BleDevicesListButtonConnectEvent; 10 | 11 | public GameObject buttonTitle; 12 | 13 | public string title; 14 | public int index; 15 | bool needsUpdate = false; 16 | 17 | private void Awake() 18 | { 19 | needsUpdate = true; 20 | } 21 | public void ExecuteBleDevicesListButtonAction() 22 | { 23 | BleDevicesListButtonConnectEvent?.Invoke(index); 24 | } 25 | 26 | void Update() 27 | { 28 | if (needsUpdate) 29 | { 30 | needsUpdate = false; 31 | Debug.Log("Setting button title to:" + title); 32 | buttonTitle.GetComponent().text = title; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-present, Giovanni Murru. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play/METADATA.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Play", 3 | "designer": "Jonas Hecksher", 4 | "license": "OFL", 5 | "visibility": "External", 6 | "category": "Sans Serif", 7 | "size": 65866, 8 | "fonts": [ 9 | { 10 | "name": "Play", 11 | "style": "normal", 12 | "weight": 400, 13 | "filename": "Play-Regular.ttf", 14 | "postScriptName": "Play", 15 | "fullName": "Play", 16 | "copyright": "Copyright (c) 2011 by Jonas Hecksher, Playtypeª, e-types AS (lasse@e-types.com). All rights reserved." 17 | }, 18 | { 19 | "name": "Play", 20 | "style": "normal", 21 | "weight": 700, 22 | "filename": "Play-Bold.ttf", 23 | "postScriptName": "Play-Bold", 24 | "fullName": "Play-Bold", 25 | "copyright": "Copyright (c) 2011 by Jonas Hecksher, Playtype¬ e-types AS (lasse@e-types.com). All rights reserved." 26 | } 27 | ], 28 | "subsets": [ 29 | "cyrillic", 30 | "cyrillic-ext", 31 | "greek", 32 | "greek-ext", 33 | "latin", 34 | "latin-ext", 35 | "menu" 36 | ], 37 | "dateAdded": "2011-05-04" 38 | } 39 | -------------------------------------------------------------------------------- /Arduino/MeteoServer/SparkFun_RHT03.h: -------------------------------------------------------------------------------- 1 | /* SparkFunRHT03.cpp 2 | Jim Lindblom 3 | August 31, 2015 4 | 5 | Ported to Arduino by Shawn Hymel 6 | October 28, 2016 7 | https://github.com/sparkfun/SparkFun_RHT03_Particle_Library 8 | 9 | This is the main header file for the SparkFunRHT03 Particle 10 | library. 11 | 12 | Development environment specifics: 13 | Arduino IDE v1.6.5 14 | Distributed as-is; no warranty is given. 15 | */ 16 | 17 | #include "Arduino.h" 18 | 19 | #define RHT_READ_INTERVAL_MS 1000 20 | 21 | #ifndef RHT03_h 22 | #define RHT03_h 23 | 24 | class RHT03 25 | { 26 | public: 27 | RHT03(); 28 | void begin(int dataPin); 29 | int update(); 30 | float tempC(); 31 | float tempF(); 32 | float humidity(); 33 | 34 | private: 35 | int _dataPin; 36 | int _humidity; 37 | int _temperature; 38 | 39 | enum dataByteLocations { HUMIDITY_H, HUMIDITY_L, TEMP_H, TEMP_L, CHECKSUM }; 40 | 41 | bool checksum(byte check, byte * data, unsigned int datalen); 42 | int errorExit(int code); 43 | bool waitForRHT(int pinState, unsigned int timeout = 1000); 44 | }; 45 | 46 | #endif -------------------------------------------------------------------------------- /AndroidPlugin/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /AndroidPlugin/bleframework/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "28.0.3" 6 | 7 | 8 | defaultConfig { 9 | minSdkVersion 18 10 | targetSdkVersion 28 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | 25 | } 26 | 27 | dependencies { 28 | implementation fileTree(dir: 'libs', include: ['*.jar']) 29 | 30 | implementation 'androidx.appcompat:appcompat:1.0.2' 31 | testImplementation 'junit:junit:4.12' 32 | androidTestImplementation 'androidx.test:runner:1.2.0' 33 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 34 | } 35 | 36 | task copyPlugin(type: Copy) { 37 | dependsOn assemble 38 | from ('build/outputs/aar') 39 | into ('../../BleFramework/Assets/Plugins/Android') 40 | include (project.name + '-release.aar') 41 | } -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshAreas: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/iOS/BLE/BLE.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf30e32cbb89047638eab6b21a21343d 3 | timeCreated: 1444035966 4 | licenseType: Free 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Android: 12 | enabled: 0 13 | settings: 14 | CPU: AnyCPU 15 | Any: 16 | enabled: 0 17 | settings: {} 18 | Editor: 19 | enabled: 0 20 | settings: 21 | CPU: AnyCPU 22 | DefaultValueInitialized: true 23 | OS: AnyOS 24 | Linux: 25 | enabled: 0 26 | settings: 27 | CPU: x86 28 | Linux64: 29 | enabled: 0 30 | settings: 31 | CPU: x86_64 32 | OSXIntel: 33 | enabled: 0 34 | settings: 35 | CPU: AnyCPU 36 | OSXIntel64: 37 | enabled: 0 38 | settings: 39 | CPU: AnyCPU 40 | SamsungTV: 41 | enabled: 0 42 | settings: 43 | STV_MODEL: STANDARD_13 44 | Win: 45 | enabled: 0 46 | settings: 47 | CPU: AnyCPU 48 | Win64: 49 | enabled: 0 50 | settings: 51 | CPU: AnyCPU 52 | iOS: 53 | enabled: 1 54 | settings: 55 | CompileFlags: 56 | FrameworkDependencies: CoreBluetooth; 57 | userData: 58 | assetBundleName: 59 | assetBundleVariant: 60 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/iOS/BLE/BLE.m.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ecb76359e17a433b988f0909df24c1d 3 | timeCreated: 1444035966 4 | licenseType: Free 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Android: 12 | enabled: 0 13 | settings: 14 | CPU: AnyCPU 15 | Any: 16 | enabled: 0 17 | settings: {} 18 | Editor: 19 | enabled: 0 20 | settings: 21 | CPU: AnyCPU 22 | DefaultValueInitialized: true 23 | OS: AnyOS 24 | Linux: 25 | enabled: 0 26 | settings: 27 | CPU: x86 28 | Linux64: 29 | enabled: 0 30 | settings: 31 | CPU: x86_64 32 | OSXIntel: 33 | enabled: 0 34 | settings: 35 | CPU: AnyCPU 36 | OSXIntel64: 37 | enabled: 0 38 | settings: 39 | CPU: AnyCPU 40 | SamsungTV: 41 | enabled: 0 42 | settings: 43 | STV_MODEL: STANDARD_13 44 | Win: 45 | enabled: 0 46 | settings: 47 | CPU: AnyCPU 48 | Win64: 49 | enabled: 0 50 | settings: 51 | CPU: AnyCPU 52 | iOS: 53 | enabled: 1 54 | settings: 55 | CompileFlags: 56 | FrameworkDependencies: CoreBluetooth; 57 | userData: 58 | assetBundleName: 59 | assetBundleVariant: 60 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/UserInterfaceBehaviour.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class UserInterfaceBehaviour : MonoBehaviour { 5 | 6 | public GameObject activityIndicator; 7 | private GameObject activityIndicatorInstance; 8 | 9 | void OnEnable () { 10 | AppControllerBehaviour.ShowActivityIndicatorEvent += HandleShowActivityIndicatorEvent; 11 | AppControllerBehaviour.DestroyActivityIndicatorEvent += HandleDestroyActivityIndicatorEvent; 12 | } 13 | 14 | void HandleShowActivityIndicatorEvent () 15 | { 16 | ShowActivityIndicator(transform); 17 | } 18 | 19 | void HandleDestroyActivityIndicatorEvent () 20 | { 21 | if (activityIndicatorInstance!=null) 22 | { 23 | Destroy(activityIndicatorInstance); 24 | } 25 | } 26 | 27 | void OnDisable () 28 | { 29 | AppControllerBehaviour.ShowActivityIndicatorEvent -= HandleShowActivityIndicatorEvent; 30 | AppControllerBehaviour.DestroyActivityIndicatorEvent -= HandleDestroyActivityIndicatorEvent; 31 | } 32 | 33 | void ShowActivityIndicator(Transform t) 34 | { 35 | if (activityIndicatorInstance!=null) 36 | { 37 | Destroy(activityIndicatorInstance); 38 | } 39 | 40 | activityIndicatorInstance = Instantiate(activityIndicator, new Vector3 (0,0,0), Quaternion.identity) as GameObject; 41 | activityIndicatorInstance.transform.SetParent(transform, false); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /BleFramework/Assets/Sprites/CloseButton.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 771fd18b00be740299311724684d86de 3 | timeCreated: 1444738961 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 0 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -3 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: .5, y: .5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | spritePackingTag: 54 | userData: 55 | assetBundleName: 56 | assetBundleVariant: 57 | -------------------------------------------------------------------------------- /BleFramework/Assets/Sprites/backButton.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 00e8bf01bf1a1462e82c47a1bda73da4 3 | timeCreated: 1444738961 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 0 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -3 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: .5, y: .5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | spritePackingTag: 54 | userData: 55 | assetBundleName: 56 | assetBundleVariant: 57 | -------------------------------------------------------------------------------- /BleFramework/Assets/Sprites/forwardButton.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 444176519ae1d43b0a0257fd0b7af901 3 | timeCreated: 1444738961 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 0 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -3 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: .5, y: .5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | spritePackingTag: 54 | userData: 55 | assetBundleName: 56 | assetBundleVariant: 57 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/iOS/BLE/BLEDefines.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2013 RedBearLab 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 11 | 12 | */ 13 | 14 | // RBL Service 15 | #define RBL_SERVICE_UUID "713D0000-503E-4C75-BA94-3148F18D941E" 16 | #define RBL_CHAR_TX_UUID "713D0002-503E-4C75-BA94-3148F18D941E" 17 | #define RBL_CHAR_RX_UUID "713D0003-503E-4C75-BA94-3148F18D941E" 18 | 19 | #define RBL_BLE_FRAMEWORK_VER 0x0200 20 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/BLEControllerEventHandler.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &159386 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 100100000} 8 | serializedVersion: 4 9 | m_Component: 10 | - 4: {fileID: 404964} 11 | - 114: {fileID: 11470484} 12 | m_Layer: 0 13 | m_Name: BLEControllerEventHandler 14 | m_TagString: Untagged 15 | m_Icon: {fileID: 0} 16 | m_NavMeshLayer: 0 17 | m_StaticEditorFlags: 0 18 | m_IsActive: 1 19 | --- !u!4 &404964 20 | Transform: 21 | m_ObjectHideFlags: 1 22 | m_PrefabParentObject: {fileID: 0} 23 | m_PrefabInternal: {fileID: 100100000} 24 | m_GameObject: {fileID: 159386} 25 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 26 | m_LocalPosition: {x: 0, y: 0, z: 0} 27 | m_LocalScale: {x: 1, y: 1, z: 1} 28 | m_Children: [] 29 | m_Father: {fileID: 0} 30 | m_RootOrder: 0 31 | --- !u!114 &11470484 32 | MonoBehaviour: 33 | m_ObjectHideFlags: 1 34 | m_PrefabParentObject: {fileID: 0} 35 | m_PrefabInternal: {fileID: 100100000} 36 | m_GameObject: {fileID: 159386} 37 | m_Enabled: 1 38 | m_EditorHideFlags: 0 39 | m_Script: {fileID: 11500000, guid: ffc7c5d3a2cfb4faca07200e62f913d8, type: 3} 40 | m_Name: 41 | m_EditorClassIdentifier: 42 | --- !u!1001 &100100000 43 | Prefab: 44 | m_ObjectHideFlags: 1 45 | serializedVersion: 2 46 | m_Modification: 47 | m_TransformParent: {fileID: 0} 48 | m_Modifications: [] 49 | m_RemovedComponents: [] 50 | m_ParentPrefab: {fileID: 0} 51 | m_RootGameObject: {fileID: 159386} 52 | m_IsPrefabParent: 1 53 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/BLEControllerInitializer.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &179558 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 100100000} 8 | serializedVersion: 4 9 | m_Component: 10 | - 4: {fileID: 461190} 11 | - 114: {fileID: 11421116} 12 | m_Layer: 0 13 | m_Name: BLEControllerInitializer 14 | m_TagString: Untagged 15 | m_Icon: {fileID: 0} 16 | m_NavMeshLayer: 0 17 | m_StaticEditorFlags: 0 18 | m_IsActive: 1 19 | --- !u!4 &461190 20 | Transform: 21 | m_ObjectHideFlags: 1 22 | m_PrefabParentObject: {fileID: 0} 23 | m_PrefabInternal: {fileID: 100100000} 24 | m_GameObject: {fileID: 179558} 25 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 26 | m_LocalPosition: {x: 0, y: 0, z: 0} 27 | m_LocalScale: {x: 1, y: 1, z: 1} 28 | m_Children: [] 29 | m_Father: {fileID: 0} 30 | m_RootOrder: 0 31 | --- !u!114 &11421116 32 | MonoBehaviour: 33 | m_ObjectHideFlags: 1 34 | m_PrefabParentObject: {fileID: 0} 35 | m_PrefabInternal: {fileID: 100100000} 36 | m_GameObject: {fileID: 179558} 37 | m_Enabled: 1 38 | m_EditorHideFlags: 0 39 | m_Script: {fileID: 11500000, guid: 0615a0bb59fe04c03b626b56bf047b06, type: 3} 40 | m_Name: 41 | m_EditorClassIdentifier: 42 | --- !u!1001 &100100000 43 | Prefab: 44 | m_ObjectHideFlags: 1 45 | serializedVersion: 2 46 | m_Modification: 47 | m_TransformParent: {fileID: 0} 48 | m_Modifications: [] 49 | m_RemovedComponents: [] 50 | m_ParentPrefab: {fileID: 0} 51 | m_RootGameObject: {fileID: 179558} 52 | m_IsPrefabParent: 1 53 | -------------------------------------------------------------------------------- /BleFramework/Logs/Packages-Update.log: -------------------------------------------------------------------------------- 1 | 2 | === Sat Jun 15 11:18:47 2019 3 | 4 | Packages were changed. 5 | Update Mode: updateDependencies 6 | 7 | The following packages were added: 8 | com.unity.analytics@3.2.2 9 | com.unity.purchasing@2.0.3 10 | com.unity.ads@2.0.8 11 | com.unity.textmeshpro@1.3.0 12 | com.unity.package-manager-ui@2.0.7 13 | com.unity.collab-proxy@1.2.15 14 | com.unity.modules.ai@1.0.0 15 | com.unity.modules.animation@1.0.0 16 | com.unity.modules.assetbundle@1.0.0 17 | com.unity.modules.audio@1.0.0 18 | com.unity.modules.cloth@1.0.0 19 | com.unity.modules.director@1.0.0 20 | com.unity.modules.imageconversion@1.0.0 21 | com.unity.modules.imgui@1.0.0 22 | com.unity.modules.jsonserialize@1.0.0 23 | com.unity.modules.particlesystem@1.0.0 24 | com.unity.modules.physics@1.0.0 25 | com.unity.modules.physics2d@1.0.0 26 | com.unity.modules.screencapture@1.0.0 27 | com.unity.modules.terrain@1.0.0 28 | com.unity.modules.terrainphysics@1.0.0 29 | com.unity.modules.tilemap@1.0.0 30 | com.unity.modules.ui@1.0.0 31 | com.unity.modules.uielements@1.0.0 32 | com.unity.modules.umbra@1.0.0 33 | com.unity.modules.unityanalytics@1.0.0 34 | com.unity.modules.unitywebrequest@1.0.0 35 | com.unity.modules.unitywebrequestassetbundle@1.0.0 36 | com.unity.modules.unitywebrequestaudio@1.0.0 37 | com.unity.modules.unitywebrequesttexture@1.0.0 38 | com.unity.modules.unitywebrequestwww@1.0.0 39 | com.unity.modules.vehicles@1.0.0 40 | com.unity.modules.video@1.0.0 41 | com.unity.modules.vr@1.0.0 42 | com.unity.modules.wind@1.0.0 43 | com.unity.modules.xr@1.0.0 44 | -------------------------------------------------------------------------------- /BleFramework/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ads": "2.0.8", 4 | "com.unity.analytics": "3.2.2", 5 | "com.unity.collab-proxy": "1.2.15", 6 | "com.unity.package-manager-ui": "2.0.7", 7 | "com.unity.purchasing": "2.0.3", 8 | "com.unity.textmeshpro": "1.3.0", 9 | "com.unity.modules.ai": "1.0.0", 10 | "com.unity.modules.animation": "1.0.0", 11 | "com.unity.modules.assetbundle": "1.0.0", 12 | "com.unity.modules.audio": "1.0.0", 13 | "com.unity.modules.cloth": "1.0.0", 14 | "com.unity.modules.director": "1.0.0", 15 | "com.unity.modules.imageconversion": "1.0.0", 16 | "com.unity.modules.imgui": "1.0.0", 17 | "com.unity.modules.jsonserialize": "1.0.0", 18 | "com.unity.modules.particlesystem": "1.0.0", 19 | "com.unity.modules.physics": "1.0.0", 20 | "com.unity.modules.physics2d": "1.0.0", 21 | "com.unity.modules.screencapture": "1.0.0", 22 | "com.unity.modules.terrain": "1.0.0", 23 | "com.unity.modules.terrainphysics": "1.0.0", 24 | "com.unity.modules.tilemap": "1.0.0", 25 | "com.unity.modules.ui": "1.0.0", 26 | "com.unity.modules.uielements": "1.0.0", 27 | "com.unity.modules.umbra": "1.0.0", 28 | "com.unity.modules.unityanalytics": "1.0.0", 29 | "com.unity.modules.unitywebrequest": "1.0.0", 30 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 31 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 32 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 33 | "com.unity.modules.unitywebrequestwww": "1.0.0", 34 | "com.unity.modules.vehicles": "1.0.0", 35 | "com.unity.modules.video": "1.0.0", 36 | "com.unity.modules.vr": "1.0.0", 37 | "com.unity.modules.wind": "1.0.0", 38 | "com.unity.modules.xr": "1.0.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /AndroidPlugin/bleframework/src/main/java/com/gmurru/bleframework/RBLGattAttributes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gmurru.bleframework; 18 | 19 | import java.util.HashMap; 20 | 21 | /** 22 | * This class includes a small subset of standard GATT attributes for 23 | * demonstration purposes. 24 | */ 25 | public class RBLGattAttributes { 26 | private static HashMap attributes = new HashMap(); 27 | public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb"; 28 | public static String BLE_SHIELD_TX = "713d0003-503e-4c75-ba94-3148f18d941e"; 29 | public static String BLE_SHIELD_RX = "713d0002-503e-4c75-ba94-3148f18d941e"; 30 | public static String BLE_SHIELD_SERVICE = "713d0000-503e-4c75-ba94-3148f18d941e"; 31 | 32 | static { 33 | // RBL Services. 34 | attributes.put(BLE_SHIELD_SERVICE, "BLE Shield Service"); 35 | // RBL Characteristics. 36 | attributes.put(BLE_SHIELD_TX, "BLE Shield TX"); 37 | attributes.put(BLE_SHIELD_RX, "BLE Shield RX"); 38 | } 39 | 40 | public static String lookup(String uuid, String defaultName) { 41 | String name = attributes.get(uuid); 42 | return name == null ? defaultName : name; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | BLE framework is a Unity library that you can use to easily manage the Bluetooth communication between your mobile device and a ReadBearLab BLE boards. 2 | The supported boards are: 3 | * BLE Shield 4 | * BLE Mini 5 | * Blend Micro 6 | * Blend 7 | * BLE Nano 8 | * RBL nRF51822 9 | 10 | The ReadBearLab BLE boards can be attached to a micro controller such as Arduino to allow simple wireless serial communication with your mobile device. 11 | 12 | The sample Unity project inside the folder Unity contains two sample scenes to get started using the framework. 13 | 1) RobotServer: build this scene for testing BleMini with Arduino Mega + Adafruit Motor Shield with 4 DC Motors. The code for Arduino is inside the folder Arduino/RobotClient. Read this article for details on how to wire the Adafruit Motor Shield with 4 DC Motors: https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/overview 14 | 2) MeteoStation: build this scene for a sample app for temperature and humidity sensor reading. The hardware setup is BleMini with Arduino Mega + Sparkfun RTH03 sensor. Read this article for details on how to wire the humidity and temperature sensor: https://learn.sparkfun.com/tutorials/rht03-dht22-humidity-and-temperature-sensor-hookup-guide/all 15 | You can find the code for Arduino inside the folder Arduino/MeteoServer. 16 | In both hardware configurations (RobotClient and MeteoServer) the BleMini Rx and Tx pins must be wired respectively to the Tx1 18 and Rx1 19 digital pins of the Arduino Mega 2560. 17 | 18 | Before building the Unity project for Android targets, you need to generate the android plugin using the AndroidPlugin project. You can open this project using Android Studio, then click on Run 'copyPlugin' to generate and copy the plugin in the BleFramework/Assets/Plugin/Android folder. 19 | Now you are ready to build the Unity project for Android targets. 20 | VERY IMPORTANT FOR ANDROID: When running the android example app the first time you have to grant permission for Location in the Android apps settings menu. No popup is prompt asking for permission and you have to grant the Location permission manually. If you don't give Location permission the BLE scan will return empty result. 21 | 22 | As mentioned before Android plugin is generated by the AndroidPlugin Android Studio's project. You can find the code inside the 'bleframework/src' subfolder. 23 | 24 | As regard iOS you can find the plugin source code inside the folder Unity/Assets/Plugins/iOS/BLE. 25 | 26 | If you want to modify the plugins you can just modify the source code in these folders. 27 | -------------------------------------------------------------------------------- /AndroidPlugin/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0} 41 | m_PreloadedShaders: [] 42 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 43 | type: 0} 44 | m_CustomRenderPipeline: {fileID: 0} 45 | m_TransparencySortMode: 0 46 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 47 | m_DefaultRenderingPath: 1 48 | m_DefaultMobileRenderingPath: 1 49 | m_TierSettings: [] 50 | m_LightmapStripping: 0 51 | m_FogStripping: 0 52 | m_InstancingStripping: 0 53 | m_LightmapKeepPlain: 1 54 | m_LightmapKeepDirCombined: 1 55 | m_LightmapKeepDynamicPlain: 1 56 | m_LightmapKeepDynamicDirCombined: 1 57 | m_LightmapKeepShadowMask: 1 58 | m_LightmapKeepSubtractive: 1 59 | m_FogKeepLinear: 1 60 | m_FogKeepExp: 1 61 | m_FogKeepExp2: 1 62 | m_AlbedoSwatchInfos: [] 63 | m_LightsUseLinearIntensity: 0 64 | m_LightsUseColorTemperature: 0 65 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/SearchBleDevicesListResultBehaviour.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using BLEFramework.Unity; 5 | using UnityEngine.UI; 6 | 7 | public class SearchBleDevicesListResultBehaviour : MonoBehaviour { 8 | 9 | public GameObject buttonPrefab; 10 | public GameObject buttonsPanel; 11 | public GameObject infoMessage; 12 | 13 | void OnEnable() 14 | { 15 | BLEControllerEventHandler.OnBleDidCompletePeripheralScanEvent += HandleOnBleDidCompletePeripheralScanEvent; 16 | AppControllerBehaviour.DidStartPeripheralScanEvent += HandleDidStartPeripheralScanEvent; 17 | BLEControllerEventHandler.OnBleDidConnectEvent += HandleOnBleDidConnectEvent; 18 | } 19 | 20 | void HandleOnBleDidConnectEvent (string errorMessage) 21 | { 22 | if (errorMessage == null) 23 | { 24 | RemoveButtons(); 25 | } 26 | } 27 | 28 | void HandleOnBleDidCompletePeripheralScanEvent (List peripherals, string errorMessage) 29 | { 30 | if (errorMessage == null) 31 | { 32 | CreateConnectButtonsFor(peripherals); 33 | } 34 | } 35 | 36 | void OnDisable() 37 | { 38 | BLEControllerEventHandler.OnBleDidCompletePeripheralScanEvent -= HandleOnBleDidCompletePeripheralScanEvent; 39 | AppControllerBehaviour.DidStartPeripheralScanEvent -= HandleDidStartPeripheralScanEvent; 40 | BLEControllerEventHandler.OnBleDidConnectEvent -= HandleOnBleDidConnectEvent; 41 | } 42 | 43 | 44 | void RemoveButtons() 45 | { 46 | //remove the buttons from the panel to make the room for the new buttons that will come 47 | foreach (Transform t in buttonsPanel.transform) 48 | { 49 | Destroy(t.gameObject); 50 | } 51 | } 52 | void HandleDidStartPeripheralScanEvent () 53 | { 54 | RemoveButtons(); 55 | } 56 | 57 | 58 | void CreateConnectButtonsFor(List peripherals) 59 | { 60 | int j = 0; 61 | 62 | foreach (string s in peripherals) 63 | { 64 | GameObject instanceRow = Instantiate(buttonPrefab, new Vector3 (0.0f,j*150.0f,0.0f), Quaternion.identity) as GameObject; 65 | instanceRow.GetComponent().title = s; 66 | instanceRow.GetComponent().index = j; 67 | instanceRow.transform.SetParent(buttonsPanel.transform, false); 68 | j++; 69 | } 70 | 71 | // This part of code creates a bug on UI 72 | // TODO: when you add buttons you change the panel size and should update the scrollview content. 73 | //Rect panelRect = buttonsPanel.GetComponent().rect; 74 | //float minimumPanelHeight = j * 150.0f; 75 | //float panelHeight = panelRect.height < minimumPanelHeight ? minimumPanelHeight : panelRect.height; 76 | //buttonsPanel.GetComponent().sizeDelta = new Vector2(panelRect.width, panelHeight); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/RobotServerBehaviour.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using BLEFramework.Unity; 5 | 6 | public class RobotServerBehaviour : MonoBehaviour 7 | { 8 | private byte[] lastCommand; 9 | 10 | private byte[] resetCommand = { 0xfe, 0xfe, 0xfe }; 11 | private byte[][] listOfCommands = { 12 | new byte[] { 0x11, 0x00, 0xff }, // left command 13 | new byte[] { 0x11, 0xff, 0x00 }, // right command 14 | new byte[] { 0x11, 0xff, 0xff }, // forward command 15 | new byte[] { 0x11, 0x00, 0x00 } // stop command 16 | }; 17 | 18 | private int currentCommandIndex; 19 | 20 | private bool isTrasmissionActive; 21 | 22 | private Coroutine transmissionCoroutine; 23 | 24 | private void OnEnable() 25 | { 26 | AppControllerBehaviour.DidReceiveDataEvent += HandleDidReceiveDataEvent; 27 | AppControllerBehaviour.ConnectionEstablishedEvent += HandleConnectionEstablishedEvent; 28 | AppControllerBehaviour.ConnectionLostEvent += HandleConnectionLostEvent; 29 | } 30 | 31 | private void OnDisable() 32 | { 33 | AppControllerBehaviour.DidReceiveDataEvent -= HandleDidReceiveDataEvent; 34 | AppControllerBehaviour.ConnectionEstablishedEvent -= HandleConnectionEstablishedEvent; 35 | AppControllerBehaviour.ConnectionLostEvent -= HandleConnectionLostEvent; 36 | } 37 | private void Awake() 38 | { 39 | currentCommandIndex = 0; 40 | } 41 | 42 | IEnumerator SendLastCommandAfterDelay(int delay) 43 | { 44 | yield return new WaitForSeconds(delay); 45 | BLEController.SendData(lastCommand); 46 | } 47 | 48 | void HandleDidReceiveDataEvent(byte[] data, int numOfBytes) 49 | { 50 | Debug.Log("AppControllerBehavior: HandleOnBleDidReceiveDataEvent: size: " + numOfBytes); 51 | 52 | if (numOfBytes == 1 && data[0] == 0xfe) 53 | { 54 | Debug.Log("Command correctly received. Can send next command."); 55 | if (currentCommandIndex >= listOfCommands.Length) { currentCommandIndex = 0; } 56 | lastCommand = listOfCommands[currentCommandIndex]; 57 | currentCommandIndex += 1; 58 | //send last command in 3 seconds! 59 | if (isTrasmissionActive) 60 | { 61 | transmissionCoroutine = StartCoroutine(SendLastCommandAfterDelay(3)); 62 | } 63 | } 64 | else if (isTrasmissionActive && numOfBytes == 1 && data[0] == 0xdf) 65 | { 66 | Debug.Log("There was an error sending the command. Retry to send last command."); 67 | BLEController.SendData(lastCommand); 68 | } 69 | } 70 | 71 | void HandleConnectionEstablishedEvent() 72 | { 73 | lastCommand = resetCommand; 74 | isTrasmissionActive = true; 75 | BLEController.SendData(lastCommand); 76 | } 77 | 78 | void HandleConnectionLostEvent() 79 | { 80 | isTrasmissionActive = false; 81 | StopCoroutine(transmissionCoroutine); 82 | } 83 | 84 | public void StopRobot() 85 | { 86 | isTrasmissionActive = false; 87 | BLEController.SendData(resetCommand); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /BleFramework/Assets/Plugins/iOS/BLE/BLE.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright (c) 2013 RedBearLab 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 11 | 12 | */ 13 | 14 | #import 15 | #if TARGET_OS_IPHONE 16 | #import 17 | #else 18 | #import 19 | #endif 20 | 21 | @protocol BLEDelegate 22 | @optional 23 | -(void) bleDidConnect; 24 | -(void) bleDidDisconnect; 25 | -(void) bleDidUpdateRSSI:(NSNumber *) rssi; 26 | -(void) bleDidReceiveData:(unsigned char *) data length:(int) length; 27 | -(void) bleDidChangeState: (CBManagerState) state; 28 | @required 29 | @end 30 | 31 | @interface BLE : NSObject { 32 | 33 | } 34 | 35 | @property (nonatomic,assign) id delegate; 36 | @property (strong, nonatomic) NSMutableArray *peripherals; 37 | @property (strong, nonatomic) CBCentralManager *CM; 38 | @property (strong, nonatomic) CBPeripheral *activePeripheral; 39 | 40 | -(void) enableReadNotification:(CBPeripheral *)p; 41 | -(void) read; 42 | -(void) writeValue:(CBUUID *)serviceUUID characteristicUUID:(CBUUID *)characteristicUUID p:(CBPeripheral *)p data:(NSData *)data; 43 | 44 | -(BOOL) isConnected; 45 | -(void) write:(NSData *)d; 46 | -(void) readRSSI; 47 | 48 | -(void) controlSetup; 49 | -(int) findBLEPeripherals:(int) timeout; 50 | -(void) connectPeripheral:(CBPeripheral *)peripheral; 51 | -(void) disconnect; 52 | 53 | -(UInt16) swap:(UInt16) s; 54 | -(const char *) centralManagerStateToString:(int)state; 55 | -(void) scanTimer:(NSTimer *)timer; 56 | -(void) printKnownPeripherals; 57 | -(void) printPeripheralInfo:(CBPeripheral*)peripheral; 58 | 59 | -(void) getAllServicesFromPeripheral:(CBPeripheral *)p; 60 | -(void) getAllCharacteristicsFromPeripheral:(CBPeripheral *)p; 61 | -(CBService *) findServiceFromUUID:(CBUUID *)UUID p:(CBPeripheral *)p; 62 | -(CBCharacteristic *) findCharacteristicFromUUID:(CBUUID *)UUID service:(CBService*)service; 63 | 64 | //-(NSString *) NSUUIDToString:(NSUUID *) UUID; 65 | -(NSString *) CBUUIDToString:(CBUUID *) UUID; 66 | 67 | -(int) compareCBUUID:(CBUUID *) UUID1 UUID2:(CBUUID *)UUID2; 68 | -(int) compareCBUUIDToInt:(CBUUID *) UUID1 UUID2:(UInt16)UUID2; 69 | -(UInt16) CBUUIDToInt:(CBUUID *) UUID; 70 | -(BOOL) UUIDSAreEqual:(NSUUID *)UUID1 UUID2:(NSUUID *)UUID2; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Arduino/RobotClient/RobotClient.ino: -------------------------------------------------------------------------------- 1 | #include "CarController.h" 2 | #include "Wire.h" 3 | #include 4 | #include "utility/Adafruit_MS_PWMServoDriver.h" 5 | 6 | CarController carController(4, 1, 3, 2); 7 | int loopCounter; 8 | //boolean readyForNewCommand; 9 | 10 | void setup() { 11 | // put your setup code here, to run once: 12 | Serial.begin(9600); 13 | Serial1.begin(57600); 14 | 15 | carController.Init(); 16 | //readyForNewCommand = true; 17 | Serial.println("Ready"); 18 | //randomSeed(analogRead(1)); 19 | loopCounter = 0; 20 | } 21 | 22 | bool isValidVelocityCommand(int command) { 23 | return command >= 0 && command <= 0xff; 24 | } 25 | 26 | void loop() 27 | { 28 | Serial.print("start loop "); 29 | Serial.println(loopCounter, DEC); 30 | Serial.println("waiting for a command"); 31 | while(Serial1.available()!=3); 32 | Serial.println("command received"); 33 | byte receivedBytes[3]; 34 | Serial1.readBytes(receivedBytes, sizeof(byte)*3); 35 | byte commandByte = receivedBytes[0]; 36 | /* 37 | Possible command bytes: 38 | 0x11 pos pos velocities 39 | 0x1f pos neg velocities 40 | 0xff neg neg velocities 41 | 0xf1 neg pos velocities 42 | */ 43 | int leftWheelVelocity = (int) receivedBytes[1]; 44 | int rightWheelVelocity = (int)receivedBytes[2]; 45 | 46 | boolean speedValueReceived = false; 47 | boolean resetReceived = false; 48 | // Check is the received speed is valid 49 | if (isValidVelocityCommand(leftWheelVelocity) && isValidVelocityCommand(rightWheelVelocity)) { 50 | //action based on the command 51 | if (commandByte == 0xfe) 52 | { 53 | if (receivedBytes[1] == 0xfe && receivedBytes[2]== 0xfe) 54 | { 55 | //RESET 56 | Serial.println("I received the reset command. Stop the Car."); 57 | carController.Stop(); 58 | resetReceived = true; 59 | } else { 60 | Serial.println("Unknown command"); 61 | } 62 | } 63 | else if (commandByte == 0x11) // left and right are positive velocities 64 | { 65 | speedValueReceived = true; 66 | } 67 | else if (commandByte == 0x1f) //left is positive velocity and right is negative velocity 68 | { 69 | rightWheelVelocity = -rightWheelVelocity; 70 | speedValueReceived = true; 71 | } 72 | else if (commandByte == 0xff) // left and right are negative velocities 73 | { 74 | leftWheelVelocity = -leftWheelVelocity; 75 | rightWheelVelocity = -rightWheelVelocity; 76 | speedValueReceived = true; 77 | } 78 | else if (commandByte = 0xf1) // left is negative velocity and right is positive velocity 79 | { 80 | leftWheelVelocity = -leftWheelVelocity; 81 | speedValueReceived = true; 82 | } 83 | } 84 | 85 | 86 | byte ackData[1]; 87 | if (speedValueReceived) 88 | { 89 | carController.SetRightWheelSpeed(rightWheelVelocity); 90 | carController.SetLeftWheelSpeed(leftWheelVelocity); 91 | ackData[0] = 0xfe; // signal success 92 | } else if (resetReceived) { 93 | Serial.print("prepare ackData packet"); 94 | ackData[0] = 0xfe; // signal success 95 | } else { 96 | ackData[0] = 0xdf; // signal an error (server should retry sending the data) 97 | } 98 | 99 | Serial.print("send ackData packet"); 100 | Serial1.write(ackData, 1); 101 | 102 | Serial.print("end loop "); 103 | Serial.println(loopCounter, DEC); 104 | loopCounter++; 105 | } 106 | -------------------------------------------------------------------------------- /Arduino/RobotClient/CarController.cpp: -------------------------------------------------------------------------------- 1 | #include "CarController.h" 2 | #include "Arduino.h" 3 | 4 | CarController::CarController(int frontLeft, int rearLeft, int frontRight, int rearRight) 5 | { 6 | // Create the motor shield object with the default I2C address 7 | _AFMS = Adafruit_MotorShield(); 8 | 9 | _4wd = true; 10 | // Or, create it with a different I2C address (say for stacking) 11 | // Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); 12 | 13 | // Select which 'port' M1, M2, M3 or M4. In this case, M1 14 | _frontLeftWheelMotor = _AFMS.getMotor(frontLeft); 15 | // You can also make another motor on port M2 16 | _frontRightWheelMotor = _AFMS.getMotor(frontRight); 17 | 18 | _rearLeftWheelMotor = _AFMS.getMotor(rearLeft); 19 | _rearRightWheelMotor = _AFMS.getMotor(rearRight); 20 | } 21 | 22 | void CarController::Init() 23 | { 24 | _AFMS.begin(); // create with the default frequency 1.6KHz 25 | } 26 | 27 | void CarController::SetRearRightWheelSpeed(int wheelSpeed) 28 | { 29 | //do something 30 | if (wheelSpeed > 0) 31 | { 32 | _rearRightWheelMotor->run(FORWARD); 33 | _rearRightWheelMotor->setSpeed(wheelSpeed); 34 | 35 | } 36 | else if (wheelSpeed < 0) 37 | { 38 | _rearRightWheelMotor->run(BACKWARD); 39 | _rearRightWheelMotor->setSpeed(-wheelSpeed); 40 | } 41 | else 42 | { 43 | _rearRightWheelMotor->run(RELEASE); 44 | } 45 | } 46 | 47 | void CarController::SetRearLeftWheelSpeed(int wheelSpeed) 48 | { 49 | //do something 50 | if (wheelSpeed > 0) 51 | { 52 | _rearLeftWheelMotor->run(FORWARD); 53 | _rearLeftWheelMotor->setSpeed(wheelSpeed); 54 | 55 | } 56 | else if (wheelSpeed < 0) 57 | { 58 | _rearLeftWheelMotor->run(BACKWARD); 59 | _rearLeftWheelMotor->setSpeed(-wheelSpeed); 60 | } 61 | else 62 | { 63 | _rearLeftWheelMotor->run(RELEASE); 64 | } 65 | } 66 | 67 | void CarController::SetFrontLeftWheelSpeed(int wheelSpeed) 68 | { 69 | //do something 70 | if (wheelSpeed > 0) 71 | { 72 | _frontLeftWheelMotor->run(FORWARD); 73 | _frontLeftWheelMotor->setSpeed(wheelSpeed); 74 | 75 | } 76 | else if (wheelSpeed < 0) 77 | { 78 | _frontLeftWheelMotor->run(BACKWARD); 79 | _frontLeftWheelMotor->setSpeed(-wheelSpeed); 80 | } 81 | else 82 | { 83 | _frontLeftWheelMotor->run(RELEASE); 84 | } 85 | } 86 | 87 | 88 | void CarController::SetFrontRightWheelSpeed(int wheelSpeed) 89 | { 90 | //do something 91 | if (wheelSpeed > 0) 92 | { 93 | _frontRightWheelMotor->run(FORWARD); 94 | _frontRightWheelMotor->setSpeed(wheelSpeed); 95 | 96 | } 97 | else if (wheelSpeed < 0) 98 | { 99 | _frontRightWheelMotor->run(BACKWARD); 100 | _frontRightWheelMotor->setSpeed(-wheelSpeed); 101 | } 102 | else 103 | { 104 | _frontRightWheelMotor->run(RELEASE); 105 | } 106 | } 107 | 108 | void CarController::SetRightWheelSpeed(int wheelSpeed) 109 | { 110 | SetFrontRightWheelSpeed(wheelSpeed); 111 | SetRearRightWheelSpeed(wheelSpeed); 112 | } 113 | 114 | void CarController::SetLeftWheelSpeed(int wheelSpeed) 115 | { 116 | SetFrontLeftWheelSpeed(wheelSpeed); 117 | SetRearLeftWheelSpeed(wheelSpeed); 118 | } 119 | void CarController::Stop() 120 | { 121 | _frontLeftWheelMotor->run(RELEASE); 122 | _frontRightWheelMotor->run(RELEASE); 123 | _rearLeftWheelMotor->run(RELEASE); 124 | _rearRightWheelMotor->run(RELEASE); 125 | } 126 | -------------------------------------------------------------------------------- /Arduino/MeteoServer/SparkFun_RHT03.cpp: -------------------------------------------------------------------------------- 1 | /* SparkFunRHT03.cpp 2 | Jim Lindblom 3 | August 31, 2015 4 | 5 | Ported to Arduino by Shawn Hymel 6 | October 28, 2016 7 | https://github.com/sparkfun/SparkFun_RHT03_Arduino_Library 8 | 9 | This is the main source file for the SparkFunRHT03 Arduino 10 | library. 11 | 12 | Development environment specifics: 13 | Arduino IDE v1.6.5 14 | Distributed as-is; no warranty is given. 15 | */ 16 | 17 | #include "SparkFun_RHT03.h" 18 | 19 | RHT03::RHT03() 20 | { 21 | } 22 | 23 | void RHT03::begin(int dataPin) 24 | { 25 | _dataPin = dataPin; 26 | pinMode(_dataPin, INPUT_PULLUP); 27 | } 28 | 29 | float RHT03::tempC() 30 | { 31 | return (float) _temperature / 10.0; 32 | } 33 | 34 | float RHT03::tempF() 35 | { 36 | return (tempC() * 9.0 / 5.0 + 32.0); 37 | } 38 | 39 | float RHT03::humidity() 40 | { 41 | return (float) _humidity / 10.0; 42 | } 43 | 44 | int RHT03::update() 45 | { 46 | unsigned long marks[41] = {0}; 47 | unsigned long stops[40] = {0}; 48 | unsigned int highTime, lowTime; 49 | byte dataBytes[5] = {0}; 50 | 51 | noInterrupts(); 52 | 53 | // Begin state: input HIGH 54 | pinMode(_dataPin, INPUT_PULLUP); 55 | delay(100); 56 | // Start signal: host sets data low, waits 1 ms, then pulls back up, wait 20-40us 57 | pinMode(_dataPin, OUTPUT); 58 | digitalWrite(_dataPin, LOW); 59 | delay(2); // Wait 1 ms minimum 60 | pinMode(_dataPin, INPUT_PULLUP); 61 | delayMicroseconds(20); 62 | // Sensor should pull data pin low 80us, then pull back up 63 | if (! waitForRHT(LOW, 1000) ) 64 | return errorExit(0); 65 | if (! waitForRHT(HIGH, 1000) ) 66 | return errorExit(0); 67 | 68 | // Sensor transmits 40 bytes (16 rh, 16 temp, 8 checksum) 69 | // Each byte starts with a ~50us LOW then a HIGH pulse. The duration of the 70 | // HIGH pulse determines the value of the bit. 71 | // LOW: 26-28us (LOW duration) 73 | for (int i=0; i<40; i++) 74 | { 75 | if (! waitForRHT(LOW, 1000) ) 76 | return errorExit(-i); 77 | marks[i] = micros(); 78 | if (! waitForRHT(HIGH, 1000) ) 79 | return errorExit(-i); 80 | stops[i] = micros(); 81 | } 82 | if (! waitForRHT(LOW, 1000) ) 83 | return errorExit(-41); 84 | marks[40] = micros(); 85 | 86 | interrupts(); 87 | 88 | for (int i=0; i<40; i++) 89 | { 90 | lowTime = stops[i] - marks[i]; 91 | highTime = marks[i + 1] - stops[i]; 92 | if (highTime > lowTime) 93 | { 94 | dataBytes[i/8] |= (1<<(7 - i%8)); 95 | } 96 | } 97 | 98 | if (checksum(dataBytes[CHECKSUM], dataBytes, 4)) 99 | { 100 | _humidity = ((uint16_t) dataBytes[HUMIDITY_H] << 8) | dataBytes[HUMIDITY_L]; 101 | _temperature = ((uint16_t) dataBytes[TEMP_H] << 8) | dataBytes[TEMP_L]; 102 | return 1; 103 | } 104 | else 105 | { 106 | return -43; 107 | } 108 | } 109 | 110 | bool RHT03::checksum(byte check, byte * data, unsigned int datalen) 111 | { 112 | byte sum = 0; 113 | for (int i=0; i= timeout) 136 | return false; 137 | else 138 | return true; 139 | } -------------------------------------------------------------------------------- /BleFramework/Assets/Prefabs/Activity Indicator UI.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &125174 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 100100000} 8 | serializedVersion: 4 9 | m_Component: 10 | - 224: {fileID: 22425174} 11 | - 222: {fileID: 22279744} 12 | - 114: {fileID: 11479746} 13 | - 114: {fileID: 11479744} 14 | m_Layer: 0 15 | m_Name: Activity Indicator UI 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!114 &11479744 22 | MonoBehaviour: 23 | m_ObjectHideFlags: 1 24 | m_PrefabParentObject: {fileID: 0} 25 | m_PrefabInternal: {fileID: 100100000} 26 | m_GameObject: {fileID: 125174} 27 | m_Enabled: 1 28 | m_EditorHideFlags: 0 29 | m_Script: {fileID: 11500000, guid: 21677c95d22944f8f90c3c5b44b1f31b, type: 3} 30 | m_Name: 31 | m_EditorClassIdentifier: 32 | animationSprites: 33 | - {fileID: 21300000, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 34 | - {fileID: 21300002, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 35 | - {fileID: 21300004, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 36 | - {fileID: 21300006, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 37 | - {fileID: 21300008, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 38 | - {fileID: 21300010, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 39 | - {fileID: 21300012, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 40 | - {fileID: 21300014, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 41 | - {fileID: 21300016, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 42 | - {fileID: 21300018, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 43 | - {fileID: 21300020, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 44 | - {fileID: 21300022, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 45 | --- !u!114 &11479746 46 | MonoBehaviour: 47 | m_ObjectHideFlags: 1 48 | m_PrefabParentObject: {fileID: 0} 49 | m_PrefabInternal: {fileID: 100100000} 50 | m_GameObject: {fileID: 125174} 51 | m_Enabled: 1 52 | m_EditorHideFlags: 0 53 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 54 | m_Name: 55 | m_EditorClassIdentifier: 56 | m_Material: {fileID: 0} 57 | m_Color: {r: 1, g: 1, b: 1, a: 1} 58 | m_RaycastTarget: 1 59 | m_OnCullStateChanged: 60 | m_PersistentCalls: 61 | m_Calls: [] 62 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 63 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 64 | m_Sprite: {fileID: 21300000, guid: 8a5cca0a375114dce9988d39df7ce902, type: 3} 65 | m_Type: 0 66 | m_PreserveAspect: 1 67 | m_FillCenter: 1 68 | m_FillMethod: 4 69 | m_FillAmount: 1 70 | m_FillClockwise: 1 71 | m_FillOrigin: 0 72 | --- !u!222 &22279744 73 | CanvasRenderer: 74 | m_ObjectHideFlags: 1 75 | m_PrefabParentObject: {fileID: 0} 76 | m_PrefabInternal: {fileID: 100100000} 77 | m_GameObject: {fileID: 125174} 78 | --- !u!224 &22425174 79 | RectTransform: 80 | m_ObjectHideFlags: 1 81 | m_PrefabParentObject: {fileID: 0} 82 | m_PrefabInternal: {fileID: 100100000} 83 | m_GameObject: {fileID: 125174} 84 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 85 | m_LocalPosition: {x: 0, y: 0, z: 0} 86 | m_LocalScale: {x: .5, y: .5, z: 1} 87 | m_Children: [] 88 | m_Father: {fileID: 0} 89 | m_RootOrder: 0 90 | m_AnchorMin: {x: .5, y: .5} 91 | m_AnchorMax: {x: .5, y: .5} 92 | m_AnchoredPosition: {x: 0, y: 0} 93 | m_SizeDelta: {x: 96, y: 96} 94 | m_Pivot: {x: .5, y: .5} 95 | --- !u!1001 &100100000 96 | Prefab: 97 | m_ObjectHideFlags: 1 98 | serializedVersion: 2 99 | m_Modification: 100 | m_TransformParent: {fileID: 0} 101 | m_Modifications: [] 102 | m_RemovedComponents: [] 103 | m_ParentPrefab: {fileID: 0} 104 | m_RootGameObject: {fileID: 125174} 105 | m_IsPrefabParent: 1 106 | -------------------------------------------------------------------------------- /BleFramework/Assets/BLE/BLEControllerEventHandler.cs: -------------------------------------------------------------------------------- 1 | namespace BLEFramework.Unity 2 | { 3 | using UnityEngine; 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | using BLEFramework.MiniJSON; 7 | 8 | public class BLEControllerEventHandler : MonoBehaviour { 9 | 10 | 11 | 12 | //native events 13 | public delegate void OnBleDidConnectEventDelegate(string error); 14 | public static event OnBleDidConnectEventDelegate OnBleDidConnectEvent; 15 | 16 | public delegate void OnBleDidDisconnectEventDelegate(string error); 17 | public static event OnBleDidDisconnectEventDelegate OnBleDidDisconnectEvent; 18 | 19 | public delegate void OnBleDidReceiveDataEventDelegate(byte[] data, int numOfBytes); 20 | public static event OnBleDidReceiveDataEventDelegate OnBleDidReceiveDataEvent; 21 | 22 | public delegate void OnBleDidInitializeEventDelegate(string error); 23 | public static event OnBleDidInitializeEventDelegate OnBleDidInitializeEvent; 24 | 25 | public delegate void OnBleDidCompletePeripheralScanEventDelegate(List peripherals, string error); 26 | public static event OnBleDidCompletePeripheralScanEventDelegate OnBleDidCompletePeripheralScanEvent; 27 | 28 | 29 | //Instance methods used by iOS Unity Send Message 30 | void OnBleDidInitializeMessage(string message) 31 | { 32 | BLEControllerEventHandler.OnBleDidInitialize(message); 33 | } 34 | 35 | public static void OnBleDidInitialize(string message) 36 | { 37 | string errorMessage = message != "Success" ? message : null; 38 | OnBleDidInitializeEvent?.Invoke(errorMessage); 39 | } 40 | 41 | 42 | void OnBleDidConnectMessage(string message) 43 | { 44 | BLEControllerEventHandler.OnBleDidConnect(message); 45 | } 46 | public static void OnBleDidConnect(string message) 47 | { 48 | string errorMessage = message != "Success" ? message : null; 49 | OnBleDidConnectEvent?.Invoke(errorMessage); 50 | } 51 | 52 | void OnBleDidDisconnectMessage(string message) 53 | { 54 | BLEControllerEventHandler.OnBleDidDisconnect(message); 55 | } 56 | public static void OnBleDidDisconnect(string message) 57 | { 58 | string errorMessage = message != "Success" ? message : null; 59 | OnBleDidDisconnectEvent?.Invoke(errorMessage); 60 | } 61 | 62 | void OnBleDidReceiveDataMessage(string message) 63 | { 64 | BLEControllerEventHandler.OnBleDidReceiveData(message); 65 | } 66 | public static void OnBleDidReceiveData(string message) 67 | { 68 | int numOfBytes = 0; 69 | if (int.TryParse(message, out numOfBytes)) 70 | { 71 | if (numOfBytes != 0) 72 | { 73 | Debug.Log("BLEController.GetData(); start"); 74 | byte[] data = BLEController.GetData(numOfBytes); 75 | Debug.Log("BLEController.GetData(); end"); 76 | OnBleDidReceiveDataEvent?.Invoke(data, numOfBytes); 77 | } else 78 | { 79 | Debug.Log("WARNING: did receive OnBleDidReceiveData even if numOfBytes is zero"); 80 | } 81 | } 82 | } 83 | 84 | void OnBleDidCompletePeripheralScanMessage(string message) 85 | { 86 | BLEControllerEventHandler.OnBleDidCompletePeripheralScan(message); 87 | } 88 | public static void OnBleDidCompletePeripheralScan(string message) 89 | { 90 | string errorMessage = message != "Success" ? message : null; 91 | List peripheralsList = new List(); 92 | string peripheralJsonList = (errorMessage == null) ? BLEController.GetListOfDevices() : null; 93 | if (peripheralJsonList != null) 94 | { 95 | Dictionary dictObject = Json.Deserialize(peripheralJsonList) as Dictionary; 96 | 97 | object receivedByteDataArray; 98 | if (dictObject.TryGetValue("data", out receivedByteDataArray)) 99 | { 100 | peripheralsList = (List)receivedByteDataArray; 101 | } 102 | } 103 | 104 | OnBleDidCompletePeripheralScanEvent?.Invoke(peripheralsList, errorMessage); 105 | } 106 | } 107 | } -------------------------------------------------------------------------------- /Arduino/MeteoServer/MeteoServer.ino: -------------------------------------------------------------------------------- 1 | /* RHT03-Example-Serial.cpp 2 | Jim Lindblom 3 | August 31, 2015 4 | 5 | Ported to Arduino by Shawn Hymel 6 | October 28, 2016 7 | https://github.com/sparkfun/SparkFun_RHT03_Arduino_Library 8 | 9 | This a simple example sketch for the SparkFunRHT03 Ardiuno 10 | library. 11 | 12 | Looking at the front (grated side) of the RHT03, the pinout is as follows: 13 | 1 2 3 4 14 | VCC DATA No-Connect GND 15 | 16 | Connect the data pin to Arduino pin D4. Power the RHT03 off the 3.3V bus. 17 | 18 | A 10k pullup resistor can be added to the data pin, though it seems to 19 | work without it. 20 | 21 | Development environment specifics: 22 | Arduino IDE v1.6.5 23 | Distributed as-is; no warranty is given. 24 | */ 25 | 26 | // Include the library: 27 | #include "SparkFun_RHT03.h" 28 | ///////////////////// 29 | // Pin Definitions // 30 | ///////////////////// 31 | const int RHT03_DATA_PIN = 40; // RHT03 data pin 32 | 33 | /////////////////////////// 34 | // RHT03 Object Creation // 35 | /////////////////////////// 36 | RHT03 rht; // This creates a RTH03 object, which we'll use to interact with the sensor 37 | 38 | bool ble_active = false; 39 | float latestHumidity = 0.0; 40 | float latestTempC = 0.0; 41 | 42 | void setup() 43 | { 44 | Serial.begin(9600); // Serial is used to print sensor readings. 45 | Serial1.begin(57600); 46 | // Call rht.begin() to initialize the sensor and our data pin 47 | rht.begin(RHT03_DATA_PIN); 48 | 49 | } 50 | 51 | void loop() 52 | { 53 | int updateRet = rht.update(); 54 | 55 | // If successful, the update() function will return 1. 56 | // If update fails, it will return a value <0 57 | if (updateRet == 1) 58 | { 59 | Serial.println("reading temperature and humidity levels"); 60 | // The humidity(), tempC(), and tempF() functions can be called -- after 61 | // a successful update() -- to get the last humidity and temperature 62 | 63 | // value 64 | latestHumidity = rht.humidity(); 65 | latestTempC = rht.tempC(); 66 | Serial.println("Humidity: " + String(latestHumidity, 1) + " %"); 67 | Serial.println("Temp (C): " + String(latestTempC, 1) + " deg C"); 68 | 69 | if(Serial1.available()!=3) { 70 | delay(1000); 71 | return; 72 | } 73 | Serial.println("command received"); 74 | byte receivedBytes[3]; 75 | Serial1.readBytes(receivedBytes, sizeof(byte)*3); 76 | 77 | byte meteoData[3]; 78 | if (receivedBytes[0] == 0xfe && receivedBytes[1] == 0xfe && receivedBytes[2]== 0xfe) 79 | { 80 | Serial.println("start data transmission"); 81 | // Start Data transmission 82 | ble_active = true; 83 | //Note: this is a default value for the meteoData to be transmitted if the rht.update() fails 84 | //Real meteoData will be set later. 85 | meteoData[0] = 0x33; 86 | meteoData[1] = 0x33; 87 | meteoData[2] = 0x33; 88 | } else if (receivedBytes[0] == 0x01 && receivedBytes[1] == 0x02 && receivedBytes[2]== 0x03) { 89 | // Stop Data transmission 90 | Serial.println("stop data transmission"); 91 | ble_active = false; 92 | meteoData[0] = 0x01; 93 | meteoData[1] = 0x01; 94 | meteoData[2] = 0x01; 95 | } else if (receivedBytes[0] == 0x00 && receivedBytes[1] == 0x00 && receivedBytes[3] == 0x00) { 96 | Serial.println("update data"); 97 | // Ack packet 98 | // Continue transmission 99 | //Note: this is a default value for the meteoData to be transmitted if the rht.update() fails 100 | //Real meteoData will be set later. 101 | meteoData[0] = 0x44; 102 | meteoData[1] = 0x44; 103 | meteoData[2] = 0x44; 104 | } else { 105 | Serial.println("something is wrong with data"); 106 | //Something is wrong. 107 | meteoData[0] = 0x77; 108 | meteoData[1] = 0x77; 109 | meteoData[2] = 0x77; 110 | //please send me Start signal again 111 | ble_active = false; 112 | } 113 | 114 | if (ble_active) { 115 | meteoData[0] = (byte) latestHumidity + 0.5; 116 | meteoData[1] = (byte) latestTempC > 0 ? 0x00 : 0xff; 117 | meteoData[2] = (byte) (abs(latestTempC) + 0.5); 118 | } else { 119 | Serial.println("Error updating temperature and humidity levels"); 120 | } 121 | 122 | Serial1.write(meteoData, 3); 123 | } 124 | else 125 | { 126 | Serial.println("no sensor read. wait for " + String(RHT_READ_INTERVAL_MS) + " ms"); 127 | // If the update failed, try delaying for RHT_READ_INTERVAL_MS ms before 128 | // trying again. 129 | delay(RHT_READ_INTERVAL_MS); 130 | } 131 | delay(1000); 132 | } 133 | -------------------------------------------------------------------------------- /BleFramework/Assets/Fonts/play/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Jonas Hecksher, Playtypes, e-types AS (e-types.com), 2 | with Reserved Font Name "Play", "Playtype", "Playtype Sans". 3 | 4 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 5 | This license is copied below, and is also available with a FAQ at: 6 | http://scripts.sil.org/OFL 7 | 8 | 9 | ----------------------------------------------------------- 10 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 11 | ----------------------------------------------------------- 12 | 13 | PREAMBLE 14 | The goals of the Open Font License (OFL) are to stimulate worldwide 15 | development of collaborative font projects, to support the font creation 16 | efforts of academic and linguistic communities, and to provide a free and 17 | open framework in which fonts may be shared and improved in partnership 18 | with others. 19 | 20 | The OFL allows the licensed fonts to be used, studied, modified and 21 | redistributed freely as long as they are not sold by themselves. The 22 | fonts, including any derivative works, can be bundled, embedded, 23 | redistributed and/or sold with any software provided that any reserved 24 | names are not used by derivative works. The fonts and derivatives, 25 | however, cannot be released under any other type of license. The 26 | requirement for fonts to remain under this license does not apply 27 | to any document created using the fonts or their derivatives. 28 | 29 | DEFINITIONS 30 | "Font Software" refers to the set of files released by the Copyright 31 | Holder(s) under this license and clearly marked as such. This may 32 | include source files, build scripts and documentation. 33 | 34 | "Reserved Font Name" refers to any names specified as such after the 35 | copyright statement(s). 36 | 37 | "Original Version" refers to the collection of Font Software components as 38 | distributed by the Copyright Holder(s). 39 | 40 | "Modified Version" refers to any derivative made by adding to, deleting, 41 | or substituting -- in part or in whole -- any of the components of the 42 | Original Version, by changing formats or by porting the Font Software to a 43 | new environment. 44 | 45 | "Author" refers to any designer, engineer, programmer, technical 46 | writer or other person who contributed to the Font Software. 47 | 48 | PERMISSION & CONDITIONS 49 | Permission is hereby granted, free of charge, to any person obtaining 50 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 51 | redistribute, and sell modified and unmodified copies of the Font 52 | Software, subject to the following conditions: 53 | 54 | 1) Neither the Font Software nor any of its individual components, 55 | in Original or Modified Versions, may be sold by itself. 56 | 57 | 2) Original or Modified Versions of the Font Software may be bundled, 58 | redistributed and/or sold with any software, provided that each copy 59 | contains the above copyright notice and this license. These can be 60 | included either as stand-alone text files, human-readable headers or 61 | in the appropriate machine-readable metadata fields within text or 62 | binary files as long as those fields can be easily viewed by the user. 63 | 64 | 3) No Modified Version of the Font Software may use the Reserved Font 65 | Name(s) unless explicit written permission is granted by the corresponding 66 | Copyright Holder. This restriction only applies to the primary font name as 67 | presented to the users. 68 | 69 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 70 | Software shall not be used to promote, endorse or advertise any 71 | Modified Version, except to acknowledge the contribution(s) of the 72 | Copyright Holder(s) and the Author(s) or with their explicit written 73 | permission. 74 | 75 | 5) The Font Software, modified or unmodified, in part or in whole, 76 | must be distributed entirely under this license, and must not be 77 | distributed under any other license. The requirement for fonts to 78 | remain under this license does not apply to any document created 79 | using the Font Software. 80 | 81 | TERMINATION 82 | This license becomes null and void if any of the above conditions are 83 | not met. 84 | 85 | DISCLAIMER 86 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 87 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 88 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 89 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 90 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 91 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 92 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 93 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 94 | OTHER DEALINGS IN THE FONT SOFTWARE. 95 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 2 18 | shadowCascade2Split: .333333343 19 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669} 20 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: .300000012 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | excludedTargetPlatforms: [] 33 | - serializedVersion: 2 34 | name: Fast 35 | pixelLightCount: 0 36 | shadows: 0 37 | shadowResolution: 0 38 | shadowProjection: 1 39 | shadowCascades: 1 40 | shadowDistance: 20 41 | shadowNearPlaneOffset: 2 42 | shadowCascade2Split: .333333343 43 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669} 44 | blendWeights: 2 45 | textureQuality: 0 46 | anisotropicTextures: 0 47 | antiAliasing: 0 48 | softParticles: 0 49 | softVegetation: 0 50 | realtimeReflectionProbes: 0 51 | billboardsFaceCameraPosition: 0 52 | vSyncCount: 0 53 | lodBias: .400000006 54 | maximumLODLevel: 0 55 | particleRaycastBudget: 16 56 | excludedTargetPlatforms: [] 57 | - serializedVersion: 2 58 | name: Simple 59 | pixelLightCount: 1 60 | shadows: 1 61 | shadowResolution: 0 62 | shadowProjection: 1 63 | shadowCascades: 1 64 | shadowDistance: 20 65 | shadowNearPlaneOffset: 2 66 | shadowCascade2Split: .333333343 67 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669} 68 | blendWeights: 2 69 | textureQuality: 0 70 | anisotropicTextures: 1 71 | antiAliasing: 0 72 | softParticles: 0 73 | softVegetation: 0 74 | realtimeReflectionProbes: 0 75 | billboardsFaceCameraPosition: 0 76 | vSyncCount: 0 77 | lodBias: .699999988 78 | maximumLODLevel: 0 79 | particleRaycastBudget: 64 80 | excludedTargetPlatforms: [] 81 | - serializedVersion: 2 82 | name: Good 83 | pixelLightCount: 2 84 | shadows: 2 85 | shadowResolution: 1 86 | shadowProjection: 1 87 | shadowCascades: 2 88 | shadowDistance: 40 89 | shadowNearPlaneOffset: 2 90 | shadowCascade2Split: .333333343 91 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669} 92 | blendWeights: 2 93 | textureQuality: 0 94 | anisotropicTextures: 1 95 | antiAliasing: 0 96 | softParticles: 0 97 | softVegetation: 1 98 | realtimeReflectionProbes: 1 99 | billboardsFaceCameraPosition: 1 100 | vSyncCount: 1 101 | lodBias: 1 102 | maximumLODLevel: 0 103 | particleRaycastBudget: 256 104 | excludedTargetPlatforms: [] 105 | - serializedVersion: 2 106 | name: Beautiful 107 | pixelLightCount: 3 108 | shadows: 2 109 | shadowResolution: 2 110 | shadowProjection: 1 111 | shadowCascades: 2 112 | shadowDistance: 70 113 | shadowNearPlaneOffset: 2 114 | shadowCascade2Split: .333333343 115 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669} 116 | blendWeights: 4 117 | textureQuality: 0 118 | anisotropicTextures: 2 119 | antiAliasing: 2 120 | softParticles: 1 121 | softVegetation: 1 122 | realtimeReflectionProbes: 1 123 | billboardsFaceCameraPosition: 1 124 | vSyncCount: 1 125 | lodBias: 1.5 126 | maximumLODLevel: 0 127 | particleRaycastBudget: 1024 128 | excludedTargetPlatforms: [] 129 | - serializedVersion: 2 130 | name: Fantastic 131 | pixelLightCount: 4 132 | shadows: 2 133 | shadowResolution: 2 134 | shadowProjection: 1 135 | shadowCascades: 4 136 | shadowDistance: 150 137 | shadowNearPlaneOffset: 2 138 | shadowCascade2Split: .333333343 139 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669} 140 | blendWeights: 4 141 | textureQuality: 0 142 | anisotropicTextures: 2 143 | antiAliasing: 2 144 | softParticles: 1 145 | softVegetation: 1 146 | realtimeReflectionProbes: 1 147 | billboardsFaceCameraPosition: 1 148 | vSyncCount: 1 149 | lodBias: 2 150 | maximumLODLevel: 0 151 | particleRaycastBudget: 4096 152 | excludedTargetPlatforms: [] 153 | m_PerPlatformDefaultQuality: 154 | Android: 2 155 | BlackBerry: 2 156 | GLES Emulation: 5 157 | Nintendo 3DS: 5 158 | PS3: 5 159 | PS4: 5 160 | PSM: 5 161 | PSP2: 2 162 | Samsung TV: 2 163 | Standalone: 5 164 | Tizen: 2 165 | WP8: 5 166 | Web: 5 167 | WebGL: 3 168 | Wii U: 5 169 | Windows Store Apps: 5 170 | XBOX360: 5 171 | XboxOne: 5 172 | iPhone: 2 173 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/MeteoStationBehaviour.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | using BLEFramework.Unity; 6 | using System.Linq; 7 | 8 | public class MeteoStationBehaviour : MonoBehaviour 9 | { 10 | public GameObject meteoStationBoard; 11 | 12 | private byte[] lastCommand; 13 | 14 | private byte[] resetCommand = { 0xfe, 0xfe, 0xfe }; 15 | private byte[] stopCommand = { 0x01, 0x02, 0x03 }; 16 | private byte[] updateDataCommand = { 0x00, 0x00, 0x00 }; 17 | 18 | private readonly byte[] stopAck = { 0x01, 0x01, 0x01 }; 19 | 20 | private readonly byte[] resetError = { 0x33, 0x33, 0x33 }; 21 | private readonly byte[] updateDataError = { 0x44, 0x44, 0x44}; 22 | private readonly byte[] unknownError = { 0x77, 0x77, 0x77 }; 23 | 24 | private bool isTrasmissionActive; 25 | 26 | private Coroutine transmissionCoroutine; 27 | 28 | private void OnEnable() 29 | { 30 | AppControllerBehaviour.DidReceiveDataEvent += HandleDidReceiveDataEvent; 31 | AppControllerBehaviour.ConnectionEstablishedEvent += HandleConnectionEstablishedEvent; 32 | AppControllerBehaviour.ConnectionLostEvent += HandleConnectionLostEvent; 33 | } 34 | 35 | private void OnDisable() 36 | { 37 | AppControllerBehaviour.DidReceiveDataEvent -= HandleDidReceiveDataEvent; 38 | AppControllerBehaviour.ConnectionEstablishedEvent -= HandleConnectionEstablishedEvent; 39 | AppControllerBehaviour.ConnectionLostEvent -= HandleConnectionLostEvent; 40 | } 41 | private void Awake() 42 | { 43 | meteoStationBoard.GetComponent().text = "Reading sensors..."; 44 | } 45 | 46 | IEnumerator SendUpdateDataCommand(int delay) 47 | { 48 | yield return new WaitForSeconds(delay); 49 | BLEController.SendData(updateDataCommand); 50 | } 51 | 52 | void HandleDidReceiveDataEvent(byte[] data, int numOfBytes) 53 | { 54 | Debug.Log("AppControllerBehavior: HandleOnBleDidReceiveDataEvent: size: " + numOfBytes); 55 | 56 | if (numOfBytes == 3) 57 | { 58 | if (data.SequenceEqual(resetError)) 59 | { 60 | Debug.Log("Reset Error"); 61 | // error resetting 62 | // try sending reset again 63 | //BLEController.SendData(resetCommand); 64 | } 65 | else if (data.SequenceEqual(updateDataError)) 66 | { 67 | Debug.Log("Update Data Error"); 68 | // error sending update data command 69 | // try sending update data again 70 | //BLEController.SendData(updateDataCommand); 71 | } 72 | else if (data.SequenceEqual(unknownError)) 73 | { 74 | Debug.Log("Unknown Error"); 75 | // unknown error 76 | // try sending reset signal 77 | //BLEController.SendData(resetCommand); 78 | } 79 | else // The data is valid 80 | { 81 | if (data.SequenceEqual(stopAck)) 82 | { 83 | Debug.Log("Stop Ack"); 84 | // error sending stop 85 | // try sending stop again 86 | isTrasmissionActive = false; 87 | } 88 | else 89 | { 90 | Debug.Log("Updating temperature and humidity values"); 91 | byte humidity = data[0]; 92 | byte temperatureSign = data[1]; 93 | byte temperatureAbsValue = data[2]; 94 | int percentHumidity = humidity; 95 | int temperature = temperatureSign == 0xff ? -temperatureAbsValue : temperatureAbsValue; 96 | string text = "Humidity: " + percentHumidity + "%\nTemperature: " + temperature + " C"; 97 | Debug.Log(text); 98 | meteoStationBoard.GetComponent().text = text; 99 | } 100 | 101 | if (isTrasmissionActive) 102 | { 103 | transmissionCoroutine = StartCoroutine(SendUpdateDataCommand(10)); 104 | } 105 | } 106 | //Debug.Log("Command correctly received. Can send next command."); 107 | //if (currentCommandIndex >= listOfCommands.Length) { currentCommandIndex = 0; } 108 | //lastCommand = listOfCommands[currentCommandIndex]; 109 | //currentCommandIndex += 1; 110 | ////send last command in 3 seconds! 111 | 112 | } 113 | } 114 | 115 | void HandleConnectionEstablishedEvent() 116 | { 117 | isTrasmissionActive = true; 118 | BLEController.SendData(resetCommand); 119 | } 120 | 121 | void HandleConnectionLostEvent() 122 | { 123 | isTrasmissionActive = false; 124 | StopCoroutine(transmissionCoroutine); 125 | } 126 | 127 | public void StopMeteoUpdates() 128 | { 129 | BLEController.SendData(stopCommand); 130 | } 131 | 132 | } 133 | -------------------------------------------------------------------------------- /BleFramework/Assets/Sprites/loadingIndicatorWhite.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a5cca0a375114dce9988d39df7ce902 3 | timeCreated: 1444754401 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: 7 | 21300000: loadingIndicatorWhite_0 8 | 21300002: loadingIndicatorWhite_1 9 | 21300004: loadingIndicatorWhite_2 10 | 21300006: loadingIndicatorWhite_3 11 | 21300008: loadingIndicatorWhite_4 12 | 21300010: loadingIndicatorWhite_5 13 | 21300012: loadingIndicatorWhite_6 14 | 21300014: loadingIndicatorWhite_7 15 | 21300016: loadingIndicatorWhite_8 16 | 21300018: loadingIndicatorWhite_9 17 | 21300020: loadingIndicatorWhite_10 18 | 21300022: loadingIndicatorWhite_11 19 | serializedVersion: 2 20 | mipmaps: 21 | mipMapMode: 0 22 | enableMipMap: 0 23 | linearTexture: 0 24 | correctGamma: 0 25 | fadeOut: 0 26 | borderMipMap: 0 27 | mipMapFadeDistanceStart: 1 28 | mipMapFadeDistanceEnd: 3 29 | bumpmap: 30 | convertToNormalMap: 0 31 | externalNormalMap: 0 32 | heightScale: .25 33 | normalMapFilter: 0 34 | isReadable: 0 35 | grayScaleToAlpha: 0 36 | generateCubemap: 0 37 | cubemapConvolution: 0 38 | cubemapConvolutionSteps: 8 39 | cubemapConvolutionExponent: 1.5 40 | seamlessCubemap: 0 41 | textureFormat: -3 42 | maxTextureSize: 2048 43 | textureSettings: 44 | filterMode: -1 45 | aniso: 16 46 | mipBias: -1 47 | wrapMode: 1 48 | nPOTScale: 0 49 | lightmap: 0 50 | rGBM: 0 51 | compressionQuality: 50 52 | allowsAlphaSplitting: 0 53 | spriteMode: 2 54 | spriteExtrude: 1 55 | spriteMeshType: 1 56 | alignment: 0 57 | spritePivot: {x: .5, y: .5} 58 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 59 | spritePixelsToUnits: 100 60 | alphaIsTransparency: 1 61 | textureType: 8 62 | buildTargetSettings: [] 63 | spriteSheet: 64 | sprites: 65 | - name: loadingIndicatorWhite_0 66 | rect: 67 | serializedVersion: 2 68 | x: 0 69 | y: 0 70 | width: 85 71 | height: 96 72 | alignment: 0 73 | pivot: {x: 0, y: 0} 74 | border: {x: 0, y: 0, z: 0, w: 0} 75 | - name: loadingIndicatorWhite_1 76 | rect: 77 | serializedVersion: 2 78 | x: 85 79 | y: 0 80 | width: 85 81 | height: 96 82 | alignment: 0 83 | pivot: {x: 0, y: 0} 84 | border: {x: 0, y: 0, z: 0, w: 0} 85 | - name: loadingIndicatorWhite_2 86 | rect: 87 | serializedVersion: 2 88 | x: 170 89 | y: 0 90 | width: 85 91 | height: 96 92 | alignment: 0 93 | pivot: {x: 0, y: 0} 94 | border: {x: 0, y: 0, z: 0, w: 0} 95 | - name: loadingIndicatorWhite_3 96 | rect: 97 | serializedVersion: 2 98 | x: 255 99 | y: 0 100 | width: 85 101 | height: 96 102 | alignment: 0 103 | pivot: {x: 0, y: 0} 104 | border: {x: 0, y: 0, z: 0, w: 0} 105 | - name: loadingIndicatorWhite_4 106 | rect: 107 | serializedVersion: 2 108 | x: 340 109 | y: 0 110 | width: 85 111 | height: 96 112 | alignment: 0 113 | pivot: {x: 0, y: 0} 114 | border: {x: 0, y: 0, z: 0, w: 0} 115 | - name: loadingIndicatorWhite_5 116 | rect: 117 | serializedVersion: 2 118 | x: 425 119 | y: 0 120 | width: 85 121 | height: 96 122 | alignment: 0 123 | pivot: {x: 0, y: 0} 124 | border: {x: 0, y: 0, z: 0, w: 0} 125 | - name: loadingIndicatorWhite_6 126 | rect: 127 | serializedVersion: 2 128 | x: 510 129 | y: 0 130 | width: 85 131 | height: 96 132 | alignment: 0 133 | pivot: {x: 0, y: 0} 134 | border: {x: 0, y: 0, z: 0, w: 0} 135 | - name: loadingIndicatorWhite_7 136 | rect: 137 | serializedVersion: 2 138 | x: 595 139 | y: 0 140 | width: 85 141 | height: 96 142 | alignment: 0 143 | pivot: {x: 0, y: 0} 144 | border: {x: 0, y: 0, z: 0, w: 0} 145 | - name: loadingIndicatorWhite_8 146 | rect: 147 | serializedVersion: 2 148 | x: 680 149 | y: 0 150 | width: 85 151 | height: 96 152 | alignment: 0 153 | pivot: {x: 0, y: 0} 154 | border: {x: 0, y: 0, z: 0, w: 0} 155 | - name: loadingIndicatorWhite_9 156 | rect: 157 | serializedVersion: 2 158 | x: 765 159 | y: 0 160 | width: 85 161 | height: 96 162 | alignment: 0 163 | pivot: {x: 0, y: 0} 164 | border: {x: 0, y: 0, z: 0, w: 0} 165 | - name: loadingIndicatorWhite_10 166 | rect: 167 | serializedVersion: 2 168 | x: 850 169 | y: 0 170 | width: 85 171 | height: 96 172 | alignment: 0 173 | pivot: {x: 0, y: 0} 174 | border: {x: 0, y: 0, z: 0, w: 0} 175 | - name: loadingIndicatorWhite_11 176 | rect: 177 | serializedVersion: 2 178 | x: 935 179 | y: 0 180 | width: 85 181 | height: 96 182 | alignment: 0 183 | pivot: {x: 0, y: 0} 184 | border: {x: 0, y: 0, z: 0, w: 0} 185 | spritePackingTag: 186 | userData: 187 | assetBundleName: 188 | assetBundleVariant: 189 | -------------------------------------------------------------------------------- /AndroidPlugin/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /AndroidPlugin/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /BleFramework/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: .00100000005 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: .00100000005 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: .00100000005 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: .00100000005 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: .00100000005 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: .00100000005 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: .100000001 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: .100000001 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: .100000001 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: .189999998 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: .189999998 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: .00100000005 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: .00100000005 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: .00100000005 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: .00100000005 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: .00100000005 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: .00100000005 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: .00100000005 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /BleFramework/Assets/Scripts/AppControllerBehaviour.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine.UI; 5 | using BLEFramework.Unity; 6 | 7 | public class AppControllerBehaviour : MonoBehaviour 8 | { 9 | //other events 10 | public delegate void ShowActivityIndicatorEventDelegate(); 11 | public static event ShowActivityIndicatorEventDelegate ShowActivityIndicatorEvent; 12 | 13 | public delegate void DestroyActivityIndicatorEventDelegate(); 14 | public static event DestroyActivityIndicatorEventDelegate DestroyActivityIndicatorEvent; 15 | 16 | public delegate void DidStartPeripheralScanEventDelegate(); 17 | public static event DidStartPeripheralScanEventDelegate DidStartPeripheralScanEvent; 18 | 19 | public delegate void DidReceiveDataEventDelegate(byte[] data, int numOfBytes); 20 | public static event DidReceiveDataEventDelegate DidReceiveDataEvent; 21 | 22 | public delegate void ConnectionLostEventDelegate(); 23 | public static event ConnectionLostEventDelegate ConnectionLostEvent; 24 | 25 | public delegate void ConnectionEstablishedEventDelegate(); 26 | public static event ConnectionEstablishedEventDelegate ConnectionEstablishedEvent; 27 | 28 | public GameObject searchBleDevicesListResult; 29 | public GameObject searchBleDevicesButton; 30 | public GameObject disconnectButton; 31 | public GameObject infoMessage; 32 | public GameObject meteoStationFeed; 33 | 34 | 35 | 36 | public const int AppBuildNumber = 33; 37 | 38 | public const string AppBundleVersion = "1.0"; 39 | 40 | void Awake() 41 | { 42 | searchBleDevicesButton.SetActive(false); 43 | disconnectButton.SetActive(false); 44 | meteoStationFeed.SetActive(false); 45 | 46 | } 47 | 48 | void Start () 49 | { 50 | StartCoroutine(InitializeBLEFramework()); 51 | //bool value = BLEController.IsDeviceConnected(); 52 | //infoMessage.GetComponent().text = "Device is connected = "+value; 53 | } 54 | 55 | IEnumerator InitializeBLEFramework() 56 | { 57 | //wait for BLEControllerInitializer to Awake 58 | while (BLEControllerInitializer.Instance == null) 59 | { 60 | yield return null; 61 | } 62 | //Init BLEFramework 63 | infoMessage.GetComponent().text = "Calling InitBLEFramework"; 64 | BLEControllerInitializer.Instance.InitBLEFramework(); 65 | } 66 | 67 | void DestroyActivityIndicator() 68 | { 69 | if (DestroyActivityIndicatorEvent!=null) 70 | { 71 | DestroyActivityIndicatorEvent(); 72 | } 73 | } 74 | 75 | void OnEnable() 76 | { 77 | SearchBLEDevicesBehaviour.SearchBLEDevicesEvent += HandleSearchBLEDevicesEvent; 78 | DisconnectButtonBehaviour.DisconnectButtonEvent += HandleDisconnectButtonEvent; 79 | BleDeviceConnectButtonBehaviour.BleDevicesListButtonConnectEvent += HandleBleDevicesListButtonConnectEvent; 80 | BLEControllerEventHandler.OnBleDidCompletePeripheralScanEvent += HandleOnBleDidCompletePeripheralScanEvent; 81 | BLEControllerEventHandler.OnBleDidInitializeEvent += HandleOnBleDidInitializeEvent; 82 | BLEControllerEventHandler.OnBleDidConnectEvent += HandleOnBleDidConnectEvent; 83 | BLEControllerEventHandler.OnBleDidDisconnectEvent += HandleOnBleDidDisconnectEvent; 84 | BLEControllerEventHandler.OnBleDidReceiveDataEvent += HandleOnBleDidReceiveDataEvent; 85 | } 86 | 87 | void HandleOnBleDidReceiveDataEvent (byte[] data, int numOfBytes) 88 | { 89 | Debug.Log("AppControllerBehavior: HandleOnBleDidReceiveDataEvent: size: " + numOfBytes); 90 | DidReceiveDataEvent?.Invoke(data, numOfBytes); 91 | } 92 | 93 | void HandleOnBleDidDisconnectEvent (string errorMessage) 94 | { 95 | if (errorMessage != null) 96 | { 97 | Debug.Log("Error during disconnection: " + errorMessage); 98 | return; 99 | } 100 | searchBleDevicesButton.SetActive(true); 101 | disconnectButton.SetActive(false); 102 | meteoStationFeed.SetActive(false); 103 | infoMessage.GetComponent().text = "Device did disconnect."; 104 | 105 | ConnectionLostEvent?.Invoke(); 106 | } 107 | 108 | void HandleOnBleDidConnectEvent (string errorMessage) 109 | { 110 | if (errorMessage != null) 111 | { 112 | Debug.Log("Error during connection: " + errorMessage); 113 | return; 114 | } 115 | searchBleDevicesButton.SetActive(false); 116 | meteoStationFeed.SetActive(true); 117 | disconnectButton.SetActive(true); 118 | infoMessage.GetComponent().text = "Device did connect."; 119 | 120 | ConnectionEstablishedEvent?.Invoke(); 121 | 122 | } 123 | 124 | void HandleBleDevicesListButtonConnectEvent (int buttonIndex) 125 | { 126 | Debug.Log ("AppControllerBehavior: HandleBleDevicesListButtonConnectEvent: Calling connect peripheral at index: " + buttonIndex); 127 | bool success = BLEController.ConnectPeripheralAtIndex(buttonIndex); 128 | if (!success) 129 | { 130 | HandleOnBleDidConnectEvent("Error invoking ConnectPeripheralAtIndex " + buttonIndex); 131 | } 132 | } 133 | 134 | void HandleOnBleDidInitializeEvent (string errorMessage) 135 | { 136 | bool initDidSucceed = errorMessage == null; 137 | infoMessage.GetComponent().text = initDidSucceed ? "BleFramework initialization: SUCCESS" : ("BleFramework initialization: " + errorMessage); 138 | 139 | Debug.Log("AppControllerBehavior: HandleOnBleDidInitializeEvent: The BLE module did initialize correctly"); 140 | searchBleDevicesButton.SetActive(initDidSucceed); 141 | } 142 | 143 | void HandleOnBleDidCompletePeripheralScanEvent (List peripherals, string errorMessage) 144 | { 145 | if (errorMessage != null) 146 | { 147 | infoMessage.GetComponent().text = errorMessage; 148 | } 149 | else 150 | { 151 | infoMessage.GetComponent().text = peripherals.Count == 0 ? "No BLE devices found." : "Scan completed."; 152 | } 153 | searchBleDevicesButton.GetComponent