first push!
This commit is contained in:
109
Assets/Plugins/iOS/UnityBluetoothLE.h
Normal file
109
Assets/Plugins/iOS/UnityBluetoothLE.h
Normal 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
|
||||
95
Assets/Plugins/iOS/UnityBluetoothLE.h.meta
Normal file
95
Assets/Plugins/iOS/UnityBluetoothLE.h.meta
Normal 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:
|
||||
1368
Assets/Plugins/iOS/UnityBluetoothLE.mm
Normal file
1368
Assets/Plugins/iOS/UnityBluetoothLE.mm
Normal file
File diff suppressed because it is too large
Load Diff
124
Assets/Plugins/iOS/UnityBluetoothLE.mm.meta
Normal file
124
Assets/Plugins/iOS/UnityBluetoothLE.mm.meta
Normal 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:
|
||||
Reference in New Issue
Block a user