├── README.md ├── SwiftSensorTag.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcuserdata │ └── anasimtiaz.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── SwiftSensorTag.xcscheme └── project.pbxproj ├── SwiftSensorTag ├── SwiftSensorTag.xcdatamodeld │ ├── .xccurrentversion │ └── SwiftSensorTag.xcdatamodel │ │ └── contents ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.xib ├── SensorTagTableViewCell.swift ├── AppDelegate.swift ├── SensorTag.swift └── ViewController.swift ├── SwiftSensorTagTests ├── Info.plist └── SwiftSensorTagTests.swift └── LICENSE.txt /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anasimtiaz/SwiftSensorTag/HEAD/README.md -------------------------------------------------------------------------------- /SwiftSensorTag.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftSensorTag/SwiftSensorTag.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | SwiftSensorTag.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftSensorTag/SwiftSensorTag.xcdatamodeld/SwiftSensorTag.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SwiftSensorTag.xcodeproj/xcuserdata/anasimtiaz.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SwiftSensorTag.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 97E4491D1A76A8EB00AECF47 16 | 17 | primary 18 | 19 | 20 | 97E449351A76A8EB00AECF47 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SwiftSensorTagTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SwiftSensorTagTests/SwiftSensorTagTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftSensorTagTests.swift 3 | // SwiftSensorTagTests 4 | // 5 | // Created by Anas Imtiaz on 26/01/2015. 6 | // Copyright (c) 2015 Anas Imtiaz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class SwiftSensorTagTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Syed Anas Imtiaz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /SwiftSensorTag/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /SwiftSensorTag/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | NSBluetoothAlwaysUsageDescription 40 | Connect to CC2650 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /SwiftSensorTag/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /SwiftSensorTag/SensorTagTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SensorTagTableViewCell.swift 3 | // SwiftSensorTag 4 | // 5 | // Created by Anas Imtiaz on 13/11/2015. 6 | // Copyright © 2015 Anas Imtiaz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SensorTagTableViewCell: UITableViewCell { 12 | 13 | var sensorNameLabel = UILabel() 14 | var sensorValueLabel = UILabel() 15 | 16 | override func awakeFromNib() { 17 | super.awakeFromNib() 18 | // Initialization code 19 | } 20 | 21 | override func setSelected(_ selected: Bool, animated: Bool) { 22 | super.setSelected(selected, animated: animated) 23 | 24 | // Configure the view for the selected state 25 | } 26 | 27 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 28 | super.init(style: style, reuseIdentifier: reuseIdentifier) 29 | 30 | // sensor name 31 | self.addSubview(sensorNameLabel) 32 | sensorNameLabel.font = UIFont(name: "HelveticaNeue", size: 18) 33 | sensorNameLabel.frame = CGRect(x: self.bounds.origin.x+self.layoutMargins.left*2, y: self.bounds.origin.y, width: self.frame.width, height: self.frame.height) 34 | sensorNameLabel.textAlignment = NSTextAlignment.left 35 | sensorNameLabel.text = "Sensor Name Label" 36 | 37 | // sensor value 38 | self.addSubview(sensorValueLabel) 39 | sensorValueLabel.font = UIFont(name: "HelveticaNeue", size: 18) 40 | sensorValueLabel.frame = CGRect(x: self.bounds.origin.x, y: self.bounds.origin.y, width: self.frame.width, height: self.frame.height) 41 | sensorValueLabel.textAlignment = NSTextAlignment.right 42 | sensorValueLabel.text = "Value" 43 | } 44 | 45 | required init(coder aDecoder: NSCoder) { 46 | fatalError("init(coder:) has not been implemented") 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /SwiftSensorTag/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /SwiftSensorTag.xcodeproj/xcuserdata/anasimtiaz.xcuserdatad/xcschemes/SwiftSensorTag.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | 47 | 53 | 54 | 55 | 56 | 57 | 58 | 68 | 70 | 76 | 77 | 78 | 79 | 80 | 81 | 87 | 89 | 95 | 96 | 97 | 98 | 100 | 101 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /SwiftSensorTag/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftSensorTag 4 | // 5 | // Created by Anas Imtiaz on 13/11/2015. 6 | // Copyright © 2015 Anas Imtiaz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreData 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 19 | // Override point for customization after application launch. 20 | return true 21 | } 22 | 23 | func applicationWillResignActive(_ application: UIApplication) { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 26 | } 27 | 28 | func applicationDidEnterBackground(_ application: UIApplication) { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | func applicationWillEnterForeground(_ application: UIApplication) { 34 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | func applicationDidBecomeActive(_ application: UIApplication) { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | func applicationWillTerminate(_ application: UIApplication) { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | // Saves changes in the application's managed object context before the application terminates. 44 | self.saveContext() 45 | } 46 | 47 | // MARK: - Core Data stack 48 | 49 | lazy var persistentContainer: NSPersistentContainer = { 50 | /* 51 | The persistent container for the application. This implementation 52 | creates and returns a container, having loaded the store for the 53 | application to it. This property is optional since there are legitimate 54 | error conditions that could cause the creation of the store to fail. 55 | */ 56 | let container = NSPersistentContainer(name: "tests") 57 | container.loadPersistentStores(completionHandler: { (storeDescription, error) in 58 | if let error = error as NSError? { 59 | // Replace this implementation with code to handle the error appropriately. 60 | // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 61 | 62 | /* 63 | Typical reasons for an error here include: 64 | * The parent directory does not exist, cannot be created, or disallows writing. 65 | * The persistent store is not accessible, due to permissions or data protection when the device is locked. 66 | * The device is out of space. 67 | * The store could not be migrated to the current model version. 68 | Check the error message to determine what the actual problem was. 69 | */ 70 | fatalError("Unresolved error \(error), \(error.userInfo)") 71 | } 72 | }) 73 | return container 74 | }() 75 | 76 | // MARK: - Core Data Saving support 77 | 78 | func saveContext () { 79 | let context = persistentContainer.viewContext 80 | if context.hasChanges { 81 | do { 82 | try context.save() 83 | } catch { 84 | // Replace this implementation with code to handle the error appropriately. 85 | // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 86 | let nserror = error as NSError 87 | fatalError("Unresolved error \(nserror), \(nserror.userInfo)") 88 | } 89 | } 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /SwiftSensorTag/SensorTag.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SensorTag.swift 3 | // SwiftSensorTag 4 | // 5 | // Created by Anas Imtiaz on 13/11/2015. 6 | // Copyright © 2015 Anas Imtiaz. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreBluetooth 11 | 12 | 13 | let deviceName = "SensorTag" 14 | 15 | // Service UUIDs 16 | let IRTemperatureServiceUUID = CBUUID(string: "F000AA00-0451-4000-B000-000000000000") 17 | let HumidityServiceUUID = CBUUID(string: "F000AA20-0451-4000-B000-000000000000") 18 | let BarometerServiceUUID = CBUUID(string: "F000AA40-0451-4000-B000-000000000000") 19 | let LuxometerServiceUUID = CBUUID(string: "F000AA70-0451-4000-B000-000000000000") 20 | let MovementServiceUUID = CBUUID(string: "F000AA80-0451-4000-B000-000000000000") 21 | 22 | // Characteristic UUIDs 23 | let IRTemperatureDataUUID = CBUUID(string: "F000AA01-0451-4000-B000-000000000000") 24 | let IRTemperatureConfigUUID = CBUUID(string: "F000AA02-0451-4000-B000-000000000000") 25 | let HumidityDataUUID = CBUUID(string: "F000AA21-0451-4000-B000-000000000000") 26 | let HumidityConfigUUID = CBUUID(string: "F000AA22-0451-4000-B000-000000000000") 27 | let BarometerDataUUID = CBUUID(string: "F000AA41-0451-4000-B000-000000000000") 28 | let BarometerConfigUUID = CBUUID(string: "F000AA42-0451-4000-B000-000000000000") 29 | let LuxometerDataUUID = CBUUID(string: "F000AA71-0451-4000-B000-000000000000") 30 | let LuxometerConfigUUID = CBUUID(string: "F000AA72-0451-4000-B000-000000000000") 31 | let MovementDataUUID = CBUUID(string: "F000AA81-0451-4000-B000-000000000000") 32 | let MovementConfigUUID = CBUUID(string: "F000AA82-0451-4000-B000-000000000000") 33 | 34 | 35 | class SensorTag { 36 | 37 | // Check name of device from advertisement data 38 | class func sensorTagFound (advertisementData: [String : Any]!) -> Bool { 39 | if (advertisementData["kCBAdvDataLocalName"]) != nil { 40 | let advData = advertisementData["kCBAdvDataLocalName"] as! String 41 | return(advData.range(of: deviceName) != nil) 42 | } 43 | return false 44 | } 45 | 46 | 47 | // Check if the service has a valid UUID 48 | class func validService (service : CBService) -> Bool { 49 | if service.uuid == IRTemperatureServiceUUID || service.uuid == MovementServiceUUID || 50 | service.uuid == HumidityServiceUUID || service.uuid == LuxometerServiceUUID || 51 | service.uuid == BarometerServiceUUID { 52 | return true 53 | } 54 | else { 55 | return false 56 | } 57 | } 58 | 59 | 60 | // Check if the characteristic has a valid data UUID 61 | class func validDataCharacteristic (characteristic : CBCharacteristic) -> Bool { 62 | if characteristic.uuid == IRTemperatureDataUUID || characteristic.uuid == MovementDataUUID || 63 | characteristic.uuid == HumidityDataUUID || characteristic.uuid == LuxometerDataUUID || 64 | characteristic.uuid == BarometerDataUUID { 65 | return true 66 | } 67 | else { 68 | return false 69 | } 70 | } 71 | 72 | 73 | // Check if the characteristic has a valid config UUID 74 | class func validConfigCharacteristic (characteristic : CBCharacteristic) -> Bool { 75 | if characteristic.uuid == IRTemperatureConfigUUID || characteristic.uuid == MovementConfigUUID || 76 | characteristic.uuid == HumidityConfigUUID || characteristic.uuid == LuxometerConfigUUID || 77 | characteristic.uuid == BarometerConfigUUID { 78 | return true 79 | } 80 | else { 81 | return false 82 | } 83 | } 84 | 85 | 86 | // Get labels of all sensors 87 | class func getSensorLabels () -> [String] { 88 | let sensorLabels : [String] = [ 89 | "Ambient Temperature", 90 | "Object Temperature", 91 | "Accelerometer X", 92 | "Accelerometer Y", 93 | "Accelerometer Z", 94 | "Relative Humidity", 95 | "Magnetometer X", 96 | "Magnetometer Y", 97 | "Magnetometer Z", 98 | "Gyroscope X", 99 | "Gyroscope Y", 100 | "Gyroscope Z" 101 | ] 102 | return sensorLabels 103 | } 104 | 105 | 106 | 107 | // Process the values from sensor 108 | 109 | 110 | // Convert NSData to array of bytes 111 | class func dataToSignedBytes16(value : NSData, count: Int) -> [Int16] { 112 | var array = [Int16](repeating: 0, count: count) 113 | value.getBytes(&array, length:count * MemoryLayout.size) 114 | return array 115 | } 116 | 117 | class func dataToUnsignedBytes16(value : NSData, count: Int) -> [UInt16] { 118 | var array = [UInt16](repeating: 0, count: count) 119 | value.getBytes(&array, length:count * MemoryLayout.size) 120 | return array 121 | } 122 | 123 | class func dataToSignedBytes8(value : NSData, count: Int) -> [Int8] { 124 | var array = [Int8](repeating: 0, count: count) 125 | value.getBytes(&array, length:count * MemoryLayout.size) 126 | return array 127 | } 128 | 129 | // Get ambient temperature value 130 | class func getTemperatureData(value : NSData) -> [Double] { 131 | // The TMP007 IR Temperature sensor is not fitted on SensorTags produced after June 2017. 132 | let dataFromSensor = dataToSignedBytes16(value: value, count: 2) 133 | let ambientTemperature = Double(dataFromSensor[1])/128 134 | let Vobj2 = Double(dataFromSensor[0]) * 0.00000015625 135 | 136 | let Tdie2 = ambientTemperature + 273.15 137 | let Tref = 298.15 138 | 139 | let S0 = 6.4e-14 140 | let a1 = 1.75E-3 141 | let a2 = -1.678E-5 142 | let b0 = -2.94E-5 143 | let b1 = -5.7E-7 144 | let b2 = 4.63E-9 145 | let c2 = 13.4 146 | 147 | let S = S0*(1+a1*(Tdie2 - Tref)+a2*pow((Tdie2 - Tref),2)) 148 | let Vos = b0 + b1*(Tdie2 - Tref) + b2*pow((Tdie2 - Tref),2) 149 | let fObj = (Vobj2 - Vos) + c2*pow((Vobj2 - Vos),2) 150 | let tObj = pow(pow(Tdie2,4) + (fObj/S),0.25) 151 | 152 | let objectTemperature = (tObj - 273.15) 153 | 154 | return [objectTemperature, ambientTemperature] 155 | } 156 | 157 | // Get Accelerometer values 158 | class func getMovementData(value: NSData) -> [Double] { 159 | let dataFromSensor = dataToSignedBytes16(value: value, count: 9) 160 | let gx = Double(dataFromSensor[0]) * 500.0 / 65536.0 161 | let gy = Double(dataFromSensor[1]) * 500.0 / 65536.0 162 | let gz = Double(dataFromSensor[2]) * 500.0 / 65536.0 163 | let range = 2.0 164 | let ax = Double(dataFromSensor[3]) * range / 32768.0 165 | let ay = Double(dataFromSensor[4]) * range / 32768.0 166 | let az = Double(dataFromSensor[5]) * range / 32768.0 167 | let mx = Double(dataFromSensor[6]) 168 | let my = Double(dataFromSensor[7]) 169 | let mz = Double(dataFromSensor[8]) 170 | return [gx, gy, gz, ax, ay, az, mx, my, mz] 171 | } 172 | 173 | // Get Relative Humidity 174 | class func getRelativeHumidity(value: NSData) -> Double { 175 | let dataFromSensor = dataToUnsignedBytes16(value: value, count: 2) 176 | let humidity = -6 + 125/65536 * Double(dataFromSensor[1]) 177 | return humidity 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /SwiftSensorTag/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SwiftSensorTag 4 | // 5 | // Created by Anas Imtiaz on 13/11/2015. 6 | // Copyright © 2015 Anas Imtiaz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreBluetooth 11 | 12 | class ViewController: UIViewController, CBCentralManagerDelegate, CBPeripheralDelegate, UITableViewDataSource, UITableViewDelegate { 13 | 14 | // Title labels 15 | var titleLabel : UILabel! 16 | var statusLabel : UILabel! 17 | 18 | // BLE 19 | var centralManager : CBCentralManager! 20 | var sensorTagPeripheral : CBPeripheral! 21 | 22 | // Table View 23 | var sensorTagTableView : UITableView! 24 | 25 | // Sensor Values 26 | var allSensorLabels : [String] = [] 27 | var allSensorValues : [Double] = [] 28 | var ambientTemperature : Double! 29 | var objectTemperature : Double! 30 | var accelerometerX : Double! 31 | var accelerometerY : Double! 32 | var accelerometerZ : Double! 33 | var relativeHumidity : Double! 34 | var magnetometerX : Double! 35 | var magnetometerY : Double! 36 | var magnetometerZ : Double! 37 | var gyroscopeX : Double! 38 | var gyroscopeY : Double! 39 | var gyroscopeZ : Double! 40 | 41 | override func viewDidLoad() { 42 | super.viewDidLoad() 43 | // Do any additional setup after loading the view, typically from a nib. 44 | 45 | // Initialize central manager on load 46 | centralManager = CBCentralManager(delegate: self, queue: nil) 47 | 48 | // Set up title label 49 | titleLabel = UILabel() 50 | titleLabel.text = "Sensor Tag" 51 | titleLabel.font = UIFont(name: "HelveticaNeue-Bold", size: 20) 52 | titleLabel.sizeToFit() 53 | titleLabel.center = CGPoint(x: self.view.frame.midX, y: self.titleLabel.bounds.midY+28) 54 | self.view.addSubview(titleLabel) 55 | 56 | // Set up status label 57 | statusLabel = UILabel() 58 | statusLabel.textAlignment = NSTextAlignment.center 59 | statusLabel.text = "Loading..." 60 | statusLabel.font = UIFont(name: "HelveticaNeue-Light", size: 12) 61 | statusLabel.sizeToFit() 62 | //statusLabel.center = CGPoint(x: self.view.frame.midX, y: (titleLabel.frame.maxY + statusLabel.bounds.height/2) ) 63 | statusLabel.frame = CGRect(x: self.view.frame.origin.x, y: self.titleLabel.frame.maxY, width: self.view.frame.width, height: self.statusLabel.bounds.height) 64 | self.view.addSubview(statusLabel) 65 | 66 | // Set up table view 67 | setupSensorTagTableView() 68 | 69 | // Initialize all sensor values and labels 70 | allSensorLabels = SensorTag.getSensorLabels() 71 | for _ in 0...size : MemoryLayout.size) 170 | self.sensorTagPeripheral.writeValue(enablyBytes as Data, for: thisCharacteristic, type: CBCharacteristicWriteType.withResponse) 171 | } 172 | } 173 | 174 | } 175 | 176 | 177 | 178 | // Get data values when they are updated 179 | func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) { 180 | 181 | self.statusLabel.text = "Connected" 182 | 183 | if characteristic.uuid == IRTemperatureDataUUID { 184 | let allValues = SensorTag.getTemperatureData(value: characteristic.value! as NSData) 185 | self.objectTemperature = allValues[0] 186 | self.ambientTemperature = allValues[1] 187 | self.allSensorValues[0] = self.ambientTemperature 188 | self.allSensorValues[1] = self.objectTemperature 189 | } 190 | else if characteristic.uuid == MovementDataUUID { 191 | let allValues = SensorTag.getMovementData(value: characteristic.value! as NSData) 192 | self.gyroscopeX = allValues[0] 193 | self.gyroscopeY = allValues[1] 194 | self.gyroscopeZ = allValues[2] 195 | self.accelerometerX = allValues[3] 196 | self.accelerometerY = allValues[4] 197 | self.accelerometerZ = allValues[5] 198 | self.magnetometerX = allValues[6] 199 | self.magnetometerY = allValues[7] 200 | self.magnetometerZ = allValues[8] 201 | self.allSensorValues[2] = self.accelerometerX 202 | self.allSensorValues[3] = self.accelerometerY 203 | self.allSensorValues[4] = self.accelerometerZ 204 | self.allSensorValues[6] = self.magnetometerX 205 | self.allSensorValues[7] = self.magnetometerY 206 | self.allSensorValues[8] = self.magnetometerZ 207 | self.allSensorValues[9] = self.gyroscopeX 208 | self.allSensorValues[10] = self.gyroscopeY 209 | self.allSensorValues[11] = self.gyroscopeZ 210 | } 211 | else if characteristic.uuid == HumidityDataUUID { 212 | self.relativeHumidity = SensorTag.getRelativeHumidity(value: characteristic.value! as NSData) 213 | self.allSensorValues[5] = self.relativeHumidity 214 | } 215 | else if characteristic.uuid == BarometerDataUUID { 216 | //println("BarometerDataUUID") 217 | } 218 | 219 | self.sensorTagTableView.reloadData() 220 | } 221 | 222 | 223 | 224 | 225 | 226 | /******* UITableViewDataSource *******/ 227 | 228 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 229 | return allSensorLabels.count 230 | } 231 | 232 | 233 | 234 | /******* UITableViewDelegate *******/ 235 | 236 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 237 | 238 | let thisCell = tableView.dequeueReusableCell(withIdentifier: "sensorTagCell") as! SensorTagTableViewCell 239 | thisCell.sensorNameLabel.text = allSensorLabels[indexPath.row] 240 | 241 | let valueString = NSString(format: "%.2f", allSensorValues[indexPath.row]) 242 | thisCell.sensorValueLabel.text = valueString as String 243 | 244 | return thisCell 245 | } 246 | 247 | 248 | 249 | 250 | /******* Helper *******/ 251 | 252 | // Show alert 253 | func showAlertWithText (header : String = "Warning", message : String) { 254 | let alert = UIAlertController(title: header, message: message, preferredStyle: UIAlertController.Style.alert) 255 | alert.addAction(UIAlertAction(title: "Ok", style: UIAlertAction.Style.default, handler: nil)) 256 | alert.view.tintColor = UIColor.red 257 | self.present(alert, animated: true, completion: nil) 258 | } 259 | 260 | 261 | // Set up Table View 262 | func setupSensorTagTableView () { 263 | 264 | self.sensorTagTableView = UITableView() 265 | self.sensorTagTableView.delegate = self 266 | self.sensorTagTableView.dataSource = self 267 | 268 | 269 | self.sensorTagTableView.frame = CGRect(x: self.view.bounds.origin.x, y: self.statusLabel.frame.maxY+20, width: self.view.bounds.width, height: self.view.bounds.height) 270 | 271 | self.sensorTagTableView.register(SensorTagTableViewCell.self, forCellReuseIdentifier: "sensorTagCell") 272 | 273 | self.sensorTagTableView.tableFooterView = UIView() // to hide empty lines after cells 274 | self.view.addSubview(self.sensorTagTableView) 275 | } 276 | } 277 | 278 | -------------------------------------------------------------------------------- /SwiftSensorTag.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 97E449241A76A8EB00AECF47 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97E449231A76A8EB00AECF47 /* AppDelegate.swift */; }; 11 | 97E449271A76A8EB00AECF47 /* SwiftSensorTag.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 97E449251A76A8EB00AECF47 /* SwiftSensorTag.xcdatamodeld */; }; 12 | 97E449291A76A8EB00AECF47 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97E449281A76A8EB00AECF47 /* ViewController.swift */; }; 13 | 97E4492C1A76A8EB00AECF47 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97E4492A1A76A8EB00AECF47 /* Main.storyboard */; }; 14 | 97E4492E1A76A8EB00AECF47 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97E4492D1A76A8EB00AECF47 /* Images.xcassets */; }; 15 | 97E449311A76A8EB00AECF47 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 97E4492F1A76A8EB00AECF47 /* LaunchScreen.xib */; }; 16 | 97E4493D1A76A8EB00AECF47 /* SwiftSensorTagTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97E4493C1A76A8EB00AECF47 /* SwiftSensorTagTests.swift */; }; 17 | 97E449471A76A91B00AECF47 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97E449461A76A91B00AECF47 /* CoreBluetooth.framework */; }; 18 | 97E449491A76AA8E00AECF47 /* SensorTag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97E449481A76AA8E00AECF47 /* SensorTag.swift */; }; 19 | 97E4494B1A77AD6800AECF47 /* SensorTagTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97E4494A1A77AD6800AECF47 /* SensorTagTableViewCell.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 97E449371A76A8EB00AECF47 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 97E449161A76A8EB00AECF47 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 97E4491D1A76A8EB00AECF47; 28 | remoteInfo = SwiftSensorTag; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 97E4491E1A76A8EB00AECF47 /* SwiftSensorTag.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftSensorTag.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 97E449221A76A8EB00AECF47 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 97E449231A76A8EB00AECF47 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 36 | 97E449261A76A8EB00AECF47 /* SwiftSensorTag.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = SwiftSensorTag.xcdatamodel; sourceTree = ""; }; 37 | 97E449281A76A8EB00AECF47 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 38 | 97E4492B1A76A8EB00AECF47 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 97E4492D1A76A8EB00AECF47 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | 97E449301A76A8EB00AECF47 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 41 | 97E449361A76A8EB00AECF47 /* SwiftSensorTagTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftSensorTagTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 97E4493B1A76A8EB00AECF47 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 97E4493C1A76A8EB00AECF47 /* SwiftSensorTagTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftSensorTagTests.swift; sourceTree = ""; }; 44 | 97E449461A76A91B00AECF47 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; }; 45 | 97E449481A76AA8E00AECF47 /* SensorTag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SensorTag.swift; sourceTree = ""; }; 46 | 97E4494A1A77AD6800AECF47 /* SensorTagTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SensorTagTableViewCell.swift; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 97E4491B1A76A8EB00AECF47 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | 97E449471A76A91B00AECF47 /* CoreBluetooth.framework in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | 97E449331A76A8EB00AECF47 /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 97E449151A76A8EB00AECF47 = { 69 | isa = PBXGroup; 70 | children = ( 71 | 97E449461A76A91B00AECF47 /* CoreBluetooth.framework */, 72 | 97E449201A76A8EB00AECF47 /* SwiftSensorTag */, 73 | 97E449391A76A8EB00AECF47 /* SwiftSensorTagTests */, 74 | 97E4491F1A76A8EB00AECF47 /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97E4491F1A76A8EB00AECF47 /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97E4491E1A76A8EB00AECF47 /* SwiftSensorTag.app */, 82 | 97E449361A76A8EB00AECF47 /* SwiftSensorTagTests.xctest */, 83 | ); 84 | name = Products; 85 | sourceTree = ""; 86 | }; 87 | 97E449201A76A8EB00AECF47 /* SwiftSensorTag */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 97E449231A76A8EB00AECF47 /* AppDelegate.swift */, 91 | 97E449281A76A8EB00AECF47 /* ViewController.swift */, 92 | 97E449481A76AA8E00AECF47 /* SensorTag.swift */, 93 | 97E4494A1A77AD6800AECF47 /* SensorTagTableViewCell.swift */, 94 | 97E4492A1A76A8EB00AECF47 /* Main.storyboard */, 95 | 97E4492D1A76A8EB00AECF47 /* Images.xcassets */, 96 | 97E4492F1A76A8EB00AECF47 /* LaunchScreen.xib */, 97 | 97E449251A76A8EB00AECF47 /* SwiftSensorTag.xcdatamodeld */, 98 | 97E449211A76A8EB00AECF47 /* Supporting Files */, 99 | ); 100 | path = SwiftSensorTag; 101 | sourceTree = ""; 102 | }; 103 | 97E449211A76A8EB00AECF47 /* Supporting Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 97E449221A76A8EB00AECF47 /* Info.plist */, 107 | ); 108 | name = "Supporting Files"; 109 | sourceTree = ""; 110 | }; 111 | 97E449391A76A8EB00AECF47 /* SwiftSensorTagTests */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 97E4493C1A76A8EB00AECF47 /* SwiftSensorTagTests.swift */, 115 | 97E4493A1A76A8EB00AECF47 /* Supporting Files */, 116 | ); 117 | path = SwiftSensorTagTests; 118 | sourceTree = ""; 119 | }; 120 | 97E4493A1A76A8EB00AECF47 /* Supporting Files */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 97E4493B1A76A8EB00AECF47 /* Info.plist */, 124 | ); 125 | name = "Supporting Files"; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | 97E4491D1A76A8EB00AECF47 /* SwiftSensorTag */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = 97E449401A76A8EB00AECF47 /* Build configuration list for PBXNativeTarget "SwiftSensorTag" */; 134 | buildPhases = ( 135 | 97E4491A1A76A8EB00AECF47 /* Sources */, 136 | 97E4491B1A76A8EB00AECF47 /* Frameworks */, 137 | 97E4491C1A76A8EB00AECF47 /* Resources */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | ); 143 | name = SwiftSensorTag; 144 | productName = SwiftSensorTag; 145 | productReference = 97E4491E1A76A8EB00AECF47 /* SwiftSensorTag.app */; 146 | productType = "com.apple.product-type.application"; 147 | }; 148 | 97E449351A76A8EB00AECF47 /* SwiftSensorTagTests */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 97E449431A76A8EB00AECF47 /* Build configuration list for PBXNativeTarget "SwiftSensorTagTests" */; 151 | buildPhases = ( 152 | 97E449321A76A8EB00AECF47 /* Sources */, 153 | 97E449331A76A8EB00AECF47 /* Frameworks */, 154 | 97E449341A76A8EB00AECF47 /* Resources */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | 97E449381A76A8EB00AECF47 /* PBXTargetDependency */, 160 | ); 161 | name = SwiftSensorTagTests; 162 | productName = SwiftSensorTagTests; 163 | productReference = 97E449361A76A8EB00AECF47 /* SwiftSensorTagTests.xctest */; 164 | productType = "com.apple.product-type.bundle.unit-test"; 165 | }; 166 | /* End PBXNativeTarget section */ 167 | 168 | /* Begin PBXProject section */ 169 | 97E449161A76A8EB00AECF47 /* Project object */ = { 170 | isa = PBXProject; 171 | attributes = { 172 | LastSwiftMigration = 0710; 173 | LastSwiftUpdateCheck = 0710; 174 | LastUpgradeCheck = 1010; 175 | ORGANIZATIONNAME = "Anas Imtiaz"; 176 | TargetAttributes = { 177 | 97E4491D1A76A8EB00AECF47 = { 178 | CreatedOnToolsVersion = 6.1.1; 179 | DevelopmentTeam = 7JY26JM8HL; 180 | LastSwiftMigration = 1140; 181 | }; 182 | 97E449351A76A8EB00AECF47 = { 183 | CreatedOnToolsVersion = 6.1.1; 184 | LastSwiftMigration = 1140; 185 | TestTargetID = 97E4491D1A76A8EB00AECF47; 186 | }; 187 | }; 188 | }; 189 | buildConfigurationList = 97E449191A76A8EB00AECF47 /* Build configuration list for PBXProject "SwiftSensorTag" */; 190 | compatibilityVersion = "Xcode 10.0"; 191 | developmentRegion = en; 192 | hasScannedForEncodings = 0; 193 | knownRegions = ( 194 | en, 195 | Base, 196 | ); 197 | mainGroup = 97E449151A76A8EB00AECF47; 198 | productRefGroup = 97E4491F1A76A8EB00AECF47 /* Products */; 199 | projectDirPath = ""; 200 | projectRoot = ""; 201 | targets = ( 202 | 97E4491D1A76A8EB00AECF47 /* SwiftSensorTag */, 203 | 97E449351A76A8EB00AECF47 /* SwiftSensorTagTests */, 204 | ); 205 | }; 206 | /* End PBXProject section */ 207 | 208 | /* Begin PBXResourcesBuildPhase section */ 209 | 97E4491C1A76A8EB00AECF47 /* Resources */ = { 210 | isa = PBXResourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | 97E4492C1A76A8EB00AECF47 /* Main.storyboard in Resources */, 214 | 97E449311A76A8EB00AECF47 /* LaunchScreen.xib in Resources */, 215 | 97E4492E1A76A8EB00AECF47 /* Images.xcassets in Resources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | 97E449341A76A8EB00AECF47 /* Resources */ = { 220 | isa = PBXResourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXResourcesBuildPhase section */ 227 | 228 | /* Begin PBXSourcesBuildPhase section */ 229 | 97E4491A1A76A8EB00AECF47 /* Sources */ = { 230 | isa = PBXSourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | 97E449491A76AA8E00AECF47 /* SensorTag.swift in Sources */, 234 | 97E449291A76A8EB00AECF47 /* ViewController.swift in Sources */, 235 | 97E449271A76A8EB00AECF47 /* SwiftSensorTag.xcdatamodeld in Sources */, 236 | 97E449241A76A8EB00AECF47 /* AppDelegate.swift in Sources */, 237 | 97E4494B1A77AD6800AECF47 /* SensorTagTableViewCell.swift in Sources */, 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | 97E449321A76A8EB00AECF47 /* Sources */ = { 242 | isa = PBXSourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | 97E4493D1A76A8EB00AECF47 /* SwiftSensorTagTests.swift in Sources */, 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | }; 249 | /* End PBXSourcesBuildPhase section */ 250 | 251 | /* Begin PBXTargetDependency section */ 252 | 97E449381A76A8EB00AECF47 /* PBXTargetDependency */ = { 253 | isa = PBXTargetDependency; 254 | target = 97E4491D1A76A8EB00AECF47 /* SwiftSensorTag */; 255 | targetProxy = 97E449371A76A8EB00AECF47 /* PBXContainerItemProxy */; 256 | }; 257 | /* End PBXTargetDependency section */ 258 | 259 | /* Begin PBXVariantGroup section */ 260 | 97E4492A1A76A8EB00AECF47 /* Main.storyboard */ = { 261 | isa = PBXVariantGroup; 262 | children = ( 263 | 97E4492B1A76A8EB00AECF47 /* Base */, 264 | ); 265 | name = Main.storyboard; 266 | sourceTree = ""; 267 | }; 268 | 97E4492F1A76A8EB00AECF47 /* LaunchScreen.xib */ = { 269 | isa = PBXVariantGroup; 270 | children = ( 271 | 97E449301A76A8EB00AECF47 /* Base */, 272 | ); 273 | name = LaunchScreen.xib; 274 | sourceTree = ""; 275 | }; 276 | /* End PBXVariantGroup section */ 277 | 278 | /* Begin XCBuildConfiguration section */ 279 | 97E4493E1A76A8EB00AECF47 /* Debug */ = { 280 | isa = XCBuildConfiguration; 281 | buildSettings = { 282 | ALWAYS_SEARCH_USER_PATHS = NO; 283 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 284 | CLANG_CXX_LIBRARY = "libc++"; 285 | CLANG_ENABLE_MODULES = YES; 286 | CLANG_ENABLE_OBJC_ARC = YES; 287 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_COMMA = YES; 290 | CLANG_WARN_CONSTANT_CONVERSION = YES; 291 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 292 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 293 | CLANG_WARN_EMPTY_BODY = YES; 294 | CLANG_WARN_ENUM_CONVERSION = YES; 295 | CLANG_WARN_INFINITE_RECURSION = YES; 296 | CLANG_WARN_INT_CONVERSION = YES; 297 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 298 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 299 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 300 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 301 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 302 | CLANG_WARN_STRICT_PROTOTYPES = YES; 303 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 304 | CLANG_WARN_UNREACHABLE_CODE = YES; 305 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 306 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 307 | COPY_PHASE_STRIP = NO; 308 | ENABLE_STRICT_OBJC_MSGSEND = YES; 309 | ENABLE_TESTABILITY = YES; 310 | GCC_C_LANGUAGE_STANDARD = gnu99; 311 | GCC_DYNAMIC_NO_PIC = NO; 312 | GCC_NO_COMMON_BLOCKS = YES; 313 | GCC_OPTIMIZATION_LEVEL = 0; 314 | GCC_PREPROCESSOR_DEFINITIONS = ( 315 | "DEBUG=1", 316 | "$(inherited)", 317 | ); 318 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 319 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 320 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 321 | GCC_WARN_UNDECLARED_SELECTOR = YES; 322 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 323 | GCC_WARN_UNUSED_FUNCTION = YES; 324 | GCC_WARN_UNUSED_VARIABLE = YES; 325 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 326 | MTL_ENABLE_DEBUG_INFO = YES; 327 | ONLY_ACTIVE_ARCH = YES; 328 | SDKROOT = iphoneos; 329 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 330 | TARGETED_DEVICE_FAMILY = "1,2"; 331 | }; 332 | name = Debug; 333 | }; 334 | 97E4493F1A76A8EB00AECF47 /* Release */ = { 335 | isa = XCBuildConfiguration; 336 | buildSettings = { 337 | ALWAYS_SEARCH_USER_PATHS = NO; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 347 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 354 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 357 | CLANG_WARN_STRICT_PROTOTYPES = YES; 358 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 359 | CLANG_WARN_UNREACHABLE_CODE = YES; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = YES; 363 | ENABLE_NS_ASSERTIONS = NO; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 368 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 369 | GCC_WARN_UNDECLARED_SELECTOR = YES; 370 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 371 | GCC_WARN_UNUSED_FUNCTION = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 374 | MTL_ENABLE_DEBUG_INFO = NO; 375 | SDKROOT = iphoneos; 376 | SWIFT_COMPILATION_MODE = wholemodule; 377 | TARGETED_DEVICE_FAMILY = "1,2"; 378 | VALIDATE_PRODUCT = YES; 379 | }; 380 | name = Release; 381 | }; 382 | 97E449411A76A8EB00AECF47 /* Debug */ = { 383 | isa = XCBuildConfiguration; 384 | buildSettings = { 385 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 386 | DEVELOPMENT_TEAM = 7JY26JM8HL; 387 | INFOPLIST_FILE = SwiftSensorTag/Info.plist; 388 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 389 | LD_RUNPATH_SEARCH_PATHS = ( 390 | "$(inherited)", 391 | "@executable_path/Frameworks", 392 | ); 393 | PRODUCT_BUNDLE_IDENTIFIER = "im.anas.$(PRODUCT_NAME:rfc1034identifier)"; 394 | PRODUCT_NAME = "$(TARGET_NAME)"; 395 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 396 | SWIFT_VERSION = 5.0; 397 | }; 398 | name = Debug; 399 | }; 400 | 97E449421A76A8EB00AECF47 /* Release */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 404 | DEVELOPMENT_TEAM = 7JY26JM8HL; 405 | INFOPLIST_FILE = SwiftSensorTag/Info.plist; 406 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 407 | LD_RUNPATH_SEARCH_PATHS = ( 408 | "$(inherited)", 409 | "@executable_path/Frameworks", 410 | ); 411 | PRODUCT_BUNDLE_IDENTIFIER = "im.anas.$(PRODUCT_NAME:rfc1034identifier)"; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 414 | SWIFT_VERSION = 5.0; 415 | }; 416 | name = Release; 417 | }; 418 | 97E449441A76A8EB00AECF47 /* Debug */ = { 419 | isa = XCBuildConfiguration; 420 | buildSettings = { 421 | BUNDLE_LOADER = "$(TEST_HOST)"; 422 | DEVELOPMENT_TEAM = 7JY26JM8HL; 423 | FRAMEWORK_SEARCH_PATHS = ( 424 | "$(SDKROOT)/Developer/Library/Frameworks", 425 | "$(inherited)", 426 | ); 427 | GCC_PREPROCESSOR_DEFINITIONS = ( 428 | "DEBUG=1", 429 | "$(inherited)", 430 | ); 431 | INFOPLIST_FILE = SwiftSensorTagTests/Info.plist; 432 | LD_RUNPATH_SEARCH_PATHS = ( 433 | "$(inherited)", 434 | "@executable_path/Frameworks", 435 | "@loader_path/Frameworks", 436 | ); 437 | PRODUCT_BUNDLE_IDENTIFIER = "im.anas.$(PRODUCT_NAME:rfc1034identifier)"; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 440 | SWIFT_VERSION = 5.0; 441 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftSensorTag.app/SwiftSensorTag"; 442 | }; 443 | name = Debug; 444 | }; 445 | 97E449451A76A8EB00AECF47 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | BUNDLE_LOADER = "$(TEST_HOST)"; 449 | DEVELOPMENT_TEAM = 7JY26JM8HL; 450 | FRAMEWORK_SEARCH_PATHS = ( 451 | "$(SDKROOT)/Developer/Library/Frameworks", 452 | "$(inherited)", 453 | ); 454 | INFOPLIST_FILE = SwiftSensorTagTests/Info.plist; 455 | LD_RUNPATH_SEARCH_PATHS = ( 456 | "$(inherited)", 457 | "@executable_path/Frameworks", 458 | "@loader_path/Frameworks", 459 | ); 460 | PRODUCT_BUNDLE_IDENTIFIER = "im.anas.$(PRODUCT_NAME:rfc1034identifier)"; 461 | PRODUCT_NAME = "$(TARGET_NAME)"; 462 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 463 | SWIFT_VERSION = 5.0; 464 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftSensorTag.app/SwiftSensorTag"; 465 | }; 466 | name = Release; 467 | }; 468 | /* End XCBuildConfiguration section */ 469 | 470 | /* Begin XCConfigurationList section */ 471 | 97E449191A76A8EB00AECF47 /* Build configuration list for PBXProject "SwiftSensorTag" */ = { 472 | isa = XCConfigurationList; 473 | buildConfigurations = ( 474 | 97E4493E1A76A8EB00AECF47 /* Debug */, 475 | 97E4493F1A76A8EB00AECF47 /* Release */, 476 | ); 477 | defaultConfigurationIsVisible = 0; 478 | defaultConfigurationName = Release; 479 | }; 480 | 97E449401A76A8EB00AECF47 /* Build configuration list for PBXNativeTarget "SwiftSensorTag" */ = { 481 | isa = XCConfigurationList; 482 | buildConfigurations = ( 483 | 97E449411A76A8EB00AECF47 /* Debug */, 484 | 97E449421A76A8EB00AECF47 /* Release */, 485 | ); 486 | defaultConfigurationIsVisible = 0; 487 | defaultConfigurationName = Release; 488 | }; 489 | 97E449431A76A8EB00AECF47 /* Build configuration list for PBXNativeTarget "SwiftSensorTagTests" */ = { 490 | isa = XCConfigurationList; 491 | buildConfigurations = ( 492 | 97E449441A76A8EB00AECF47 /* Debug */, 493 | 97E449451A76A8EB00AECF47 /* Release */, 494 | ); 495 | defaultConfigurationIsVisible = 0; 496 | defaultConfigurationName = Release; 497 | }; 498 | /* End XCConfigurationList section */ 499 | 500 | /* Begin XCVersionGroup section */ 501 | 97E449251A76A8EB00AECF47 /* SwiftSensorTag.xcdatamodeld */ = { 502 | isa = XCVersionGroup; 503 | children = ( 504 | 97E449261A76A8EB00AECF47 /* SwiftSensorTag.xcdatamodel */, 505 | ); 506 | currentVersion = 97E449261A76A8EB00AECF47 /* SwiftSensorTag.xcdatamodel */; 507 | path = SwiftSensorTag.xcdatamodeld; 508 | sourceTree = ""; 509 | versionGroupType = wrapper.xcdatamodel; 510 | }; 511 | /* End XCVersionGroup section */ 512 | }; 513 | rootObject = 97E449161A76A8EB00AECF47 /* Project object */; 514 | } 515 | --------------------------------------------------------------------------------