Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
language: objective-c
osx_image: xcode7.3
#before_install:
# - brew update
# - brew install carthage
before_script:
- carthage bootstrap
before_deploy:
- carthage build --no-skip-current

cache: cocoapods
# podfile: Example/Podfile
podfile: Example/Podfile

# before_install:
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example
before_install:
- gem install cocoapods # Since Travis is not always on latest version
- pod install --project-directory=Example

script:
# TODO: Build the CocoaPods project
# - set -o pipefail && xcodebuild -workspace Example/xDripG5.xcworkspace -scheme xDripG5-Example -sdk iphonesimulator -destination name="iPhone 6" ONLY_ACTIVE_ARCH=NO | xcpretty
- set -o pipefail && xcodebuild -workspace Example/xDripG5.xcworkspace -scheme xDripG5-Example -sdk iphonesimulator -destination name="iPhone 6" ONLY_ACTIVE_ARCH=NO | xcpretty
- xctool -project xDripG5.xcodeproj -scheme xDripG5 -sdk iphonesimulator9.3 build test
- pod lib lint --allow-warnings
- pod lib lint
1 change: 0 additions & 1 deletion Cartfile

This file was deleted.

1 change: 0 additions & 1 deletion Cartfile.resolved

This file was deleted.

9 changes: 3 additions & 6 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
PODS:
- RNCryptor (4.0.0)
- xDripG5 (0.4.0):
- RNCryptor (~> 4.0)
- xDripG5 (0.5.0)

DEPENDENCIES:
- xDripG5 (from `../`)
Expand All @@ -11,9 +9,8 @@ EXTERNAL SOURCES:
:path: ../

SPEC CHECKSUMS:
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
xDripG5: ebd5b967768e7823b80c504b87256fd5dd55d469
xDripG5: 0e6b96df757adbd51d5aa24c1ef63cb25a2d2b72

PODFILE CHECKSUM: 6b30cba971694d5258509315fb52eb645c9bc5e3

COCOAPODS: 1.0.0
COCOAPODS: 1.0.1
18 changes: 9 additions & 9 deletions Example/xDripG5.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "xDripG5_Example" */;
buildPhases = (
1A9A76347F38888700DA6FA9 /* 📦 Check Pods Manifest.lock */,
1A9A76347F38888700DA6FA9 /* [CP] Check Pods Manifest.lock */,
607FACCC1AFB9204008FA782 /* Sources */,
607FACCD1AFB9204008FA782 /* Frameworks */,
607FACCE1AFB9204008FA782 /* Resources */,
4B912A9AD16911278D3DAA5C /* 📦 Embed Pods Frameworks */,
2FC4228A9369221D367ED688 /* 📦 Copy Pods Resources */,
4B912A9AD16911278D3DAA5C /* [CP] Embed Pods Frameworks */,
2FC4228A9369221D367ED688 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -189,44 +189,44 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
1A9A76347F38888700DA6FA9 /* 📦 Check Pods Manifest.lock */ = {
1A9A76347F38888700DA6FA9 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Check Pods Manifest.lock";
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
2FC4228A9369221D367ED688 /* 📦 Copy Pods Resources */ = {
2FC4228A9369221D367ED688 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Copy Pods Resources";
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-xDripG5_Example/Pods-xDripG5_Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
4B912A9AD16911278D3DAA5C /* 📦 Embed Pods Frameworks */ = {
4B912A9AD16911278D3DAA5C /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Embed Pods Frameworks";
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
3 changes: 2 additions & 1 deletion Pod/xDripG5.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
// Copyright © 2015 Nathan Racklyeft. All rights reserved.
//

@import RNCryptor;

#import <xDripG5/AESCrypt.h>
7 changes: 3 additions & 4 deletions xDripG5.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "xDripG5"
s.version = "0.4.1"
s.version = "0.5.0"
s.summary = "An interface for communicating with the G5 glucose transmitter over Bluetooth."

s.description = <<-DESC
Expand All @@ -20,9 +20,8 @@ Please note this project is neither created nor backed by Dexcom, Inc. Use of th
s.platform = :ios, '9.3'
s.requires_arc = true

s.source_files = ['xDripG5/**/*.swift', 'Pod/*.h']
s.public_header_files = 'Pod/*.h'
s.source_files = ['xDripG5/**/*.swift', 'xDripG5/AESCrypt.{h,m}', 'Pod/*.h']
s.public_header_files = ['Pod/*.h', 'xDripG5/AESCrypt.h']

s.frameworks = 'CoreBluetooth'
s.dependency 'RNCryptor', '~> 4.0'
end
34 changes: 13 additions & 21 deletions xDripG5.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

/* Begin PBXBuildFile section */
430D64C51CB7846A00FCA750 /* NSData+CRC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 430D64C41CB7846A00FCA750 /* NSData+CRC.swift */; };
4337D7EB1C351B0B0016851F /* CommonCrypto.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4337D7EA1C351B0B0016851F /* CommonCrypto.framework */; };
4337D7ED1C3521210016851F /* CommonCrypto.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4337D7EA1C351B0B0016851F /* CommonCrypto.framework */; };
434FD68A1C3523A7000B4E2E /* CommonCrypto.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4337D7EA1C351B0B0016851F /* CommonCrypto.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
43CABDF71C3506F100005705 /* xDripG5.h in Headers */ = {isa = PBXBuildFile; fileRef = 43CABDF61C3506F100005705 /* xDripG5.h */; settings = {ATTRIBUTES = (Public, ); }; };
43CABDFE1C3506F100005705 /* xDripG5.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43CABDF31C3506F100005705 /* xDripG5.framework */; };
43CABE121C350B2800005705 /* BluetoothManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43CABE0E1C350B2800005705 /* BluetoothManager.swift */; };
Expand Down Expand Up @@ -39,6 +36,8 @@
43CE7CDC1CA77468003CC1B0 /* TransmitterStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43CE7CDB1CA77468003CC1B0 /* TransmitterStatus.swift */; };
43DC87C01C8B509B005BC30D /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DC87BF1C8B509B005BC30D /* NSData.swift */; };
43DC87C21C8B520F005BC30D /* GlucoseRxMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DC87C11C8B520F005BC30D /* GlucoseRxMessageTests.swift */; };
43EEA7111D14DC0800CBBDA0 /* AESCrypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 43EEA70F1D14DC0800CBBDA0 /* AESCrypt.h */; settings = {ATTRIBUTES = (Public, ); }; };
43EEA7121D14DC0800CBBDA0 /* AESCrypt.m in Sources */ = {isa = PBXBuildFile; fileRef = 43EEA7101D14DC0800CBBDA0 /* AESCrypt.m */; };
43F82BCC1D035AA4006F5DD7 /* TransmitterTimeRxMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F82BCB1D035AA4006F5DD7 /* TransmitterTimeRxMessageTests.swift */; };
43F82BCE1D035D5C006F5DD7 /* SessionStartRxMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F82BCD1D035D5C006F5DD7 /* SessionStartRxMessage.swift */; };
43F82BD01D035D68006F5DD7 /* SessionStopRxMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F82BCF1D035D68006F5DD7 /* SessionStopRxMessage.swift */; };
Expand All @@ -63,15 +62,13 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
434FD68A1C3523A7000B4E2E /* CommonCrypto.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
430D64C41CB7846A00FCA750 /* NSData+CRC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSData+CRC.swift"; sourceTree = "<group>"; };
4337D7EA1C351B0B0016851F /* CommonCrypto.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CommonCrypto.framework; path = Carthage/Build/iOS/CommonCrypto.framework; sourceTree = "<group>"; };
43CABDF31C3506F100005705 /* xDripG5.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = xDripG5.framework; sourceTree = BUILT_PRODUCTS_DIR; };
43CABDF61C3506F100005705 /* xDripG5.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xDripG5.h; sourceTree = "<group>"; };
43CABDF81C3506F100005705 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -103,6 +100,8 @@
43CE7CDB1CA77468003CC1B0 /* TransmitterStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransmitterStatus.swift; sourceTree = "<group>"; };
43DC87BF1C8B509B005BC30D /* NSData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSData.swift; sourceTree = "<group>"; };
43DC87C11C8B520F005BC30D /* GlucoseRxMessageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlucoseRxMessageTests.swift; sourceTree = "<group>"; };
43EEA70F1D14DC0800CBBDA0 /* AESCrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AESCrypt.h; sourceTree = "<group>"; };
43EEA7101D14DC0800CBBDA0 /* AESCrypt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AESCrypt.m; sourceTree = "<group>"; };
43F82BCB1D035AA4006F5DD7 /* TransmitterTimeRxMessageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransmitterTimeRxMessageTests.swift; sourceTree = "<group>"; };
43F82BCD1D035D5C006F5DD7 /* SessionStartRxMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SessionStartRxMessage.swift; sourceTree = "<group>"; };
43F82BCF1D035D68006F5DD7 /* SessionStopRxMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SessionStopRxMessage.swift; sourceTree = "<group>"; };
Expand All @@ -115,15 +114,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4337D7EB1C351B0B0016851F /* CommonCrypto.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
43CABDFA1C3506F100005705 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4337D7ED1C3521210016851F /* CommonCrypto.framework in Frameworks */,
43CABDFE1C3506F100005705 /* xDripG5.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -134,7 +131,6 @@
43CABDE91C3506F100005705 = {
isa = PBXGroup;
children = (
4337D7EA1C351B0B0016851F /* CommonCrypto.framework */,
43CABDF51C3506F100005705 /* xDripG5 */,
43CABE011C3506F100005705 /* xDripG5Tests */,
43CABDF41C3506F100005705 /* Products */,
Expand Down Expand Up @@ -162,6 +158,8 @@
43CABE111C350B2800005705 /* Transmitter.swift */,
43CE7CDB1CA77468003CC1B0 /* TransmitterStatus.swift */,
43CABE161C350B2E00005705 /* Messages */,
43EEA70F1D14DC0800CBBDA0 /* AESCrypt.h */,
43EEA7101D14DC0800CBBDA0 /* AESCrypt.m */,
);
path = xDripG5;
sourceTree = "<group>";
Expand Down Expand Up @@ -215,6 +213,7 @@
buildActionMask = 2147483647;
files = (
43CABDF71C3506F100005705 /* xDripG5.h in Headers */,
43EEA7111D14DC0800CBBDA0 /* AESCrypt.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -264,7 +263,7 @@
43CABDEA1C3506F100005705 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Nathan Racklyeft";
TargetAttributes = {
Expand Down Expand Up @@ -328,6 +327,7 @@
43CABE2A1C350B3D00005705 /* GlucoseTxMessage.swift in Sources */,
43CE7CC81CA73AEB003CC1B0 /* FirmwareVersionTxMessage.swift in Sources */,
43CE7CCC1CA73BCC003CC1B0 /* BatteryStatusTxMessage.swift in Sources */,
43EEA7121D14DC0800CBBDA0 /* AESCrypt.m in Sources */,
43CE7CCE1CA73C22003CC1B0 /* SessionStartTxMessage.swift in Sources */,
43CABE2E1C350B3D00005705 /* TransmitterTimeTxMessage.swift in Sources */,
43CABE2C1C350B3D00005705 /* TransmitterMessage.swift in Sources */,
Expand Down Expand Up @@ -388,7 +388,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 10;
CURRENT_PROJECT_VERSION = 11;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -436,7 +436,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 10;
CURRENT_PROJECT_VERSION = 11;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -464,12 +464,8 @@
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 10;
DYLIB_CURRENT_VERSION = 11;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = xDripG5/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand All @@ -486,12 +482,8 @@
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 10;
DYLIB_CURRENT_VERSION = 11;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = xDripG5/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand Down
19 changes: 19 additions & 0 deletions xDripG5/AESCrypt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// AESCrypt.h
// xDripG5
//
// Created by Nate Racklyeft on 6/17/16.
// Copyright © 2016 Nathan Racklyeft. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface AESCrypt : NSObject

NS_ASSUME_NONNULL_BEGIN

+ (nullable NSData *)encryptData:(NSData *)data usingKey:(NSData *)key error:(NSError **)error;

NS_ASSUME_NONNULL_END

@end
33 changes: 33 additions & 0 deletions xDripG5/AESCrypt.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// AESCrypt.m
// xDripG5
//
// Created by Nate Racklyeft on 6/17/16.
// Copyright © 2016 Nathan Racklyeft. All rights reserved.
//

#import "AESCrypt.h"
#import <CommonCrypto/CommonCryptor.h>

@implementation AESCrypt

+ (NSData *)encryptData:(NSData *)data usingKey:(NSData *)key error:(NSError * _Nullable __autoreleasing *)error
{
NSMutableData *dataOut = [[NSMutableData alloc] initWithCapacity:16];

CCCryptorStatus status = CCCrypt(kCCEncrypt,
kCCAlgorithmAES,
kCCOptionECBMode,
key.bytes,
key.length,
NULL,
data.bytes,
data.length,
dataOut.mutableBytes,
dataOut.length,
NULL);

return status == kCCSuccess ? dataOut : nil;
}

@end
2 changes: 1 addition & 1 deletion xDripG5/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.4.2</string>
<string>0.5.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
22 changes: 4 additions & 18 deletions xDripG5/Transmitter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,31 +284,17 @@ public class Transmitter: BluetoothManagerDelegate {
}

private func calculateHash(data: NSData) -> NSData? {
guard data.length == 8, let key = cryptKey, outData = NSMutableData(length: 16) else {
guard data.length == 8, let key = cryptKey else {
return nil
}

let doubleData = NSMutableData(data: data)
doubleData.appendData(data)

let status = CCCrypt(
0, // kCCEncrypt
0, // kCCAlgorithmAES
0x0002, // kCCOptionECBMode
key.bytes,
key.length,
nil,
doubleData.bytes,
doubleData.length,
outData.mutableBytes,
outData.length,
nil
)

if status != 0 { // kCCSuccess
guard let outData = try? AESCrypt.encryptData(doubleData, usingKey: key) else {
return nil
} else {
return outData[0..<8]
}

return outData[0..<8]
}
}
Loading