Skip to content

Commit

Permalink
Updating to Swift friendly mm files
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeda88 committed Oct 28, 2016
1 parent d7bd382 commit f5bccbc
Show file tree
Hide file tree
Showing 74 changed files with 606 additions and 6 deletions.
4 changes: 2 additions & 2 deletions LeBlue.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Pod::Spec.new do |s|
s.default_subspecs = 'LeBlue', 'CoreBluetooth'

s.subspec "LeBlue" do |sp|
sp.source_files = "objc/generated/*.{h,m}"
sp.exclude_files = "objc/generated/*test.{h,m}"
sp.source_files = "objc/generated/*.{h,m,mm,swift}"
sp.exclude_files = "objc/generated/*test.{h,m,mm,swift}"
sp.requires_arc = false
end

Expand Down
13 changes: 9 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ task translateLeBlueJava(type:Exec) {
args '--no-package-directories'
args '-d', file('objc/generated/').path
args '-sourcepath', tree.dir ,''
args '--swift-friendly'
args '-x', 'objective-c++'
args tree
}

Expand All @@ -53,6 +55,8 @@ task translateLeBlueJavaTest(type:Exec) {
args '--prefixes', file('objc/prefixes.properties').path
args '--no-package-directories'
args '-d', file('objc/generated/').path
args '--swift-friendly'
args '-x', 'objective-c++'
String dir1 = tree.dir
String dir2 = mainTree.dir
args '-sourcepath',dir1 + ":" + dir2
Expand All @@ -66,7 +70,7 @@ task compileTranslatedLeBlueJavaTest(type:Exec) {
args "-I${file("objc/generated/").path}"
args "-ObjC", "-ljunit", "-ljre_emul"
args "-o", "testrunner"
FileTree tree = fileTree(dir: "objc/generated/", include: '**/*.m')
FileTree tree = fileTree(dir: "objc/generated/", include: '**/*.mm')
args tree

}
Expand All @@ -75,12 +79,12 @@ task testTranslatedLeBlueJava(type:Exec) {

executable file("testrunner")
args 'org.junit.runner.JUnitCore'
FileTree tree = fileTree(dir: "objc/generated/", include: '**/*Test.m')
tree.exclude '**/MockerTest.m'
FileTree tree = fileTree(dir: "objc/generated/", include: '**/*Test.mm')
tree.exclude '**/MockerTest.mm'

tree.each { File file ->
println file
args file.name.replace(".m", "")
args file.name.replace(".mm", "")
}
}

Expand All @@ -98,6 +102,7 @@ task removeHeader << {

FileTree tree = fileTree(dir: 'objc/generated/')
tree.include '**/*.m'
tree.include '**/*.mm'
tree.include '**/*.h'


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions objc/generated/EventSinkFiller.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
jint currentRemoteDevice_, currentCharacteristic_;
}

+ (jint)DEFAULT_DEVICE_ID;

#pragma mark Public

- (instancetype)initWithListEventSinkSource:(ListEventSinkSource *)listEventSinkSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

@implementation EventSinkFiller

+ (jint)DEFAULT_DEVICE_ID {
return EventSinkFiller_DEFAULT_DEVICE_ID;
}

- (SessionObject *)end {
return and__;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions objc/generated/LeDefinedUUIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ J2OBJC_TYPE_LITERAL_HEADER(LeDefinedUUIDs)

@interface LeDefinedUUIDs_Service : NSObject

+ (JavaUtilUUID *)HEART_RATE;

+ (JavaUtilUUID *)CYCLING_POWER;

+ (JavaUtilUUID *)CYCLING_SPEED_AND_CADENCE;

+ (JavaUtilUUID *)BATTERY;

+ (JavaUtilUUID *)DEVICE_INFORMATION;

+ (JavaUtilUUID *)GENERIC_ATTRIBUTE;

#pragma mark Public

- (instancetype)init;
Expand Down Expand Up @@ -100,6 +112,32 @@ J2OBJC_TYPE_LITERAL_HEADER(LeDefinedUUIDs_Service)

@interface LeDefinedUUIDs_Characteristic : NSObject

+ (JavaUtilUUID *)HEART_RATE_MEASUREMENT;

+ (JavaUtilUUID *)MANUFACTURER_STRING;

+ (JavaUtilUUID *)MODEL_NUMBER_STRING;

+ (JavaUtilUUID *)SERIAL_NUMBER_STRING;

+ (JavaUtilUUID *)FIRMWARE_REVISION_STRING;

+ (JavaUtilUUID *)HARDWARE_REVISION_STRING;

+ (JavaUtilUUID *)APPEARANCE;

+ (JavaUtilUUID *)BODY_SENSOR_LOCATION;

+ (JavaUtilUUID *)BATTERY_LEVEL;

+ (JavaUtilUUID *)CYCLING_POWER_MEASUREMENT;

+ (JavaUtilUUID *)CYCLING_POWER_CONTROL_POINT;

+ (JavaUtilUUID *)CSC_MEASUREMENT;

+ (JavaUtilUUID *)SERVICE_CHANGED;

#pragma mark Public

- (instancetype)init;
Expand Down Expand Up @@ -190,6 +228,8 @@ J2OBJC_TYPE_LITERAL_HEADER(LeDefinedUUIDs_Characteristic)

@interface LeDefinedUUIDs_Descriptor : NSObject

+ (JavaUtilUUID *)CHAR_CLIENT_CONFIG;

#pragma mark Public

- (instancetype)init;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,30 @@ void LeDefinedUUIDs_init(LeDefinedUUIDs *self) {

@implementation LeDefinedUUIDs_Service

+ (JavaUtilUUID *)HEART_RATE {
return LeDefinedUUIDs_Service_HEART_RATE;
}

+ (JavaUtilUUID *)CYCLING_POWER {
return LeDefinedUUIDs_Service_CYCLING_POWER;
}

+ (JavaUtilUUID *)CYCLING_SPEED_AND_CADENCE {
return LeDefinedUUIDs_Service_CYCLING_SPEED_AND_CADENCE;
}

+ (JavaUtilUUID *)BATTERY {
return LeDefinedUUIDs_Service_BATTERY;
}

+ (JavaUtilUUID *)DEVICE_INFORMATION {
return LeDefinedUUIDs_Service_DEVICE_INFORMATION;
}

+ (JavaUtilUUID *)GENERIC_ATTRIBUTE {
return LeDefinedUUIDs_Service_GENERIC_ATTRIBUTE;
}

J2OBJC_IGNORE_DESIGNATED_BEGIN
- (instancetype)init {
LeDefinedUUIDs_Service_init(self);
Expand Down Expand Up @@ -130,6 +154,58 @@ void LeDefinedUUIDs_Service_init(LeDefinedUUIDs_Service *self) {

@implementation LeDefinedUUIDs_Characteristic

+ (JavaUtilUUID *)HEART_RATE_MEASUREMENT {
return LeDefinedUUIDs_Characteristic_HEART_RATE_MEASUREMENT;
}

+ (JavaUtilUUID *)MANUFACTURER_STRING {
return LeDefinedUUIDs_Characteristic_MANUFACTURER_STRING;
}

+ (JavaUtilUUID *)MODEL_NUMBER_STRING {
return LeDefinedUUIDs_Characteristic_MODEL_NUMBER_STRING;
}

+ (JavaUtilUUID *)SERIAL_NUMBER_STRING {
return LeDefinedUUIDs_Characteristic_SERIAL_NUMBER_STRING;
}

+ (JavaUtilUUID *)FIRMWARE_REVISION_STRING {
return LeDefinedUUIDs_Characteristic_FIRMWARE_REVISION_STRING;
}

+ (JavaUtilUUID *)HARDWARE_REVISION_STRING {
return LeDefinedUUIDs_Characteristic_HARDWARE_REVISION_STRING;
}

+ (JavaUtilUUID *)APPEARANCE {
return LeDefinedUUIDs_Characteristic_APPEARANCE;
}

+ (JavaUtilUUID *)BODY_SENSOR_LOCATION {
return LeDefinedUUIDs_Characteristic_BODY_SENSOR_LOCATION;
}

+ (JavaUtilUUID *)BATTERY_LEVEL {
return LeDefinedUUIDs_Characteristic_BATTERY_LEVEL;
}

+ (JavaUtilUUID *)CYCLING_POWER_MEASUREMENT {
return LeDefinedUUIDs_Characteristic_CYCLING_POWER_MEASUREMENT;
}

+ (JavaUtilUUID *)CYCLING_POWER_CONTROL_POINT {
return LeDefinedUUIDs_Characteristic_CYCLING_POWER_CONTROL_POINT;
}

+ (JavaUtilUUID *)CSC_MEASUREMENT {
return LeDefinedUUIDs_Characteristic_CSC_MEASUREMENT;
}

+ (JavaUtilUUID *)SERVICE_CHANGED {
return LeDefinedUUIDs_Characteristic_SERVICE_CHANGED;
}

J2OBJC_IGNORE_DESIGNATED_BEGIN
- (instancetype)init {
LeDefinedUUIDs_Characteristic_init(self);
Expand Down Expand Up @@ -206,6 +282,10 @@ void LeDefinedUUIDs_Characteristic_init(LeDefinedUUIDs_Characteristic *self) {

@implementation LeDefinedUUIDs_Descriptor

+ (JavaUtilUUID *)CHAR_CLIENT_CONFIG {
return LeDefinedUUIDs_Descriptor_CHAR_CLIENT_CONFIG;
}

J2OBJC_IGNORE_DESIGNATED_BEGIN
- (instancetype)init {
LeDefinedUUIDs_Descriptor_init(self);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions objc/generated/LeDeviceState.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ typedef NS_ENUM(NSUInteger, LeDeviceState_Enum) {

@interface LeDeviceState : JavaLangEnum < NSCopying >

+ (LeDeviceState * __nonnull)OFF;

+ (LeDeviceState * __nonnull)ON;

#pragma mark Public

+ (LeDeviceState *)valueOfWithNSString:(NSString *)name;
Expand All @@ -38,6 +42,7 @@ typedef NS_ENUM(NSUInteger, LeDeviceState_Enum) {
#pragma mark Package-Private

- (id)copyWithZone:(NSZone *)zone;
- (LeDeviceState_Enum)toNSEnum;

@end

Expand Down
12 changes: 12 additions & 0 deletions objc/generated/LeDeviceState.m → objc/generated/LeDeviceState.mm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@

@implementation LeDeviceState

+ (LeDeviceState *)OFF {
return JreEnum(LeDeviceState, OFF);
}

+ (LeDeviceState *)ON {
return JreEnum(LeDeviceState, ON);
}

+ (IOSObjectArray *)values {
return LeDeviceState_values();
}
Expand All @@ -25,6 +33,10 @@ + (LeDeviceState *)valueOfWithNSString:(NSString *)name {
return LeDeviceState_valueOfWithNSString_(name);
}

- (LeDeviceState_Enum)toNSEnum {
return (LeDeviceState_Enum)[self ordinal];
}

- (id)copyWithZone:(NSZone *)zone {
return self;
}
Expand Down
95 changes: 95 additions & 0 deletions objc/generated/LeEventType.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,100 @@ typedef NS_ENUM(NSUInteger, LeEventType_Enum) {

@interface LeEventType : JavaLangEnum < NSCopying, EventType >

+ (LeEventType * __nonnull)deviceStartScanning;

+ (LeEventType * __nonnull)deviceStopScanning;

+ (LeEventType * __nonnull)deviceRemoveListener;

+ (LeEventType * __nonnull)deviceCheckBleHardwareAvailable;

+ (LeEventType * __nonnull)deviceIsBtEnabled;

+ (LeEventType * __nonnull)deviceAddListener;

+ (LeEventType * __nonnull)remoteDeviceConnect;

+ (LeEventType * __nonnull)remoteDeviceStartServiceDiscovery;

+ (LeEventType * __nonnull)remoteDeviceClose;

+ (LeEventType * __nonnull)remoteDeviceDisconnect;

+ (LeEventType * __nonnull)serviceEnableCharacteristicNotification;

+ (LeEventType * __nonnull)remoteDeviceGetAddress;

+ (LeEventType * __nonnull)remoteDeviceAddListener;

+ (LeEventType * __nonnull)remoteDeviceRemoveListener;

+ (LeEventType * __nonnull)remoteDeviceSetCharacteristicListener;

+ (LeEventType * __nonnull)remoteDeviceSetCharacteristicWriteListener;

+ (LeEventType * __nonnull)remoteDeviceReadRssi;

+ (LeEventType * __nonnull)serviceGetUUID;

+ (LeEventType * __nonnull)characteristicGetValue;

+ (LeEventType * __nonnull)characteristicGetIntValue;

+ (LeEventType * __nonnull)remoteDeviceGetName;

+ (LeEventType * __nonnull)serviceGetCharacteristic;

+ (LeEventType * __nonnull)characteristicSetValue;

+ (LeEventType * __nonnull)characteristicRead;

+ (LeEventType * __nonnull)remoteDeviceFound;

+ (LeEventType * __nonnull)deviceState;

+ (LeEventType * __nonnull)mockRemoteDeviceFound;

+ (LeEventType * __nonnull)remoteDeviceConnected;

+ (LeEventType * __nonnull)mockRemoteDeviceConnected;

+ (LeEventType * __nonnull)remoteDeviceDisconnected;

+ (LeEventType * __nonnull)remoteDeviceClosed;

+ (LeEventType * __nonnull)mockRemoteDeviceDisconnected;

+ (LeEventType * __nonnull)mockRemoteDeviceClosed;

+ (LeEventType * __nonnull)remoteDeviceServicesDiscovered;

+ (LeEventType * __nonnull)remoteDeviceRssiRead;

+ (LeEventType * __nonnull)mockRemoteDeviceServicesDiscovered;

+ (LeEventType * __nonnull)deviceRemoteDeviceServicesDiscovered;

+ (LeEventType * __nonnull)characteristicChanged;

+ (LeEventType * __nonnull)characteristicNotificationChanged;

+ (LeEventType * __nonnull)characteristicWritten;

+ (LeEventType * __nonnull)mockCharacteristicChanged;

+ (LeEventType * __nonnull)mockCharacteristicChangedWithMockedValue;

+ (LeEventType * __nonnull)mockCharacteristicMockedValue;

+ (LeEventType * __nonnull)mockCharacteristicClearMockedValue;

+ (LeEventType * __nonnull)mockCharacteristicNotificationChanged;

+ (LeEventType * __nonnull)mockWaitForPoint;

+ (LeEventType * __nonnull)mockPointReached;

#pragma mark Public

+ (LeEventType *)valueOfWithNSString:(NSString *)name;
Expand All @@ -87,6 +181,7 @@ typedef NS_ENUM(NSUInteger, LeEventType_Enum) {
#pragma mark Package-Private

- (id)copyWithZone:(NSZone *)zone;
- (LeEventType_Enum)toNSEnum;

@end

Expand Down
Loading

0 comments on commit f5bccbc

Please sign in to comment.