first push!

This commit is contained in:
2026-02-20 17:53:43 +01:00
parent ab073a6a39
commit e723ab86b9
274 changed files with 89671 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 6bcb86970c7ff4e08a5499891901f8e9
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:isGame="true">
<activity android:label="@string/app_name" android:screenOrientation="fullSensor" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false" android:name="com.unity3d.player.UnityPlayerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:minSdkVersion="31" android:usesPermissionFlags="neverForLocation"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" android:minSdkVersion="31"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" android:minSdkVersion="31"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="false"/>
</manifest>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4abd69b18c4ab45ec976851430122248
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: f158ceee465c745bc89002ae57bc033e
timeCreated: 1539484944
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Android: Android
second:
enabled: 1
settings: {}
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,395 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class BluetoothDeviceScript : MonoBehaviour
{
#if UNITY_IOS
public Dictionary<string, string> BLEStandardUUIDs = new Dictionary<string, string>();
#endif
public List<string> DiscoveredDeviceList;
public Action InitializedAction;
public Action DeinitializedAction;
public Action<string> ErrorAction;
public Action<string> ServiceAddedAction;
public Action StartedAdvertisingAction;
public Action StoppedAdvertisingAction;
public Action<string, string> DiscoveredPeripheralAction;
public Action<string, string, int, byte[]> DiscoveredPeripheralWithAdvertisingInfoAction;
public Action<BluetoothLEHardwareInterface.iBeaconData> DiscoveredBeaconAction;
public Action<string, string> RetrievedConnectedPeripheralAction;
public Action<string, byte[]> PeripheralReceivedWriteDataAction;
public Action<string> ConnectedPeripheralAction;
public Action<string> ConnectedDisconnectPeripheralAction;
public Action<string> DisconnectedPeripheralAction;
public Action<string, string> DiscoveredServiceAction;
public Action<string, string, string> DiscoveredCharacteristicAction;
public Action<string> DidWriteCharacteristicAction;
public Dictionary<string, Dictionary<string, Action<string>>> DidUpdateNotificationStateForCharacteristicAction;
public Dictionary<string, Dictionary<string, Action<string, string>>> DidUpdateNotificationStateForCharacteristicWithDeviceAddressAction;
public Dictionary<string, Dictionary<string, Action<string, byte[]>>> DidUpdateCharacteristicValueAction;
public Dictionary<string, Dictionary<string, Action<string, string, byte[]>>> DidUpdateCharacteristicValueWithDeviceAddressAction;
public Action<string, int> RequestMtuAction;
public Action<string, int> ReadRSSIAction;
// Use this for initialization
void Start ()
{
DiscoveredDeviceList = new List<string> ();
DidUpdateNotificationStateForCharacteristicAction = new Dictionary<string, Dictionary<string, Action<string>>> ();
DidUpdateNotificationStateForCharacteristicWithDeviceAddressAction = new Dictionary<string, Dictionary<string, Action<string, string>>> ();
DidUpdateCharacteristicValueAction = new Dictionary<string, Dictionary<string, Action<string, byte[]>>> ();
DidUpdateCharacteristicValueWithDeviceAddressAction = new Dictionary<string, Dictionary<string, Action<string, string, byte[]>>> ();
#if UNITY_IOS
BLEStandardUUIDs["Heart Rate Measurement"] = "00002A37-0000-1000-8000-00805F9B34FB";
#endif
}
// Update is called once per frame
void Update ()
{
}
const string deviceInitializedString = "Initialized";
const string deviceDeInitializedString = "DeInitialized";
const string deviceErrorString = "Error";
const string deviceServiceAdded = "ServiceAdded";
const string deviceStartedAdvertising = "StartedAdvertising";
const string deviceStoppedAdvertising = "StoppedAdvertising";
const string deviceDiscoveredPeripheral = "DiscoveredPeripheral";
const string deviceDiscoveredBeacon = "DiscoveredBeacon";
const string deviceRetrievedConnectedPeripheral = "RetrievedConnectedPeripheral";
const string devicePeripheralReceivedWriteData = "PeripheralReceivedWriteData";
const string deviceConnectedPeripheral = "ConnectedPeripheral";
const string deviceDisconnectedPeripheral = "DisconnectedPeripheral";
const string deviceDiscoveredService = "DiscoveredService";
const string deviceDiscoveredCharacteristic = "DiscoveredCharacteristic";
const string deviceDidWriteCharacteristic = "DidWriteCharacteristic";
const string deviceDidUpdateNotificationStateForCharacteristic = "DidUpdateNotificationStateForCharacteristic";
const string deviceDidUpdateValueForCharacteristic = "DidUpdateValueForCharacteristic";
const string deviceLog = "Log";
const string deviceRequestMtu = "MtuChanged";
const string deviceReadRSSI = "DidReadRSSI";
public void OnBluetoothMessage (string message)
{
if (message != null)
{
char[] delim = new char[] { '~' };
string[] parts = message.Split (delim);
string log = "";
for (int i = 0; i < parts.Length; ++i)
log += string.Format("| {0}", parts[i]);
BluetoothLEHardwareInterface.Log(log);
if (message.Length >= deviceInitializedString.Length && message.Substring (0, deviceInitializedString.Length) == deviceInitializedString)
{
if (InitializedAction != null)
InitializedAction ();
}
else if (message.Length >= deviceLog.Length && message.Substring (0, deviceLog.Length) == deviceLog)
{
BluetoothLEHardwareInterface.Log (parts[1]);
}
else if (message.Length >= deviceDeInitializedString.Length && message.Substring (0, deviceDeInitializedString.Length) == deviceDeInitializedString)
{
BluetoothLEHardwareInterface.FinishDeInitialize ();
if (DeinitializedAction != null)
DeinitializedAction ();
}
else if (message.Length >= deviceErrorString.Length && message.Substring (0, deviceErrorString.Length) == deviceErrorString)
{
string error = "";
if (parts.Length >= 2)
error = parts[1];
if (ErrorAction != null)
ErrorAction (error);
}
else if (message.Length >= deviceServiceAdded.Length && message.Substring (0, deviceServiceAdded.Length) == deviceServiceAdded)
{
if (parts.Length >= 2)
{
if (ServiceAddedAction != null)
ServiceAddedAction (parts[1]);
}
}
else if (message.Length >= deviceStartedAdvertising.Length && message.Substring (0, deviceStartedAdvertising.Length) == deviceStartedAdvertising)
{
BluetoothLEHardwareInterface.Log ("Started Advertising");
if (StartedAdvertisingAction != null)
StartedAdvertisingAction ();
}
else if (message.Length >= deviceStoppedAdvertising.Length && message.Substring (0, deviceStoppedAdvertising.Length) == deviceStoppedAdvertising)
{
BluetoothLEHardwareInterface.Log ("Stopped Advertising");
if (StoppedAdvertisingAction != null)
StoppedAdvertisingAction ();
}
else if (message.Length >= deviceDiscoveredPeripheral.Length && message.Substring (0, deviceDiscoveredPeripheral.Length) == deviceDiscoveredPeripheral)
{
if (parts.Length >= 3)
{
// the first callback will only get called the first time this device is seen
// this is because it gets added to the a list in the DiscoveredDeviceList
// after that only the second callback will get called and only if there is
// advertising data available
if (!DiscoveredDeviceList.Contains (parts[1] + "|" + parts[2]))
{
DiscoveredDeviceList.Add (parts[1] + "|" + parts[2]);
if (DiscoveredPeripheralAction != null)
DiscoveredPeripheralAction (parts[1], parts[2]);
}
if (parts.Length >= 5 && DiscoveredPeripheralWithAdvertisingInfoAction != null)
{
// get the rssi from the 4th value
int rssi = 0;
if (!int.TryParse (parts[3], out rssi))
rssi = 0;
// parse the base 64 encoded data that is the 5th value
byte[] bytes = System.Convert.FromBase64String (parts[4]);
DiscoveredPeripheralWithAdvertisingInfoAction (parts[1], parts[2], rssi, bytes);
}
}
}
else if (message.Length >= deviceDiscoveredBeacon.Length && message.Substring (0, deviceDiscoveredBeacon.Length) == deviceDiscoveredBeacon)
{
if (parts.Length >= 7)
{
var iBeaconData = new BluetoothLEHardwareInterface.iBeaconData ();
iBeaconData.UUID = parts[1];
if (!int.TryParse (parts[2], out iBeaconData.Major))
iBeaconData.Major = 0;
if (!int.TryParse (parts[3], out iBeaconData.Minor))
iBeaconData.Minor = 0;
if (!int.TryParse (parts[4], out iBeaconData.RSSI))
iBeaconData.RSSI = 0;
if (!int.TryParse (parts[5], out iBeaconData.AndroidSignalPower))
iBeaconData.AndroidSignalPower = 0;
int iOSProximity = 0;
if (!int.TryParse (parts[6], out iOSProximity))
iOSProximity = 0;
iBeaconData.iOSProximity = (BluetoothLEHardwareInterface.iOSProximity)iOSProximity;
if (DiscoveredBeaconAction != null)
DiscoveredBeaconAction (iBeaconData);
}
}
else if (message.Length >= deviceRetrievedConnectedPeripheral.Length && message.Substring (0, deviceRetrievedConnectedPeripheral.Length) == deviceRetrievedConnectedPeripheral)
{
if (parts.Length >= 3)
{
DiscoveredDeviceList.Add (parts[1]);
if (RetrievedConnectedPeripheralAction != null)
RetrievedConnectedPeripheralAction (parts[1], parts[2]);
}
}
else if (message.Length >= devicePeripheralReceivedWriteData.Length && message.Substring (0, devicePeripheralReceivedWriteData.Length) == devicePeripheralReceivedWriteData)
{
if (parts.Length >= 3)
OnPeripheralData (parts[1], parts[2]);
}
else if (message.Length >= deviceConnectedPeripheral.Length && message.Substring (0, deviceConnectedPeripheral.Length) == deviceConnectedPeripheral)
{
if (parts.Length >= 2 && ConnectedPeripheralAction != null)
ConnectedPeripheralAction (parts[1]);
}
else if (message.Length >= deviceDisconnectedPeripheral.Length && message.Substring (0, deviceDisconnectedPeripheral.Length) == deviceDisconnectedPeripheral)
{
if (parts.Length >= 2)
{
if (ConnectedDisconnectPeripheralAction != null)
ConnectedDisconnectPeripheralAction (parts[1]);
if (DisconnectedPeripheralAction != null)
DisconnectedPeripheralAction (parts[1]);
}
}
else if (message.Length >= deviceDiscoveredService.Length && message.Substring (0, deviceDiscoveredService.Length) == deviceDiscoveredService)
{
if (parts.Length >= 3 && DiscoveredServiceAction != null)
DiscoveredServiceAction (parts[1], parts[2]);
}
else if (message.Length >= deviceDiscoveredCharacteristic.Length && message.Substring (0, deviceDiscoveredCharacteristic.Length) == deviceDiscoveredCharacteristic)
{
if (parts.Length >= 4 && DiscoveredCharacteristicAction != null)
DiscoveredCharacteristicAction (parts[1], parts[2], parts[3]);
}
else if (message.Length >= deviceDidWriteCharacteristic.Length && message.Substring (0, deviceDidWriteCharacteristic.Length) == deviceDidWriteCharacteristic)
{
if (parts.Length >= 2 && DidWriteCharacteristicAction != null)
DidWriteCharacteristicAction (parts[1]);
}
else if (message.Length >= deviceDidUpdateNotificationStateForCharacteristic.Length && message.Substring (0, deviceDidUpdateNotificationStateForCharacteristic.Length) == deviceDidUpdateNotificationStateForCharacteristic)
{
if (parts.Length >= 3)
{
if (DidUpdateNotificationStateForCharacteristicAction != null && DidUpdateNotificationStateForCharacteristicAction.ContainsKey (parts[1]))
{
var characteristicAction = DidUpdateNotificationStateForCharacteristicAction[parts[1]];
if (characteristicAction != null && characteristicAction.ContainsKey (parts[2]))
{
var action = characteristicAction[parts[2]];
if (action != null)
action (parts[2]);
}
}
if (DidUpdateNotificationStateForCharacteristicWithDeviceAddressAction != null && DidUpdateNotificationStateForCharacteristicWithDeviceAddressAction.ContainsKey (parts[1]))
{
var characteristicAction = DidUpdateNotificationStateForCharacteristicWithDeviceAddressAction[parts[1]];
if (characteristicAction != null && characteristicAction.ContainsKey (parts[2]))
{
var action = characteristicAction[parts[2]];
if (action != null)
action (parts[1], parts[2]);
}
}
}
}
else if (message.Length >= deviceDidUpdateValueForCharacteristic.Length && message.Substring (0, deviceDidUpdateValueForCharacteristic.Length) == deviceDidUpdateValueForCharacteristic)
{
if (parts.Length >= 4)
OnBluetoothData (parts[1], parts[2], parts[3]);
}
else if (message.Length >= deviceRequestMtu.Length && message.Substring(0, deviceRequestMtu.Length) == deviceRequestMtu)
{
if (parts.Length >= 3)
{
if (RequestMtuAction != null)
{
int mtu = 0;
if (int.TryParse(parts[2], out mtu))
RequestMtuAction(parts[1], mtu);
}
}
}
else if (message.Length >= deviceReadRSSI.Length && message.Substring(0, deviceReadRSSI.Length) == deviceReadRSSI)
{
if (parts.Length >= 3)
{
if (ReadRSSIAction != null)
{
int rssi = 0;
if (int.TryParse(parts[2], out rssi))
ReadRSSIAction(parts[1], rssi);
}
}
}
}
}
public void OnBluetoothData (string base64Data)
{
OnBluetoothData ("", "", base64Data);
}
public void OnBluetoothData (string deviceAddress, string characteristic, string base64Data)
{
if (base64Data != null)
{
byte[] bytes = System.Convert.FromBase64String (base64Data);
if (bytes.Length > 0)
{
deviceAddress = deviceAddress.ToUpper ();
characteristic = characteristic.ToUpper ();
#if UNITY_IOS
if (BLEStandardUUIDs.ContainsKey(characteristic))
characteristic = BLEStandardUUIDs[characteristic];
#endif
BluetoothLEHardwareInterface.Log ("Device: " + deviceAddress + " Characteristic Received: " + characteristic);
string byteString = "";
foreach (byte b in bytes)
byteString += string.Format ("{0:X2}", b);
BluetoothLEHardwareInterface.Log (byteString);
if (DidUpdateCharacteristicValueAction != null && DidUpdateCharacteristicValueAction.ContainsKey (deviceAddress))
{
var characteristicAction = DidUpdateCharacteristicValueAction[deviceAddress];
#if UNITY_ANDROID
characteristic = characteristic.ToLower ();
#endif
if (characteristicAction != null && characteristicAction.ContainsKey (characteristic))
{
var action = characteristicAction[characteristic];
if (action != null)
action (characteristic, bytes);
}
}
if (DidUpdateCharacteristicValueWithDeviceAddressAction != null && DidUpdateCharacteristicValueWithDeviceAddressAction.ContainsKey (deviceAddress))
{
var characteristicAction = DidUpdateCharacteristicValueWithDeviceAddressAction[deviceAddress];
#if UNITY_ANDROID
characteristic = characteristic.ToLower ();
#endif
if (characteristicAction != null && characteristicAction.ContainsKey (characteristic))
{
var action = characteristicAction[characteristic];
if (action != null)
action (deviceAddress, characteristic, bytes);
}
}
}
}
}
public void OnPeripheralData (string characteristic, string base64Data)
{
if (base64Data != null)
{
byte[] bytes = System.Convert.FromBase64String (base64Data);
if (bytes.Length > 0)
{
BluetoothLEHardwareInterface.Log ("Peripheral Received: " + characteristic);
string byteString = "";
foreach (byte b in bytes)
byteString += string.Format ("{0:X2}", b);
BluetoothLEHardwareInterface.Log (byteString);
if (PeripheralReceivedWriteDataAction != null)
PeripheralReceivedWriteDataAction (characteristic, bytes);
}
}
}
#if UNITY_IOS
private void IncludeCoreLocationFramework()
{
// this method is here because Unity now only includes CoreLocation
// if there are methods in the .cs code that access it
Input.location.Stop ();
}
#endif
public void OnApplicationQuit()
{
if (Application.isEditor)
{
BluetoothLEHardwareInterface.DeInitialize(() =>
{
BluetoothLEHardwareInterface.Log("Deinitialize complete");
});
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b188ba3ac565e48f58fc50dd5db4818d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b8496a9b1a1df40af9ada2311d1d6d09
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 5383f7d08256547f6b36ee834b840062
folderAsset: yes
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 34c7c97d38c834839be439bcf96a0267
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>21E258</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>BluetoothLEOSX</string>
<key>CFBundleIdentifier</key>
<string>com.shatalmic.BluetoothLEOSX</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>BluetoothLEOSX</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>13E113</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>12.3</string>
<key>DTSDKBuild</key>
<string>21E226</string>
<key>DTSDKName</key>
<string>macosx12.3</string>
<key>DTXcode</key>
<string>1330</string>
<key>DTXcodeBuild</key>
<string>13E113</string>
<key>LSMinimumSystemVersion</key>
<string>10.11</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Bluetooth is required to work with devices.</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Shatalmic. All rights reserved.</string>
</dict>
</plist>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8e7811284d1734fc2ba4b29fccd3ccf7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4e9d68945c9234df3b7855f4e1006f0f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1a83baeb98e0141f587d978b89ecd37d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 673293518de2c4fbf913749ebdb36dd1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2b362acd4e35f4bb380341cd3df2b9c0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

5
Assets/Plugins/iOS.meta Normal file
View File

@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 8d3303514acc04853a1fbd8393630e00
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -0,0 +1,109 @@
//
// UnityBluetoothLE.h
// Unity-iPhone
//
// Created by Tony Pitman on 03/05/2014.
//
//
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#if !TARGET_OS_TV
#import <CoreLocation/CoreLocation.h>
@interface UnityBluetoothLE : NSObject <CBCentralManagerDelegate, CBPeripheralManagerDelegate, CBPeripheralDelegate, CLLocationManagerDelegate>
#else
@interface UnityBluetoothLE : NSObject <CBCentralManagerDelegate, CBPeripheralManagerDelegate, CBPeripheralDelegate>
#endif
{
CBCentralManager *_centralManager;
#if !TARGET_OS_TV
CLLocationManager *_locationManager;
#endif
NSMutableDictionary *_peripherals;
#if !TARGET_OS_TV
CBPeripheralManager *_peripheralManager;
NSString *_peripheralName;
NSMutableDictionary *_services;
NSMutableDictionary *_characteristics;
NSMutableDictionary *_allCharacteristics;
#endif
NSMutableArray *_backgroundMessages;
BOOL _isPaused;
BOOL _alreadyNotified;
BOOL _isInitializing;
BOOL _rssiOnly;
int _recordType;
long _mtu;
unsigned char *_writeCharacteristicBytes;
long _writeCharacteristicLength;
long _writeCharacteristicPosition;
long _writeCharacteristicBytesToWrite;
CBCharacteristicWriteType _writeCharacteristicWithResponse;
int _writeCharacteristicRetries;
}
@property (atomic, strong) NSMutableDictionary *_peripherals;
@property (atomic) BOOL _rssiOnly;
- (void)initialize:(BOOL)asCentral asPeripheral:(BOOL)asPeripheral;
- (void)deInitialize;
- (void)scanForPeripheralsWithServices:(NSArray *)serviceUUIDs options:(NSDictionary *)options clearPeripheralList:(BOOL)clearPeripheralList recordType:(int)recordType;
- (void)stopScan;
- (void)retrieveListOfPeripheralsWithServices:(NSArray *)serviceUUIDs;
- (void)connectToPeripheral:(NSString *)name;
- (void)disconnectPeripheral:(NSString *)name;
- (CBCharacteristic *)getCharacteristic:(NSString *)name service:(NSString *)serviceString characteristic:(NSString *)characteristicString;
- (void)readCharacteristic:(NSString *)name service:(NSString *)serviceString characteristic:(NSString *)characteristicString;
- (void)writeCharacteristic:(NSString *)name service:(NSString *)serviceString characteristic:(NSString *)characteristicString data:(NSData *)data withResponse:(BOOL)withResponse;
- (void)subscribeCharacteristic:(NSString *)name service:(NSString *)serviceString characteristic:(NSString *)characteristicString;
- (void)unsubscribeCharacteristic:(NSString *)name service:(NSString *)serviceString characteristic:(NSString *)characteristicString;
- (void)writeCharactersticBytesReset;
- (void)writeCharactersticBytes:(CBPeripheral *)peripheral characteristic:(CBCharacteristic *)characteristic data:(NSData *)data withResponse:(CBCharacteristicWriteType)withResponse;
- (void)writeNextPacket:(CBPeripheral *)peripheral characteristic:(CBCharacteristic *)characteristic;
- (void)requestMtu:(NSString *)name mtu:(int)mtu;
- (void)readRSSI:(NSString *)name;
#if !TARGET_OS_TV
- (void)scanForBeacons:(NSArray<CLBeaconRegion *> *)beaconRegions;
- (void)stopBeaconScan;
- (void)peripheralName:(NSString *)newName;
- (void)createService:(NSString *)uuid primary:(BOOL)primary;
- (void)removeService:(NSString *)uuid;
- (void)removeServices;
- (void)createCharacteristic:(NSString *)uuid properties:(CBCharacteristicProperties)properties permissions:(CBAttributePermissions)permissions value:(NSData *)value;
- (void)removeCharacteristic:(NSString *)uuid;
- (void)removeCharacteristics;
- (void)startAdvertising;
- (void)stopAdvertising;
- (void)updateCharacteristicValue:(NSString *)uuid value:(NSData *)value;
#endif
- (void)pauseMessages:(BOOL)isPaused;
- (void)sendUnityMessage:(BOOL)isString message:(NSString *)message;
+ (NSString *) base64StringFromData:(NSData *)data length:(int)length;
@end
@interface UnityMessage : NSObject
{
BOOL _isString;
NSString *_message;
}
- (void)initialize:(BOOL)isString message:(NSString *)message;
- (void)deInitialize;
- (void)sendUnityMessage;
@end

View File

@@ -0,0 +1,95 @@
fileFormatVersion: 2
guid: 89fad22a839074ac08f9f7ffc9dbce4e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Linux
second:
enabled: 0
settings:
CPU: x86
- first:
'': OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
'': OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Android: Android
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
iPhone: iOS
second:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,124 @@
fileFormatVersion: 2
guid: 6a40ca1fe2b7a48e5b257178dfdca41e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
- first:
'': Linux
second:
enabled: 0
settings:
CPU: x86
- first:
'': OSXIntel
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
'': OSXIntel64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
CompileFlags: -fno-objc-arc
FrameworkDependencies: CoreBluetooth;
- first:
tvOS: tvOS
second:
enabled: 1
settings:
CompileFlags: -fno-objc-arc
FrameworkDependencies: CoreBluetooth;
userData:
assetBundleName:
assetBundleVariant: