├── .gitignore ├── Cartfile ├── Cartfile.resolved ├── Key.h.org ├── MEMELib.framework ├── Headers │ ├── MEMEData.h │ ├── MEMELib.h │ └── MEMERealTimeData.h ├── Info.plist ├── MEMELib ├── Modules │ └── module.modulemap └── _CodeSignature │ └── CodeResources ├── MEMELogger-iOS-developers.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── MEMELogger-iOS-developers.xcscmblueprint ├── MEMELogger-iOS-developers ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-29@2x.png │ │ ├── Icon-29@3x.png │ │ ├── Icon-40@2x.png │ │ ├── Icon-40@3x.png │ │ ├── Icon-60@2x.png │ │ └── Icon-60@3x.png │ ├── Contents.json │ ├── icon-realtime.imageset │ │ ├── Contents.json │ │ ├── icon-realtime.png │ │ ├── icon-realtime@2x.png │ │ └── icon-realtime@3x.png │ └── icon-recording.imageset │ │ ├── Contents.json │ │ ├── icon-recording.png │ │ ├── icon-recording@2x.png │ │ └── icon-recording@3x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Bridging-Header.h ├── EyeMovement.swift ├── EyeView.swift ├── FileWriter.swift ├── GraphView.swift ├── Info.plist ├── JMPairingVC.swift ├── JMRealTimeDataVC.swift ├── JMRecordingVC.swift ├── SIFlatButton.swift └── UIColor+Hex.swift └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | Key.h 2 | 3 | # Created by https://www.gitignore.io 4 | 5 | ### Swift ### 6 | # Xcode 7 | # 8 | build/ 9 | *.pbxuser 10 | !default.pbxuser 11 | *.mode1v3 12 | !default.mode1v3 13 | *.mode2v3 14 | !default.mode2v3 15 | *.perspectivev3 16 | !default.perspectivev3 17 | xcuserdata 18 | *.xccheckout 19 | *.moved-aside 20 | DerivedData 21 | *.hmap 22 | *.ipa 23 | *.xcuserstate 24 | 25 | # CocoaPods 26 | # 27 | # We recommend against adding the Pods directory to your .gitignore. However 28 | # you should judge for yourself, the pros and cons are mentioned at: 29 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 30 | # 31 | # Pods/ 32 | 33 | # Carthage 34 | # 35 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 36 | Carthage/Checkouts 37 | 38 | Carthage/Build -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "TransitApp/SVProgressHUD" 2 | 3 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "TransitApp/SVProgressHUD" "1.1.3" 2 | -------------------------------------------------------------------------------- /Key.h.org: -------------------------------------------------------------------------------- 1 | // 2 | // Key.h 3 | // MEMESample 4 | // 5 | // Created by Shoya Ishimaru on 2015/11/09. 6 | // Copyright © 2015年 shoya140. All rights reserved. 7 | // 8 | 9 | #ifndef Key_h 10 | #define Key_h 11 | 12 | #define MEME_APP_ID "YOUR_MEME_APP_ID" 13 | #define MEME_APP_SECRET "YOUR_MEME_APP_SECRET" 14 | 15 | #endif /* Key_h */ 16 | -------------------------------------------------------------------------------- /MEMELib.framework/Headers/MEMEData.h: -------------------------------------------------------------------------------- 1 | // 2 | // MEMEData.h 3 | // 4 | // 5 | // Created by JINS MEME on 2015/02/06. 6 | // Copyright (c) 2015年 JINS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MEMEData : NSObject 12 | 13 | - (instancetype)initWithDataPacket: (UInt8 *)data; 14 | 15 | - (uint64_t) getUnixTime: (UInt8 *) data; 16 | - (UInt16) getUInt16: (UInt8 *)data; 17 | - (SInt16) getSInt16: (UInt8 *)data; 18 | - (float) getFloat16: (UInt8 *)data; 19 | - (float) getFloat24: (UInt8 *)data; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MEMELib.framework/Headers/MEMELib.h: -------------------------------------------------------------------------------- 1 | // 2 | // MEMELib.h 3 | // 4 | // 5 | // Created by JINS MEME on 8/11/14. 6 | // Copyright (c) 2014 JIN. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #import "MEMERealTimeData.h" 13 | 14 | FOUNDATION_EXPORT double MEMEVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char MEMEVersionString[]; 16 | 17 | // MEME Device Type 18 | typedef enum { 19 | ES = 0, 20 | MT = 1, 21 | } MEMEType; 22 | 23 | // Error Code 24 | typedef enum { 25 | MEME_OK = 0, 26 | MEME_ERROR = 1, // Misc Error 27 | MEME_ERROR_SDK_AUTH = 2, // SDK Auth Error 28 | MEME_ERROR_APP_AUTH = 3, // App Auth Error 29 | MEME_ERROR_CONNECTION = 4, // No Connection 30 | MEME_DEVICE_INVALID = 5, // Invalid Device 31 | MEME_CMD_INVALID = 6, // Invalid Command 32 | MEME_ERROR_FW_CHECK = 7, // FW Version Error 33 | MEME_ERROR_BL_OFF = 8 // Bluetooth is Off 34 | } MEMEStatus; 35 | 36 | 37 | typedef struct { 38 | int eventCode; 39 | BOOL commandResult; 40 | } MEMEResponse; 41 | 42 | // Calibration Status 43 | typedef enum { 44 | CALIB_NOT_FINISHED = 0, 45 | CALIB_BODY_FINISHED = 1, 46 | CALIB_EYE_FINISHED = 2, 47 | CALIB_BOTH_FINISHED = 3, 48 | } MEMECalibStatus; 49 | 50 | 51 | @protocol MEMELibDelegate 52 | 53 | @optional 54 | - (void) memeAppAuthorized: (MEMEStatus) status; 55 | - (void) memeFirmwareAuthorized: (MEMEStatus) status; 56 | 57 | - (void) memePeripheralFound: (CBPeripheral *) peripheral withDeviceAddress: (NSString *) address; 58 | 59 | - (void) memePeripheralConnected: (CBPeripheral *)peripheral; 60 | - (void) memePeripheralDisconnected: (CBPeripheral *)peripheral; 61 | 62 | - (void) memeRealTimeModeDataReceived: (MEMERealTimeData *) data; 63 | 64 | - (void) memeCommandResponse: (MEMEResponse) response; 65 | 66 | @end 67 | 68 | 69 | @interface MEMELib : NSObject 70 | 71 | @property (weak, nonatomic) id delegate; 72 | 73 | @property (readonly) BOOL isConnected; 74 | @property (readonly) BOOL isDataReceiving; 75 | @property (readonly) MEMECalibStatus isCalibrated; 76 | 77 | + (MEMELib *)sharedInstance; 78 | 79 | #pragma mark AUTH 80 | 81 | + (void) setAppClientId: (NSString *) clientId clientSecret: (NSString *) clientSecret; 82 | 83 | #pragma mark CONNECTION 84 | 85 | - (MEMEStatus) startScanningPeripherals; 86 | - (MEMEStatus) stopScanningPeripherals; 87 | 88 | - (MEMEStatus) connectPeripheral:(CBPeripheral *)peripheral; 89 | - (MEMEStatus) disconnectPeripheral; 90 | 91 | - (NSArray *) getConnectedByOthers; 92 | 93 | #pragma mark DEVICE 94 | 95 | - (MEMEStatus) startDataReport; 96 | - (MEMEStatus) stopDataReport; 97 | 98 | #pragma mark DEVICE INFO 99 | 100 | - (NSString *) getSDKVersion; 101 | - (NSString *) getFWVersion; 102 | - (UInt8) getHWVersion; 103 | - (int) getConnectedDeviceType; 104 | - (int) getConnectedDeviceSubType; 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /MEMELib.framework/Headers/MEMERealTimeData.h: -------------------------------------------------------------------------------- 1 | // 2 | // MEMERealTimeData.h 3 | // MemLib 4 | // 5 | // Created by JINS MEME on 2015/02/03. 6 | // Copyright (c) 2015年 JINS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "MEMEData.h" 12 | 13 | @interface MEMERealTimeData : MEMEData 14 | 15 | @property UInt8 fitError; // 0: 正常 1: 装着エラー 16 | @property UInt8 isWalking; 17 | 18 | @property UInt8 powerLeft; // 5: フル充電 0: 空 19 | 20 | @property UInt8 eyeMoveUp; 21 | @property UInt8 eyeMoveDown; 22 | @property UInt8 eyeMoveLeft; 23 | @property UInt8 eyeMoveRight; 24 | 25 | @property UInt8 blinkSpeed; // in ms 26 | @property UInt8 blinkStrength; 27 | 28 | @property float roll; 29 | @property float pitch; 30 | @property float yaw; 31 | 32 | @property SInt8 accX; 33 | @property SInt8 accY; 34 | @property SInt8 accZ; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /MEMELib.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELib.framework/Info.plist -------------------------------------------------------------------------------- /MEMELib.framework/MEMELib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELib.framework/MEMELib -------------------------------------------------------------------------------- /MEMELib.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module MEMELib { 2 | umbrella header "MEMELib.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /MEMELib.framework/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Headers/MEMEData.h 8 | 9 | aNCiwj8BbWCV8y9HI1Fu7gF+5P0= 10 | 11 | Headers/MEMELib.h 12 | 13 | 5GNy5GAK+1abkAKU7t/jbgP+NYs= 14 | 15 | Headers/MEMERealTimeData.h 16 | 17 | uLYedCbtMhpfp+d4wRxxs2wq82o= 18 | 19 | Info.plist 20 | 21 | GJVwKoPwr9Waufq/rh8vl23IRqg= 22 | 23 | Modules/module.modulemap 24 | 25 | +AkSWs/8GWT9icP4nly04T+KDPg= 26 | 27 | 28 | files2 29 | 30 | Headers/MEMEData.h 31 | 32 | aNCiwj8BbWCV8y9HI1Fu7gF+5P0= 33 | 34 | Headers/MEMELib.h 35 | 36 | 5GNy5GAK+1abkAKU7t/jbgP+NYs= 37 | 38 | Headers/MEMERealTimeData.h 39 | 40 | uLYedCbtMhpfp+d4wRxxs2wq82o= 41 | 42 | Modules/module.modulemap 43 | 44 | +AkSWs/8GWT9icP4nly04T+KDPg= 45 | 46 | 47 | rules 48 | 49 | ^ 50 | 51 | ^.*\.lproj/ 52 | 53 | optional 54 | 55 | weight 56 | 1000 57 | 58 | ^.*\.lproj/locversion.plist$ 59 | 60 | omit 61 | 62 | weight 63 | 1100 64 | 65 | ^version.plist$ 66 | 67 | 68 | rules2 69 | 70 | .*\.dSYM($|/) 71 | 72 | weight 73 | 11 74 | 75 | ^ 76 | 77 | weight 78 | 20 79 | 80 | ^(.*/)?\.DS_Store$ 81 | 82 | omit 83 | 84 | weight 85 | 2000 86 | 87 | ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ 88 | 89 | nested 90 | 91 | weight 92 | 10 93 | 94 | ^.* 95 | 96 | ^.*\.lproj/ 97 | 98 | optional 99 | 100 | weight 101 | 1000 102 | 103 | ^.*\.lproj/locversion.plist$ 104 | 105 | omit 106 | 107 | weight 108 | 1100 109 | 110 | ^Info\.plist$ 111 | 112 | omit 113 | 114 | weight 115 | 20 116 | 117 | ^PkgInfo$ 118 | 119 | omit 120 | 121 | weight 122 | 20 123 | 124 | ^[^/]+$ 125 | 126 | nested 127 | 128 | weight 129 | 10 130 | 131 | ^embedded\.provisionprofile$ 132 | 133 | weight 134 | 20 135 | 136 | ^version\.plist$ 137 | 138 | weight 139 | 20 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C655B6351BF1867D002E8336 /* JMRealTimeDataVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C655B6341BF1867D002E8336 /* JMRealTimeDataVC.swift */; }; 11 | C655B63A1BF1AADE002E8336 /* EyeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C655B6391BF1AADE002E8336 /* EyeView.swift */; }; 12 | C655B6401BF1ABBF002E8336 /* GraphView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C655B63F1BF1ABBF002E8336 /* GraphView.swift */; }; 13 | C655B6421BF1ABF7002E8336 /* EyeMovement.swift in Sources */ = {isa = PBXBuildFile; fileRef = C655B6411BF1ABF7002E8336 /* EyeMovement.swift */; }; 14 | C669077F1BF49395004E7812 /* SIFlatButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C669077E1BF49395004E7812 /* SIFlatButton.swift */; }; 15 | C66907811BF49523004E7812 /* JMRecordingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C66907801BF49523004E7812 /* JMRecordingVC.swift */; }; 16 | C66907831BF4953E004E7812 /* FileWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C66907821BF4953E004E7812 /* FileWriter.swift */; }; 17 | C66907851BF49580004E7812 /* SVProgressHUD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C66907841BF49580004E7812 /* SVProgressHUD.framework */; }; 18 | C673E2271C3F92670086D0A0 /* MEMELib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C673E2261C3F92670086D0A0 /* MEMELib.framework */; }; 19 | C673E2281C3F92670086D0A0 /* MEMELib.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C673E2261C3F92670086D0A0 /* MEMELib.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 20 | C67D05F81BF0AE5900E63FA3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C67D05F71BF0AE5900E63FA3 /* AppDelegate.swift */; }; 21 | C67D05FD1BF0AE5900E63FA3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C67D05FB1BF0AE5900E63FA3 /* Main.storyboard */; }; 22 | C67D05FF1BF0AE5900E63FA3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C67D05FE1BF0AE5900E63FA3 /* Assets.xcassets */; }; 23 | C67D06021BF0AE5900E63FA3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C67D06001BF0AE5900E63FA3 /* LaunchScreen.storyboard */; }; 24 | C67D06101BF0AFC500E63FA3 /* JMPairingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C67D060F1BF0AFC500E63FA3 /* JMPairingVC.swift */; }; 25 | C6F6E5191C4D6CA50084DB13 /* UIColor+Hex.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6F6E5181C4D6CA50084DB13 /* UIColor+Hex.swift */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXCopyFilesBuildPhase section */ 29 | C673E2291C3F92670086D0A0 /* Embed Frameworks */ = { 30 | isa = PBXCopyFilesBuildPhase; 31 | buildActionMask = 2147483647; 32 | dstPath = ""; 33 | dstSubfolderSpec = 10; 34 | files = ( 35 | C673E2281C3F92670086D0A0 /* MEMELib.framework in Embed Frameworks */, 36 | ); 37 | name = "Embed Frameworks"; 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXCopyFilesBuildPhase section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | C6174BD31BFBA7250086F19F /* Key.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Key.h; sourceTree = ""; }; 44 | C655B6341BF1867D002E8336 /* JMRealTimeDataVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JMRealTimeDataVC.swift; sourceTree = ""; }; 45 | C655B6391BF1AADE002E8336 /* EyeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EyeView.swift; sourceTree = ""; }; 46 | C655B63F1BF1ABBF002E8336 /* GraphView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphView.swift; sourceTree = ""; }; 47 | C655B6411BF1ABF7002E8336 /* EyeMovement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EyeMovement.swift; sourceTree = ""; }; 48 | C669077E1BF49395004E7812 /* SIFlatButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SIFlatButton.swift; sourceTree = ""; }; 49 | C66907801BF49523004E7812 /* JMRecordingVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JMRecordingVC.swift; sourceTree = ""; }; 50 | C66907821BF4953E004E7812 /* FileWriter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileWriter.swift; sourceTree = ""; }; 51 | C66907841BF49580004E7812 /* SVProgressHUD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SVProgressHUD.framework; path = Carthage/Build/iOS/SVProgressHUD.framework; sourceTree = ""; }; 52 | C673E2261C3F92670086D0A0 /* MEMELib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MEMELib.framework; sourceTree = ""; }; 53 | C67D05F41BF0AE5900E63FA3 /* MEMELogger-iOS-developers.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "MEMELogger-iOS-developers.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | C67D05F71BF0AE5900E63FA3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 55 | C67D05FC1BF0AE5900E63FA3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 56 | C67D05FE1BF0AE5900E63FA3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 57 | C67D06011BF0AE5900E63FA3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 58 | C67D06031BF0AE5900E63FA3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | C67D060D1BF0AEF700E63FA3 /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = ""; }; 60 | C67D060F1BF0AFC500E63FA3 /* JMPairingVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JMPairingVC.swift; sourceTree = ""; }; 61 | C6F6E5181C4D6CA50084DB13 /* UIColor+Hex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Hex.swift"; sourceTree = ""; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | C67D05F11BF0AE5900E63FA3 /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | C673E2271C3F92670086D0A0 /* MEMELib.framework in Frameworks */, 70 | C66907851BF49580004E7812 /* SVProgressHUD.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | C655B63B1BF1AAE8002E8336 /* View */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | C669077E1BF49395004E7812 /* SIFlatButton.swift */, 81 | C655B63F1BF1ABBF002E8336 /* GraphView.swift */, 82 | C655B6391BF1AADE002E8336 /* EyeView.swift */, 83 | ); 84 | name = View; 85 | sourceTree = ""; 86 | }; 87 | C655B63D1BF1AAFC002E8336 /* ViewController */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | C67D060F1BF0AFC500E63FA3 /* JMPairingVC.swift */, 91 | C655B6341BF1867D002E8336 /* JMRealTimeDataVC.swift */, 92 | C66907801BF49523004E7812 /* JMRecordingVC.swift */, 93 | ); 94 | name = ViewController; 95 | sourceTree = ""; 96 | }; 97 | C655B63E1BF1AB93002E8336 /* Common */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | C66907821BF4953E004E7812 /* FileWriter.swift */, 101 | C655B6411BF1ABF7002E8336 /* EyeMovement.swift */, 102 | ); 103 | name = Common; 104 | sourceTree = ""; 105 | }; 106 | C67D05EB1BF0AE5900E63FA3 = { 107 | isa = PBXGroup; 108 | children = ( 109 | C6174BD31BFBA7250086F19F /* Key.h */, 110 | C67D05F61BF0AE5900E63FA3 /* MEMELogger-iOS-developers */, 111 | C67D05F51BF0AE5900E63FA3 /* Products */, 112 | C673E2261C3F92670086D0A0 /* MEMELib.framework */, 113 | C66907841BF49580004E7812 /* SVProgressHUD.framework */, 114 | ); 115 | sourceTree = ""; 116 | }; 117 | C67D05F51BF0AE5900E63FA3 /* Products */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | C67D05F41BF0AE5900E63FA3 /* MEMELogger-iOS-developers.app */, 121 | ); 122 | name = Products; 123 | sourceTree = ""; 124 | }; 125 | C67D05F61BF0AE5900E63FA3 /* MEMELogger-iOS-developers */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | C6F6E5171C4D6C850084DB13 /* Extensions */, 129 | C655B63E1BF1AB93002E8336 /* Common */, 130 | C655B63B1BF1AAE8002E8336 /* View */, 131 | C655B63D1BF1AAFC002E8336 /* ViewController */, 132 | C67D05F71BF0AE5900E63FA3 /* AppDelegate.swift */, 133 | C67D060D1BF0AEF700E63FA3 /* Bridging-Header.h */, 134 | C67D05FB1BF0AE5900E63FA3 /* Main.storyboard */, 135 | C67D05FE1BF0AE5900E63FA3 /* Assets.xcassets */, 136 | C67D06001BF0AE5900E63FA3 /* LaunchScreen.storyboard */, 137 | C67D06031BF0AE5900E63FA3 /* Info.plist */, 138 | ); 139 | path = "MEMELogger-iOS-developers"; 140 | sourceTree = ""; 141 | }; 142 | C6F6E5171C4D6C850084DB13 /* Extensions */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | C6F6E5181C4D6CA50084DB13 /* UIColor+Hex.swift */, 146 | ); 147 | name = Extensions; 148 | sourceTree = ""; 149 | }; 150 | /* End PBXGroup section */ 151 | 152 | /* Begin PBXNativeTarget section */ 153 | C67D05F31BF0AE5900E63FA3 /* MEMELogger-iOS-developers */ = { 154 | isa = PBXNativeTarget; 155 | buildConfigurationList = C67D06061BF0AE5900E63FA3 /* Build configuration list for PBXNativeTarget "MEMELogger-iOS-developers" */; 156 | buildPhases = ( 157 | C67D05F01BF0AE5900E63FA3 /* Sources */, 158 | C67D05F11BF0AE5900E63FA3 /* Frameworks */, 159 | C67D05F21BF0AE5900E63FA3 /* Resources */, 160 | C66907861BF49587004E7812 /* ShellScript */, 161 | C673E2291C3F92670086D0A0 /* Embed Frameworks */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | ); 167 | name = "MEMELogger-iOS-developers"; 168 | productName = MEMESample; 169 | productReference = C67D05F41BF0AE5900E63FA3 /* MEMELogger-iOS-developers.app */; 170 | productType = "com.apple.product-type.application"; 171 | }; 172 | /* End PBXNativeTarget section */ 173 | 174 | /* Begin PBXProject section */ 175 | C67D05EC1BF0AE5900E63FA3 /* Project object */ = { 176 | isa = PBXProject; 177 | attributes = { 178 | LastSwiftUpdateCheck = 0710; 179 | LastUpgradeCheck = 0710; 180 | ORGANIZATIONNAME = shoya140; 181 | TargetAttributes = { 182 | C67D05F31BF0AE5900E63FA3 = { 183 | CreatedOnToolsVersion = 7.1; 184 | SystemCapabilities = { 185 | com.apple.BackgroundModes = { 186 | enabled = 1; 187 | }; 188 | }; 189 | }; 190 | }; 191 | }; 192 | buildConfigurationList = C67D05EF1BF0AE5900E63FA3 /* Build configuration list for PBXProject "MEMELogger-iOS-developers" */; 193 | compatibilityVersion = "Xcode 3.2"; 194 | developmentRegion = English; 195 | hasScannedForEncodings = 0; 196 | knownRegions = ( 197 | en, 198 | Base, 199 | ); 200 | mainGroup = C67D05EB1BF0AE5900E63FA3; 201 | productRefGroup = C67D05F51BF0AE5900E63FA3 /* Products */; 202 | projectDirPath = ""; 203 | projectRoot = ""; 204 | targets = ( 205 | C67D05F31BF0AE5900E63FA3 /* MEMELogger-iOS-developers */, 206 | ); 207 | }; 208 | /* End PBXProject section */ 209 | 210 | /* Begin PBXResourcesBuildPhase section */ 211 | C67D05F21BF0AE5900E63FA3 /* Resources */ = { 212 | isa = PBXResourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | C67D06021BF0AE5900E63FA3 /* LaunchScreen.storyboard in Resources */, 216 | C67D05FF1BF0AE5900E63FA3 /* Assets.xcassets in Resources */, 217 | C67D05FD1BF0AE5900E63FA3 /* Main.storyboard in Resources */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | /* End PBXResourcesBuildPhase section */ 222 | 223 | /* Begin PBXShellScriptBuildPhase section */ 224 | C66907861BF49587004E7812 /* ShellScript */ = { 225 | isa = PBXShellScriptBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | ); 229 | inputPaths = ( 230 | "$(SRCROOT)/Carthage/Build/iOS/SVProgressHUD.framework", 231 | ); 232 | outputPaths = ( 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | shellPath = /bin/sh; 236 | shellScript = "/usr/local/bin/carthage copy-frameworks"; 237 | }; 238 | /* End PBXShellScriptBuildPhase section */ 239 | 240 | /* Begin PBXSourcesBuildPhase section */ 241 | C67D05F01BF0AE5900E63FA3 /* Sources */ = { 242 | isa = PBXSourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | C655B6351BF1867D002E8336 /* JMRealTimeDataVC.swift in Sources */, 246 | C67D06101BF0AFC500E63FA3 /* JMPairingVC.swift in Sources */, 247 | C655B6421BF1ABF7002E8336 /* EyeMovement.swift in Sources */, 248 | C66907811BF49523004E7812 /* JMRecordingVC.swift in Sources */, 249 | C655B63A1BF1AADE002E8336 /* EyeView.swift in Sources */, 250 | C669077F1BF49395004E7812 /* SIFlatButton.swift in Sources */, 251 | C66907831BF4953E004E7812 /* FileWriter.swift in Sources */, 252 | C67D05F81BF0AE5900E63FA3 /* AppDelegate.swift in Sources */, 253 | C655B6401BF1ABBF002E8336 /* GraphView.swift in Sources */, 254 | C6F6E5191C4D6CA50084DB13 /* UIColor+Hex.swift in Sources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | /* End PBXSourcesBuildPhase section */ 259 | 260 | /* Begin PBXVariantGroup section */ 261 | C67D05FB1BF0AE5900E63FA3 /* Main.storyboard */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | C67D05FC1BF0AE5900E63FA3 /* Base */, 265 | ); 266 | name = Main.storyboard; 267 | sourceTree = ""; 268 | }; 269 | C67D06001BF0AE5900E63FA3 /* LaunchScreen.storyboard */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | C67D06011BF0AE5900E63FA3 /* Base */, 273 | ); 274 | name = LaunchScreen.storyboard; 275 | sourceTree = ""; 276 | }; 277 | /* End PBXVariantGroup section */ 278 | 279 | /* Begin XCBuildConfiguration section */ 280 | C67D06041BF0AE5900E63FA3 /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ALWAYS_SEARCH_USER_PATHS = NO; 284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 285 | CLANG_CXX_LIBRARY = "libc++"; 286 | CLANG_ENABLE_MODULES = YES; 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_CONSTANT_CONVERSION = YES; 290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INT_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_UNREACHABLE_CODE = YES; 296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 297 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 298 | COPY_PHASE_STRIP = NO; 299 | DEBUG_INFORMATION_FORMAT = dwarf; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | ENABLE_TESTABILITY = YES; 302 | GCC_C_LANGUAGE_STANDARD = gnu99; 303 | GCC_DYNAMIC_NO_PIC = NO; 304 | GCC_NO_COMMON_BLOCKS = YES; 305 | GCC_OPTIMIZATION_LEVEL = 0; 306 | GCC_PREPROCESSOR_DEFINITIONS = ( 307 | "DEBUG=1", 308 | "$(inherited)", 309 | ); 310 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 312 | GCC_WARN_UNDECLARED_SELECTOR = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 314 | GCC_WARN_UNUSED_FUNCTION = YES; 315 | GCC_WARN_UNUSED_VARIABLE = YES; 316 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 317 | MTL_ENABLE_DEBUG_INFO = YES; 318 | ONLY_ACTIVE_ARCH = YES; 319 | SDKROOT = iphoneos; 320 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 321 | }; 322 | name = Debug; 323 | }; 324 | C67D06051BF0AE5900E63FA3 /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_MODULES = YES; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INT_CONVERSION = YES; 338 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 344 | ENABLE_NS_ASSERTIONS = NO; 345 | ENABLE_STRICT_OBJC_MSGSEND = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_NO_COMMON_BLOCKS = YES; 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 355 | MTL_ENABLE_DEBUG_INFO = NO; 356 | SDKROOT = iphoneos; 357 | VALIDATE_PRODUCT = YES; 358 | }; 359 | name = Release; 360 | }; 361 | C67D06071BF0AE5900E63FA3 /* Debug */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 365 | ENABLE_BITCODE = NO; 366 | FRAMEWORK_SEARCH_PATHS = ( 367 | "$(inherited)", 368 | "$(PROJECT_DIR)", 369 | "$(PROJECT_DIR)/Carthage/Build/iOS", 370 | ); 371 | INFOPLIST_FILE = "$(SRCROOT)/MEMELogger-iOS-developers/Info.plist"; 372 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 373 | PRODUCT_BUNDLE_IDENTIFIER = "shoya140.MEMELogger-iOS-developers"; 374 | PRODUCT_NAME = "MEMELogger-iOS-developers"; 375 | SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(PROJECT)/Bridging-Header.h"; 376 | }; 377 | name = Debug; 378 | }; 379 | C67D06081BF0AE5900E63FA3 /* Release */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 383 | ENABLE_BITCODE = NO; 384 | FRAMEWORK_SEARCH_PATHS = ( 385 | "$(inherited)", 386 | "$(PROJECT_DIR)", 387 | "$(PROJECT_DIR)/Carthage/Build/iOS", 388 | ); 389 | INFOPLIST_FILE = "$(SRCROOT)/MEMELogger-iOS-developers/Info.plist"; 390 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 391 | PRODUCT_BUNDLE_IDENTIFIER = "shoya140.MEMELogger-iOS-developers"; 392 | PRODUCT_NAME = "MEMELogger-iOS-developers"; 393 | SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(PROJECT)/Bridging-Header.h"; 394 | }; 395 | name = Release; 396 | }; 397 | /* End XCBuildConfiguration section */ 398 | 399 | /* Begin XCConfigurationList section */ 400 | C67D05EF1BF0AE5900E63FA3 /* Build configuration list for PBXProject "MEMELogger-iOS-developers" */ = { 401 | isa = XCConfigurationList; 402 | buildConfigurations = ( 403 | C67D06041BF0AE5900E63FA3 /* Debug */, 404 | C67D06051BF0AE5900E63FA3 /* Release */, 405 | ); 406 | defaultConfigurationIsVisible = 0; 407 | defaultConfigurationName = Release; 408 | }; 409 | C67D06061BF0AE5900E63FA3 /* Build configuration list for PBXNativeTarget "MEMELogger-iOS-developers" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | C67D06071BF0AE5900E63FA3 /* Debug */, 413 | C67D06081BF0AE5900E63FA3 /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | /* End XCConfigurationList section */ 419 | }; 420 | rootObject = C67D05EC1BF0AE5900E63FA3 /* Project object */; 421 | } 422 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers.xcodeproj/project.xcworkspace/xcshareddata/MEMELogger-iOS-developers.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "5528CFD1BB022809D2509B3FAFA4582A93324513", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "5528CFD1BB022809D2509B3FAFA4582A93324513" : 0, 8 | "332CC6113CD2FD57C9CDC465D848326FAF4999CB" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "FD58238E-E909-47CE-B5DE-36CE2644F5FF", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "5528CFD1BB022809D2509B3FAFA4582A93324513" : "MEMELogger-iOS-developers\/", 13 | "332CC6113CD2FD57C9CDC465D848326FAF4999CB" : "rll\/" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "MEMELogger-iOS-developers", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "MEMELogger-iOS-developers.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:shoya140\/ReadingLifeLog.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "332CC6113CD2FD57C9CDC465D848326FAF4999CB" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:shoya140\/MEMELogger-iOS-developers.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "5528CFD1BB022809D2509B3FAFA4582A93324513" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // MEMESample 4 | // 5 | // Created by Shoya Ishimaru on 2015/11/09. 6 | // Copyright © 2015年 shoya140. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | 20 | MEMELib.setAppClientId(MEME_APP_ID, clientSecret: MEME_APP_SECRET) 21 | 22 | let settings = UIUserNotificationSettings(forTypes: ([.Sound, .Alert]), categories: nil) 23 | application.registerUserNotificationSettings(settings) 24 | 25 | let themeColor = UIColor.hex("#cd1224", alpha: 1.0) 26 | UINavigationBar.appearance().barTintColor = themeColor 27 | UINavigationBar.appearance().tintColor = UIColor.whiteColor() 28 | UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()] 29 | UITabBar.appearance().tintColor = themeColor 30 | UISegmentedControl.appearance().tintColor = themeColor 31 | 32 | return true 33 | } 34 | 35 | func applicationWillResignActive(application: UIApplication) { 36 | // 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. 37 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 38 | } 39 | 40 | func applicationDidEnterBackground(application: UIApplication) { 41 | // 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. 42 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 43 | } 44 | 45 | func applicationWillEnterForeground(application: UIApplication) { 46 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 47 | } 48 | 49 | func applicationDidBecomeActive(application: UIApplication) { 50 | // 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. 51 | } 52 | 53 | func applicationWillTerminate(application: UIApplication) { 54 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 55 | } 56 | 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-29@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-29@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-40@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-40@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "60x60", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-60@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-60@3x.png", 37 | "scale" : "3x" 38 | } 39 | ], 40 | "info" : { 41 | "version" : 1, 42 | "author" : "xcode" 43 | } 44 | } -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-29@2x.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-29@3x.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/icon-realtime.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon-realtime.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "icon-realtime@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "icon-realtime@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/icon-realtime.imageset/icon-realtime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/icon-realtime.imageset/icon-realtime.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/icon-realtime.imageset/icon-realtime@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/icon-realtime.imageset/icon-realtime@2x.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/icon-realtime.imageset/icon-realtime@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/icon-realtime.imageset/icon-realtime@3x.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/icon-recording.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon-recording.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "icon-recording@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "icon-recording@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/icon-recording.imageset/icon-recording.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/icon-recording.imageset/icon-recording.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/icon-recording.imageset/icon-recording@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/icon-recording.imageset/icon-recording@2x.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Assets.xcassets/icon-recording.imageset/icon-recording@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shoya140/MEMELogger-iOS-developers/549fb21fcfa8ccbee5d12ec328ec61ec47368b14/MEMELogger-iOS-developers/Assets.xcassets/icon-recording.imageset/icon-recording@3x.png -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/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 | 30 | 31 | 32 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 118 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 234 | 258 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bridging-Header.h 3 | // MEMESample 4 | // 5 | // Created by Shoya Ishimaru on 2015/11/09. 6 | // Copyright © 2015年 shoya140. All rights reserved. 7 | // 8 | 9 | #ifndef Bridging_Header_h 10 | #define Bridging_Header_h 11 | 12 | #import "Key.h" 13 | #import 14 | 15 | #endif /* Bridging_Header_h */ 16 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/EyeMovement.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EyeMovement.swift 3 | // Meme 4 | // 5 | // Created by Shoya Ishimaru on 2015/08/02. 6 | // Copyright (c) 2015 shoya140. All rights reserved. 7 | // 8 | // Generated by PaintCode (www.paintcodeapp.com) 9 | // 10 | 11 | 12 | 13 | import UIKit 14 | 15 | public class EyeMovement : NSObject { 16 | 17 | //// Cache 18 | 19 | private struct Cache { 20 | static var color2: UIColor = UIColor(red: 0.068, green: 0.064, blue: 0.020, alpha: 1.000) 21 | } 22 | 23 | //// Colors 24 | 25 | public class var color2: UIColor { return Cache.color2 } 26 | 27 | //// Drawing Methods 28 | 29 | public class func drawCanvas1(horizontal_position horizontal_position: CGFloat, vertical_position: CGFloat, eye: Bool) { 30 | //// General Declarations 31 | let context = UIGraphicsGetCurrentContext() 32 | 33 | //// Color Declarations 34 | let color3 = UIColor(red: 0.178, green: 0.156, blue: 0.022, alpha: 1.000) 35 | let color = UIColor(red: 0.929, green: 0.949, blue: 0.973, alpha: 1.000) 36 | 37 | //// Variable Declarations 38 | let position_absolute_left: CGFloat = horizontal_position < 0 ? max(61 + horizontal_position * 10, 10) : min(61 + horizontal_position * 10, 100) 39 | let position_pupil_left: CGFloat = horizontal_position < 0 ? max(horizontal_position * 2 - 10, -15) : min(horizontal_position * 2 - 10, 0) 40 | let position_absolute_right: CGFloat = horizontal_position < 0 ? max(58 + horizontal_position * 10, 10) : min(58 + horizontal_position * 10, 100) 41 | let position_pupil_right: CGFloat = horizontal_position < 0 ? max(horizontal_position * 2 - 12, -10) : min(horizontal_position * 2 - 12, -2) 42 | let vertical_position_absolute: CGFloat = vertical_position < 0 ? max(vertical_position + 52, 30) : min(vertical_position + 52, 74) 43 | 44 | if (eye) { 45 | //// Group 46 | CGContextSaveGState(context) 47 | CGContextTranslateCTM(context, (position_absolute_left + 31), vertical_position_absolute) 48 | 49 | 50 | 51 | //// Group 2 52 | CGContextSaveGState(context) 53 | 54 | 55 | 56 | //// Oval Drawing 57 | let ovalPath = UIBezierPath(ovalInRect: CGRectMake(-23, -27, 50, 50)) 58 | color3.setFill() 59 | ovalPath.fill() 60 | 61 | 62 | //// Oval 2 Drawing 63 | let oval2Path = UIBezierPath(ovalInRect: CGRectMake((position_pupil_left + 2), -13, 22, 22)) 64 | EyeMovement.color2.setFill() 65 | oval2Path.fill() 66 | 67 | 68 | 69 | CGContextRestoreGState(context) 70 | 71 | 72 | 73 | CGContextRestoreGState(context) 74 | 75 | 76 | //// Group 3 77 | CGContextSaveGState(context) 78 | CGContextTranslateCTM(context, (position_absolute_right + 246), vertical_position_absolute) 79 | 80 | 81 | 82 | //// Group 4 83 | CGContextSaveGState(context) 84 | 85 | 86 | 87 | //// Oval 3 Drawing 88 | let oval3Path = UIBezierPath(ovalInRect: CGRectMake(-23, -27, 50, 50)) 89 | color3.setFill() 90 | oval3Path.fill() 91 | 92 | 93 | //// Oval 4 Drawing 94 | let oval4Path = UIBezierPath(ovalInRect: CGRectMake((position_pupil_right + 2), -13, 22, 22)) 95 | EyeMovement.color2.setFill() 96 | oval4Path.fill() 97 | 98 | 99 | 100 | CGContextRestoreGState(context) 101 | 102 | 103 | 104 | CGContextRestoreGState(context) 105 | 106 | 107 | //// Bezier 2 Drawing 108 | CGContextSaveGState(context) 109 | CGContextTranslateCTM(context, 371, 49) 110 | CGContextRotateCTM(context, -180 * CGFloat(M_PI) / 180) 111 | 112 | let bezier2Path = UIBezierPath() 113 | bezier2Path.moveToPoint(CGPointMake(120.12, -0)) 114 | bezier2Path.addCurveToPoint(CGPointMake(64.51, 23.02), controlPoint1: CGPointMake(107.09, 14.47), controlPoint2: CGPointMake(86.57, 23.02)) 115 | bezier2Path.addCurveToPoint(CGPointMake(8.87, -0), controlPoint1: CGPointMake(42.44, 23.02), controlPoint2: CGPointMake(21.9, 14.47)) 116 | bezier2Path.addLineToPoint(CGPointMake(0, -0)) 117 | bezier2Path.addLineToPoint(CGPointMake(0.73, 0.91)) 118 | bezier2Path.addCurveToPoint(CGPointMake(64.51, 29), controlPoint1: CGPointMake(14.94, 18.5), controlPoint2: CGPointMake(38.78, 29)) 119 | bezier2Path.addCurveToPoint(CGPointMake(128.27, 0.9), controlPoint1: CGPointMake(90.23, 29), controlPoint2: CGPointMake(114.06, 18.5)) 120 | bezier2Path.addLineToPoint(CGPointMake(129, -0)) 121 | bezier2Path.addLineToPoint(CGPointMake(120.12, -0)) 122 | bezier2Path.closePath() 123 | bezier2Path.miterLimit = 4; 124 | 125 | color3.setFill() 126 | bezier2Path.fill() 127 | 128 | CGContextRestoreGState(context) 129 | } 130 | 131 | 132 | //// Bezier 4 Drawing 133 | let bezier4Path = UIBezierPath() 134 | bezier4Path.moveToPoint(CGPointMake(362.12, 49)) 135 | bezier4Path.addCurveToPoint(CGPointMake(306.51, 73.61), controlPoint1: CGPointMake(349.09, 64.47), controlPoint2: CGPointMake(328.57, 73.61)) 136 | bezier4Path.addCurveToPoint(CGPointMake(250.87, 49), controlPoint1: CGPointMake(284.44, 73.61), controlPoint2: CGPointMake(263.9, 64.47)) 137 | bezier4Path.addLineToPoint(CGPointMake(242, 49)) 138 | bezier4Path.addLineToPoint(CGPointMake(242.73, 49.97)) 139 | bezier4Path.addCurveToPoint(CGPointMake(306.51, 80), controlPoint1: CGPointMake(256.94, 68.77), controlPoint2: CGPointMake(280.78, 80)) 140 | bezier4Path.addCurveToPoint(CGPointMake(370.27, 49.97), controlPoint1: CGPointMake(332.23, 80), controlPoint2: CGPointMake(356.06, 68.77)) 141 | bezier4Path.addLineToPoint(CGPointMake(371, 49)) 142 | bezier4Path.addLineToPoint(CGPointMake(362.12, 49)) 143 | bezier4Path.closePath() 144 | bezier4Path.miterLimit = 4; 145 | 146 | color3.setFill() 147 | bezier4Path.fill() 148 | 149 | 150 | if (eye) { 151 | //// Bezier 3 Drawing 152 | CGContextSaveGState(context) 153 | CGContextTranslateCTM(context, 156, 49) 154 | CGContextRotateCTM(context, -180 * CGFloat(M_PI) / 180) 155 | 156 | let bezier3Path = UIBezierPath() 157 | bezier3Path.moveToPoint(CGPointMake(120.12, -0)) 158 | bezier3Path.addCurveToPoint(CGPointMake(64.51, 23.02), controlPoint1: CGPointMake(107.09, 14.47), controlPoint2: CGPointMake(86.57, 23.02)) 159 | bezier3Path.addCurveToPoint(CGPointMake(8.87, -0), controlPoint1: CGPointMake(42.44, 23.02), controlPoint2: CGPointMake(21.9, 14.47)) 160 | bezier3Path.addLineToPoint(CGPointMake(0, -0)) 161 | bezier3Path.addLineToPoint(CGPointMake(0.73, 0.91)) 162 | bezier3Path.addCurveToPoint(CGPointMake(64.51, 29), controlPoint1: CGPointMake(14.94, 18.5), controlPoint2: CGPointMake(38.78, 29)) 163 | bezier3Path.addCurveToPoint(CGPointMake(128.27, 0.9), controlPoint1: CGPointMake(90.23, 29), controlPoint2: CGPointMake(114.06, 18.5)) 164 | bezier3Path.addLineToPoint(CGPointMake(129, -0)) 165 | bezier3Path.addLineToPoint(CGPointMake(120.12, -0)) 166 | bezier3Path.closePath() 167 | bezier3Path.miterLimit = 4; 168 | 169 | color3.setFill() 170 | bezier3Path.fill() 171 | 172 | CGContextRestoreGState(context) 173 | } 174 | 175 | 176 | //// Bezier Drawing 177 | let bezierPath = UIBezierPath() 178 | bezierPath.moveToPoint(CGPointMake(147.12, 49)) 179 | bezierPath.addCurveToPoint(CGPointMake(91.51, 73.61), controlPoint1: CGPointMake(134.09, 64.47), controlPoint2: CGPointMake(113.57, 73.61)) 180 | bezierPath.addCurveToPoint(CGPointMake(35.87, 49), controlPoint1: CGPointMake(69.44, 73.61), controlPoint2: CGPointMake(48.9, 64.47)) 181 | bezierPath.addLineToPoint(CGPointMake(27, 49)) 182 | bezierPath.addLineToPoint(CGPointMake(27.73, 49.97)) 183 | bezierPath.addCurveToPoint(CGPointMake(91.51, 80), controlPoint1: CGPointMake(41.94, 68.77), controlPoint2: CGPointMake(65.78, 80)) 184 | bezierPath.addCurveToPoint(CGPointMake(155.27, 49.97), controlPoint1: CGPointMake(117.23, 80), controlPoint2: CGPointMake(141.06, 68.77)) 185 | bezierPath.addLineToPoint(CGPointMake(156, 49)) 186 | bezierPath.addLineToPoint(CGPointMake(147.12, 49)) 187 | bezierPath.closePath() 188 | bezierPath.miterLimit = 4; 189 | 190 | color3.setFill() 191 | bezierPath.fill() 192 | 193 | 194 | //// Bezier 7 Drawing 195 | let bezier7Path = UIBezierPath() 196 | bezier7Path.moveToPoint(CGPointMake(306.49, 20)) 197 | bezier7Path.addCurveToPoint(CGPointMake(242.73, 48.1), controlPoint1: CGPointMake(280.77, 20), controlPoint2: CGPointMake(256.94, 30.5)) 198 | bezier7Path.addLineToPoint(CGPointMake(242, 49)) 199 | bezier7Path.addLineToPoint(CGPointMake(242.73, 49.97)) 200 | bezier7Path.addCurveToPoint(CGPointMake(306.51, 80), controlPoint1: CGPointMake(256.94, 68.77), controlPoint2: CGPointMake(280.78, 80)) 201 | bezier7Path.addCurveToPoint(CGPointMake(370.27, 49.97), controlPoint1: CGPointMake(332.23, 80), controlPoint2: CGPointMake(356.06, 68.77)) 202 | bezier7Path.addLineToPoint(CGPointMake(371, 49)) 203 | bezier7Path.addLineToPoint(CGPointMake(370.27, 48.09)) 204 | bezier7Path.addCurveToPoint(CGPointMake(306.49, 20), controlPoint1: CGPointMake(356.06, 30.5), controlPoint2: CGPointMake(332.22, 20)) 205 | bezier7Path.closePath() 206 | bezier7Path.moveToPoint(CGPointMake(91.49, 20)) 207 | bezier7Path.addCurveToPoint(CGPointMake(27.73, 48.1), controlPoint1: CGPointMake(65.77, 20), controlPoint2: CGPointMake(41.94, 30.5)) 208 | bezier7Path.addLineToPoint(CGPointMake(27, 49)) 209 | bezier7Path.addLineToPoint(CGPointMake(27.73, 49.97)) 210 | bezier7Path.addCurveToPoint(CGPointMake(91.51, 80), controlPoint1: CGPointMake(41.94, 68.77), controlPoint2: CGPointMake(65.78, 80)) 211 | bezier7Path.addCurveToPoint(CGPointMake(155.27, 49.97), controlPoint1: CGPointMake(117.23, 80), controlPoint2: CGPointMake(141.06, 68.77)) 212 | bezier7Path.addLineToPoint(CGPointMake(156, 49)) 213 | bezier7Path.addLineToPoint(CGPointMake(155.27, 48.09)) 214 | bezier7Path.addCurveToPoint(CGPointMake(91.49, 20), controlPoint1: CGPointMake(141.06, 30.5), controlPoint2: CGPointMake(117.22, 20)) 215 | bezier7Path.closePath() 216 | bezier7Path.moveToPoint(CGPointMake(400, 0)) 217 | bezier7Path.addCurveToPoint(CGPointMake(400, 100), controlPoint1: CGPointMake(400, 0), controlPoint2: CGPointMake(400, 100)) 218 | bezier7Path.addLineToPoint(CGPointMake(0, 100)) 219 | bezier7Path.addLineToPoint(CGPointMake(0, 0)) 220 | bezier7Path.addLineToPoint(CGPointMake(400, 0)) 221 | bezier7Path.addLineToPoint(CGPointMake(400, 0)) 222 | bezier7Path.closePath() 223 | color.setFill() 224 | bezier7Path.fill() 225 | } 226 | 227 | } 228 | 229 | @objc protocol StyleKitSettableImage { 230 | func setImage(image: UIImage!) 231 | } 232 | 233 | @objc protocol StyleKitSettableSelectedImage { 234 | func setSelectedImage(image: UIImage!) 235 | } 236 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/EyeView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EyeView.swift 3 | // MEMELogger 4 | // 5 | // Created by Shoya Ishimaru on 2015/07/29. 6 | // Copyright (c) 2015年 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class EyeView: UIView { 12 | 13 | var eyeOpened:Bool = true 14 | var eyePosition: Double = 0 15 | 16 | override func drawRect(rect: CGRect) { 17 | super.drawRect(rect) 18 | EyeMovement.drawCanvas1(horizontal_position: CGFloat(eyePosition), vertical_position: 0, eye: eyeOpened) 19 | self.transform = CGAffineTransformMakeScale(0.8, 0.8) 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/FileWriter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FileWriter.swift 3 | // MEMELogger 4 | // 5 | // Created by Shoya Ishimaru on 2015/07/29. 6 | // Copyright (c) 2015年 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class FileWriter: NSObject { 12 | 13 | static let sharedWriter = FileWriter() 14 | var isRecording = false 15 | var eventLabel:Int = 0 16 | var segmentLabel:Int = 0 17 | 18 | private var fileHandle: NSFileHandle? 19 | private var dateFormatter: NSDateFormatter! 20 | private let kISO8601Format: String = "yyyy-MM-dd_HH-mm-ss" 21 | 22 | override init() { 23 | super.init() 24 | 25 | // create date formatter 26 | dateFormatter = NSDateFormatter() 27 | dateFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX") 28 | dateFormatter.timeZone = NSTimeZone.systemTimeZone() 29 | dateFormatter.dateFormat = kISO8601Format 30 | } 31 | 32 | func startRecording() { 33 | self.isRecording = true 34 | 35 | // create file prefix 36 | let documentDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).last! 37 | let currentFilePrefix = dateFormatter.stringFromDate(NSDate()) 38 | 39 | // initialize EOG File 40 | let filePath = documentDirectory + "/" + currentFilePrefix + ".csv" 41 | let text = "date,epoch_time,blink_speed,blink_strength,eye_move_up,eye_move_down,eye_move_left,eye_move_right,acc_x,acc_y,acc_z,roll,pitch,yaw,is_walking,fit_error,power_left,event,segment,app_state\n" 42 | do { 43 | try text.writeToFile(filePath, atomically: true, encoding: NSUTF8StringEncoding) 44 | } catch _ { 45 | } 46 | fileHandle = NSFileHandle(forWritingAtPath: filePath) 47 | fileHandle?.seekToEndOfFile() 48 | 49 | } 50 | 51 | func stopRecording() { 52 | fileHandle?.closeFile() 53 | fileHandle = nil 54 | self.isRecording = false 55 | } 56 | 57 | func writeData(data: MEMERealTimeData) { 58 | if !self.isRecording { 59 | return 60 | } 61 | 62 | let date = NSDate() 63 | let dateString = dateFormatter.stringFromDate(date) 64 | let epochTime = date.timeIntervalSince1970 65 | let applicationState = UIApplication.sharedApplication().applicationState.rawValue 66 | 67 | if let handle = fileHandle { 68 | let text = NSString(format: "%@,%10.5f,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%f,%f,%d,%d,%d,%d,%d,%d\n", 69 | dateString, 70 | epochTime, 71 | data.blinkSpeed, 72 | data.blinkStrength, 73 | data.eyeMoveUp, 74 | data.eyeMoveDown, 75 | data.eyeMoveLeft, 76 | data.eyeMoveRight, 77 | data.accX, 78 | data.accY, 79 | data.accZ, 80 | data.roll, 81 | data.pitch, 82 | data.yaw, 83 | data.isWalking, 84 | data.fitError, 85 | data.powerLeft, 86 | self.eventLabel, 87 | self.segmentLabel, 88 | applicationState 89 | ) 90 | if let d = text.dataUsingEncoding(NSUTF8StringEncoding) { 91 | handle.writeData(d) 92 | } 93 | } 94 | self.eventLabel = 0 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/GraphView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GraphView.swift 3 | // MEMELogger 4 | // 5 | // Created by Shoya Ishimaru on 2015/07/28. 6 | // Copyright (c) 2015年 Katsuma Tanaka. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @IBDesignable class GraphView: UIView { 12 | @IBInspectable var maximumValue: Double = 1000.0{ 13 | didSet { 14 | self.setNeedsDisplay() 15 | } 16 | } 17 | 18 | @IBInspectable var minimumValue: Double = -1000.0{ 19 | didSet { 20 | self.setNeedsDisplay() 21 | } 22 | } 23 | 24 | @IBInspectable var minimumNumberOfValuesToBeDisplayed: UInt = 100{ 25 | didSet { 26 | self.setNeedsDisplay() 27 | } 28 | } 29 | 30 | @IBInspectable var contentInset: UIEdgeInsets = UIEdgeInsetsZero{ 31 | didSet { 32 | self.setNeedsDisplay() 33 | } 34 | } 35 | 36 | @IBInspectable var gridColor: UIColor = UIColor(white: (219.0 / 255.0), alpha: 1.0){ 37 | didSet { 38 | self.setNeedsDisplay() 39 | } 40 | } 41 | 42 | @IBInspectable var lineColor: UIColor = UIColor.blueColor(){ 43 | didSet { 44 | self.setNeedsDisplay() 45 | } 46 | } 47 | 48 | @IBInspectable var values: [Double]?{ 49 | didSet { 50 | self.setNeedsDisplay() 51 | } 52 | } 53 | 54 | override func drawRect(rect: CGRect) { 55 | super.drawRect(rect) 56 | 57 | // Calculate frame size 58 | var frame = self.bounds 59 | frame.origin.x += self.contentInset.left 60 | frame.origin.y += self.contentInset.bottom 61 | frame.size.width -= (self.contentInset.left + self.contentInset.right) 62 | frame.size.height -= (self.contentInset.top + self.contentInset.bottom) 63 | 64 | // Draw background 65 | self.backgroundColor = UIColor.whiteColor() 66 | 67 | // Draw grid 68 | let numberOfHorizontalGrids: UInt = 5 69 | let horizontalGridMargin = (self.maximumValue - self.minimumValue) / Double(numberOfHorizontalGrids - 1) 70 | let verticalPixelPerValue: CGFloat = frame.height / CGFloat(self.maximumValue - self.minimumValue) 71 | 72 | let labelFont = UIFont.systemFontOfSize(8.0) 73 | let labelAttributes = [ 74 | NSForegroundColorAttributeName: self.gridColor, 75 | NSFontAttributeName: labelFont 76 | ] 77 | 78 | let context: CGContextRef = UIGraphicsGetCurrentContext()! 79 | CGContextSetLineWidth(context, 1.0) 80 | 81 | for i in 0.. 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 | CFBundleDisplayName 16 | MEMELogger 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UIBackgroundModes 28 | 29 | bluetooth-central 30 | 31 | UIFileSharingEnabled 32 | 33 | UILaunchStoryboardName 34 | LaunchScreen 35 | UIMainStoryboardFile 36 | Main 37 | UIRequiredDeviceCapabilities 38 | 39 | armv7 40 | 41 | UISupportedInterfaceOrientations 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/JMPairingVC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JMPairingVC.swift 3 | // MEMESample 4 | // 5 | // Created by Shoya Ishimaru on 2015/11/09. 6 | // Copyright © 2015年 shoya140. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SVProgressHUD 11 | 12 | class JMPairingVC: UIViewController, UITableViewDelegate, UITableViewDataSource, MEMELibDelegate { 13 | 14 | @IBOutlet weak var tableView: UITableView! 15 | 16 | var peripheralsFound: Array = [] 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | 21 | peripheralsFound = [] 22 | tableView.dataSource = self 23 | tableView.delegate = self 24 | 25 | MEMELib.sharedInstance().delegate = self 26 | checkMEMEStatus(MEMELib.sharedInstance().startScanningPeripherals()) 27 | } 28 | 29 | override func viewWillDisappear(animated: Bool) { 30 | super.viewWillDisappear(animated) 31 | 32 | SVProgressHUD.dismiss() 33 | } 34 | 35 | @IBAction func cancelButtonTapped(sender: AnyObject) { 36 | self.dismissViewControllerAnimated(true, completion: nil) 37 | } 38 | 39 | // MARK: - Utility 40 | 41 | func checkMEMEStatus(status: MEMEStatus) { 42 | var memeAlert: UIAlertController? = nil 43 | if status == MEME_ERROR_APP_AUTH { 44 | memeAlert = UIAlertController(title: "App Auth Failed", message: "Invalid Application ID or Client Secret", preferredStyle: .Alert) 45 | } else if status == MEME_ERROR_SDK_AUTH { 46 | memeAlert = UIAlertController(title: "SDK Auth Failed", message: "Invalid SDK. Please update to the latest SDK.", preferredStyle: .Alert) 47 | } else if status == MEME_ERROR_SDK_AUTH { 48 | memeAlert = UIAlertController(title: "SDK_ERROR", message: "Invalid Command", preferredStyle: .Alert) 49 | } else if status == MEME_ERROR_SDK_AUTH { 50 | memeAlert = UIAlertController(title: "Error", message: "Bluetooth is off.", preferredStyle: .Alert) 51 | } 52 | 53 | if let alert = memeAlert { 54 | presentViewController(alert, animated: true, completion: nil) 55 | } else { 56 | print("Status: MEME_OK") 57 | } 58 | } 59 | 60 | 61 | // MARK: - Table view data source 62 | 63 | func numberOfSectionsInTableView(tableView: UITableView) -> Int { 64 | return 1 65 | } 66 | 67 | func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 68 | return peripheralsFound.count 69 | } 70 | 71 | func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 72 | let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) 73 | cell.textLabel?.text = peripheralsFound[indexPath.row].identifier.UUIDString 74 | return cell 75 | } 76 | 77 | // MARK: - Table view delegate 78 | 79 | func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 80 | MEMELib.sharedInstance().connectPeripheral(peripheralsFound[indexPath.row]) 81 | SVProgressHUD.showWithStatus("Connecting") 82 | } 83 | 84 | // MARK: - MEMELib delegate 85 | 86 | func memePeripheralFound(peripheral: CBPeripheral!, withDeviceAddress address: String!) { 87 | for p in peripheralsFound { 88 | if p.identifier.isEqual(peripheral.identifier){ 89 | return 90 | } 91 | } 92 | 93 | print("MEME Peripheral Found %@", peripheral.identifier.UUIDString) 94 | peripheralsFound.append(peripheral) 95 | tableView.reloadData() 96 | } 97 | 98 | func memePeripheralConnected(peripheral: CBPeripheral!) { 99 | print("MEME Device Connected %@", peripheral.identifier.UUIDString) 100 | MEMELib.sharedInstance().startDataReport() 101 | 102 | SVProgressHUD.dismiss() 103 | self.dismissViewControllerAnimated(true, completion: nil) 104 | } 105 | 106 | func memePeripheralDisconnected(peripheral: CBPeripheral!) { 107 | print("MEME Device Disconnected") 108 | } 109 | 110 | func memeAppAuthorized(status: MEMEStatus) { 111 | checkMEMEStatus(status) 112 | } 113 | 114 | func memeCommandResponse(response: MEMEResponse) { 115 | print("Command Response - eventCode: 0x%02x - commandResult: %d", response.eventCode, response.commandResult.boolValue); 116 | switch response.eventCode { 117 | case 0x02: 118 | print("MEME Data Report Started") 119 | case 0x04: 120 | print("MEME Data Report Stopped"); 121 | default: 122 | break 123 | } 124 | } 125 | 126 | } -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/JMRealTimeDataVC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JMRealTimeDataVC.swift 3 | // MEMESample 4 | // 5 | // Created by Shoya Ishimaru on 2015/11/10. 6 | // Copyright © 2015年 shoya140. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class JMRealTimeDataVC: UIViewController, UITableViewDelegate, UITableViewDataSource, MEMELibDelegate { 12 | 13 | @IBOutlet weak var tableView: UITableView! 14 | 15 | private var numberOfValuesToBeDisplayed: UInt = 20 * 10 16 | private var blinkStrengths: [Double] = [0.0] 17 | private var blinkSpeeds: [Double] = [0.0] 18 | private var verticalEyeMovements: [Double] = [0.0] 19 | private var horizontalEyeMovements: [Double] = [0.0] 20 | private var accXValues: [Double] = [0.0] 21 | private var accYValues: [Double] = [0.0] 22 | private var accZValues: [Double] = [0.0] 23 | private var gyroRValues: [Double] = [0.0] 24 | private var gyroPValues: [Double] = [0.0] 25 | private var gyroYValues: [Double] = [0.0] 26 | private var isWalkings: [Double] = [0.0] 27 | private var fitErrors: [Double] = [0.0] 28 | private var powerLefts: [Double] = [0.0] 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | 33 | tableView.delegate = self 34 | tableView.dataSource = self 35 | } 36 | 37 | override func viewWillAppear(animated: Bool) { 38 | super.viewWillAppear(animated) 39 | 40 | MEMELib.sharedInstance().delegate = self 41 | } 42 | 43 | // MARK: - Table view data source 44 | 45 | func numberOfSectionsInTableView(tableView: UITableView) -> Int { 46 | return 4 47 | } 48 | 49 | func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 50 | switch section { 51 | case 0: 52 | return 3 53 | case 1: 54 | return 2 55 | case 2: 56 | return 6 57 | case 3: 58 | return 3 59 | default: 60 | break 61 | } 62 | return 14 63 | } 64 | 65 | func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { 66 | if indexPath.section == 0 && indexPath.row == 0 { 67 | return 100 68 | } else { 69 | return 160 70 | } 71 | } 72 | 73 | func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? { 74 | switch section { 75 | case 0: 76 | return "Blink Detection" 77 | case 1: 78 | return "Eye Movement" 79 | case 2: 80 | return "Head Movement" 81 | case 3: 82 | return "Utility" 83 | default: 84 | return "" 85 | } 86 | } 87 | 88 | func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 89 | switch indexPath.section { 90 | case 0: 91 | switch indexPath.row { 92 | case 0: 93 | let cell = tableView.dequeueReusableCellWithIdentifier("EyeCell", forIndexPath: indexPath) 94 | cell.backgroundColor = UIColor.hex("#edf2f8", alpha: 1.0) 95 | let eyeView = (cell.viewWithTag(1) as! EyeView) 96 | if blinkStrengths.last! > 0 { 97 | eyeView.eyeOpened = false 98 | } else { 99 | eyeView.eyeOpened = true 100 | } 101 | eyeView.setNeedsDisplay() 102 | return cell 103 | case 1: 104 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 105 | (cell.viewWithTag(1) as! UILabel).text = "Blink Strength" 106 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.0f", blinkStrengths.last!) 107 | (cell.viewWithTag(3) as! GraphView).maximumValue = 200 108 | (cell.viewWithTag(3) as! GraphView).minimumValue = 0 109 | (cell.viewWithTag(3) as! GraphView).values = blinkStrengths 110 | return cell 111 | case 2: 112 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 113 | (cell.viewWithTag(1) as! UILabel).text = "Blink Speed" 114 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.0f", blinkSpeeds.last!) 115 | (cell.viewWithTag(3) as! GraphView).maximumValue = 200 116 | (cell.viewWithTag(3) as! GraphView).minimumValue = 0 117 | (cell.viewWithTag(3) as! GraphView).values = blinkSpeeds 118 | return cell 119 | default: 120 | break 121 | } 122 | case 1: 123 | switch indexPath.row { 124 | case 0: 125 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 126 | (cell.viewWithTag(1) as! UILabel).text = "Vertical Eye Movement" 127 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.0f", verticalEyeMovements.last!) 128 | (cell.viewWithTag(3) as! GraphView).maximumValue = 3 129 | (cell.viewWithTag(3) as! GraphView).minimumValue = -3 130 | (cell.viewWithTag(3) as! GraphView).values = verticalEyeMovements 131 | return cell 132 | case 1: 133 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 134 | (cell.viewWithTag(1) as! UILabel).text = "Horizonal Eye Movement" 135 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.0f", horizontalEyeMovements.last!) 136 | (cell.viewWithTag(3) as! GraphView).maximumValue = 3 137 | (cell.viewWithTag(3) as! GraphView).minimumValue = -3 138 | (cell.viewWithTag(3) as! GraphView).values = horizontalEyeMovements 139 | return cell 140 | default: 141 | break 142 | } 143 | case 2: 144 | switch indexPath.row { 145 | case 0: 146 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 147 | (cell.viewWithTag(1) as! UILabel).text = "Acceleration X" 148 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.2f", accXValues.last!) 149 | (cell.viewWithTag(3) as! GraphView).maximumValue = 50 150 | (cell.viewWithTag(3) as! GraphView).minimumValue = -50 151 | (cell.viewWithTag(3) as! GraphView).values = accXValues 152 | return cell 153 | case 1: 154 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 155 | (cell.viewWithTag(1) as! UILabel).text = "Acceleration Y" 156 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.2f", accYValues.last!) 157 | (cell.viewWithTag(3) as! GraphView).maximumValue = 50 158 | (cell.viewWithTag(3) as! GraphView).minimumValue = -50 159 | (cell.viewWithTag(3) as! GraphView).values = accYValues 160 | return cell 161 | case 2: 162 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 163 | (cell.viewWithTag(1) as! UILabel).text = "Acceleration Z" 164 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.2f", accZValues.last!) 165 | (cell.viewWithTag(3) as! GraphView).maximumValue = 50 166 | (cell.viewWithTag(3) as! GraphView).minimumValue = -50 167 | (cell.viewWithTag(3) as! GraphView).values = accZValues 168 | return cell 169 | case 3: 170 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 171 | (cell.viewWithTag(1) as! UILabel).text = "Rotation Roll" 172 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.2f", gyroRValues.last!) 173 | (cell.viewWithTag(3) as! GraphView).maximumValue = 90 174 | (cell.viewWithTag(3) as! GraphView).minimumValue = -90 175 | (cell.viewWithTag(3) as! GraphView).values = gyroRValues 176 | return cell 177 | case 4: 178 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 179 | (cell.viewWithTag(1) as! UILabel).text = "Rotation Pitch" 180 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.2f", gyroPValues.last!) 181 | (cell.viewWithTag(3) as! GraphView).maximumValue = 180 182 | (cell.viewWithTag(3) as! GraphView).minimumValue = -180 183 | (cell.viewWithTag(3) as! GraphView).values = gyroPValues 184 | return cell 185 | case 5: 186 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 187 | (cell.viewWithTag(1) as! UILabel).text = "Rotation Yaw" 188 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.2f", gyroYValues.last!) 189 | (cell.viewWithTag(3) as! GraphView).maximumValue = 360 190 | (cell.viewWithTag(3) as! GraphView).minimumValue = 0 191 | (cell.viewWithTag(3) as! GraphView).values = gyroYValues 192 | return cell 193 | default: 194 | break 195 | } 196 | case 3: 197 | switch indexPath.row { 198 | case 0: 199 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 200 | (cell.viewWithTag(1) as! UILabel).text = "Walking Detection" 201 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.0f", isWalkings.last!) 202 | (cell.viewWithTag(3) as! GraphView).maximumValue = 4 203 | (cell.viewWithTag(3) as! GraphView).minimumValue = 0 204 | (cell.viewWithTag(3) as! GraphView).values = isWalkings 205 | return cell 206 | case 1: 207 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 208 | (cell.viewWithTag(1) as! UILabel).text = "Fit Error" 209 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.0f", fitErrors.last!) 210 | (cell.viewWithTag(3) as! GraphView).maximumValue = 4 211 | (cell.viewWithTag(3) as! GraphView).minimumValue = 0 212 | (cell.viewWithTag(3) as! GraphView).values = fitErrors 213 | return cell 214 | case 2: 215 | let cell = tableView.dequeueReusableCellWithIdentifier("GraphCell", forIndexPath: indexPath) 216 | (cell.viewWithTag(1) as! UILabel).text = "Power Left" 217 | (cell.viewWithTag(2) as! UILabel).text = String(format: "%.0f", powerLefts.last!) 218 | (cell.viewWithTag(3) as! GraphView).maximumValue = 5 219 | (cell.viewWithTag(3) as! GraphView).minimumValue = 1 220 | (cell.viewWithTag(3) as! GraphView).values = powerLefts 221 | return cell 222 | default: 223 | break 224 | } 225 | default: 226 | break 227 | } 228 | let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) 229 | return cell 230 | } 231 | 232 | // MARK: - MEMELib delegate 233 | 234 | func memeRealTimeModeDataReceived(data: MEMERealTimeData!) { 235 | if FileWriter.sharedWriter.isRecording{ 236 | FileWriter.sharedWriter.writeData(data) 237 | } 238 | 239 | blinkStrengths.append(Double(data.blinkStrength)) 240 | if blinkStrengths.count > Int(self.numberOfValuesToBeDisplayed) { 241 | blinkStrengths.removeRange(Range( 242 | start: 0, 243 | end: blinkStrengths.count - Int(numberOfValuesToBeDisplayed) 244 | )) 245 | } 246 | 247 | blinkSpeeds.append(Double(data.blinkSpeed)) 248 | if blinkSpeeds.count > Int(self.numberOfValuesToBeDisplayed) { 249 | blinkSpeeds.removeRange(Range( 250 | start: 0, 251 | end: blinkSpeeds.count - Int(numberOfValuesToBeDisplayed) 252 | )) 253 | } 254 | 255 | verticalEyeMovements.append(Double(data.eyeMoveUp) - Double(data.eyeMoveDown)) 256 | if verticalEyeMovements.count > Int(self.numberOfValuesToBeDisplayed) { 257 | verticalEyeMovements.removeRange(Range( 258 | start: 0, 259 | end: verticalEyeMovements.count - Int(numberOfValuesToBeDisplayed) 260 | )) 261 | } 262 | 263 | horizontalEyeMovements.append(Double(data.eyeMoveLeft) - Double(data.eyeMoveRight)) 264 | if horizontalEyeMovements.count > Int(self.numberOfValuesToBeDisplayed) { 265 | horizontalEyeMovements.removeRange(Range( 266 | start: 0, 267 | end: horizontalEyeMovements.count - Int(numberOfValuesToBeDisplayed) 268 | )) 269 | } 270 | 271 | accXValues.append(Double(data.accX)) 272 | if accXValues.count > Int(self.numberOfValuesToBeDisplayed) { 273 | accXValues.removeRange(Range( 274 | start: 0, 275 | end: accXValues.count - Int(numberOfValuesToBeDisplayed) 276 | )) 277 | } 278 | 279 | accYValues.append(Double(data.accY)) 280 | if accYValues.count > Int(self.numberOfValuesToBeDisplayed) { 281 | accYValues.removeRange(Range( 282 | start: 0, 283 | end: accYValues.count - Int(numberOfValuesToBeDisplayed) 284 | )) 285 | } 286 | 287 | accZValues.append(Double(data.accZ)) 288 | if accZValues.count > Int(self.numberOfValuesToBeDisplayed) { 289 | accZValues.removeRange(Range( 290 | start: 0, 291 | end: accZValues.count - Int(numberOfValuesToBeDisplayed) 292 | )) 293 | } 294 | 295 | gyroRValues.append(Double(data.roll)) 296 | if gyroRValues.count > Int(self.numberOfValuesToBeDisplayed) { 297 | gyroRValues.removeRange(Range( 298 | start: 0, 299 | end: gyroRValues.count - Int(numberOfValuesToBeDisplayed) 300 | )) 301 | } 302 | 303 | gyroPValues.append(Double(data.pitch)) 304 | if gyroPValues.count > Int(self.numberOfValuesToBeDisplayed) { 305 | gyroPValues.removeRange(Range( 306 | start: 0, 307 | end: gyroPValues.count - Int(numberOfValuesToBeDisplayed) 308 | )) 309 | } 310 | 311 | gyroYValues.append(Double(data.yaw)) 312 | if gyroYValues.count > Int(self.numberOfValuesToBeDisplayed) { 313 | gyroYValues.removeRange(Range( 314 | start: 0, 315 | end: gyroYValues.count - Int(numberOfValuesToBeDisplayed) 316 | )) 317 | } 318 | 319 | isWalkings.append(Double(data.isWalking)) 320 | if isWalkings.count > Int(self.numberOfValuesToBeDisplayed) { 321 | isWalkings.removeRange(Range( 322 | start: 0, 323 | end: isWalkings.count - Int(numberOfValuesToBeDisplayed) 324 | )) 325 | } 326 | 327 | fitErrors.append(Double(data.fitError)) 328 | if fitErrors.count > Int(self.numberOfValuesToBeDisplayed) { 329 | fitErrors.removeRange(Range( 330 | start: 0, 331 | end: fitErrors.count - Int(numberOfValuesToBeDisplayed) 332 | )) 333 | } 334 | 335 | powerLefts.append(Double(data.powerLeft)) 336 | if powerLefts.count > Int(self.numberOfValuesToBeDisplayed) { 337 | powerLefts.removeRange(Range( 338 | start: 0, 339 | end: powerLefts.count - Int(numberOfValuesToBeDisplayed) 340 | )) 341 | } 342 | 343 | self.tableView.reloadData() 344 | } 345 | 346 | func memePeripheralDisconnected(peripheral: CBPeripheral!) { 347 | let notification = UILocalNotification() 348 | notification.alertBody = "The device has been disconnected." 349 | notification.soundName = UILocalNotificationDefaultSoundName 350 | UIApplication.sharedApplication().presentLocalNotificationNow(notification) 351 | 352 | if UIApplication.sharedApplication().applicationState == .Active { 353 | let alert = UIAlertController(title: "Disconnected", message: "The device has been disconnected.", preferredStyle: .Alert) 354 | alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil)) 355 | presentViewController(alert, animated: true, completion: nil) 356 | } 357 | } 358 | 359 | } 360 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/JMRecordingVC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JMRecordingVC.swift 3 | // MEMELogger-iOS-beta 4 | // 5 | // Created by Shoya Ishimaru on 2015/11/12. 6 | // Copyright © 2015年 shoya140. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SVProgressHUD 11 | 12 | class JMRecordingVC: UIViewController, MEMELibDelegate{ 13 | 14 | @IBOutlet weak var recordSwitchButton: SIFlatButton! 15 | @IBOutlet weak var lastTimestampLabel: UILabel! 16 | @IBOutlet weak var segmentSwitch: UISegmentedControl! 17 | 18 | private var label:Int = 0 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | 23 | } 24 | 25 | override func viewWillAppear(animated: Bool) { 26 | super.viewWillAppear(animated) 27 | 28 | MEMELib.sharedInstance().delegate = self 29 | } 30 | 31 | @IBAction func switchRecording(sender: AnyObject) { 32 | if FileWriter.sharedWriter.isRecording { 33 | FileWriter.sharedWriter.stopRecording() 34 | self.recordSwitchButton.setTitle("Start Recording", forState: UIControlState.Normal) 35 | self.recordSwitchButton.inverse = false 36 | } else { 37 | FileWriter.sharedWriter.startRecording() 38 | self.recordSwitchButton.setTitle("Stop Recording", forState: UIControlState.Normal) 39 | self.recordSwitchButton.inverse = true 40 | self.segmentSwitch.selectedSegmentIndex = 0 41 | } 42 | } 43 | 44 | @IBAction func eventLavelButtonTapped(sender: UIButton) { 45 | FileWriter.sharedWriter.eventLabel = 1 46 | } 47 | 48 | @IBAction func segmentLabelChanged(sender: UISegmentedControl) { 49 | FileWriter.sharedWriter.segmentLabel = sender.selectedSegmentIndex 50 | } 51 | 52 | // MARK: - MEMELib delegate 53 | 54 | func memeRealTimeModeDataReceived(data: MEMERealTimeData!) { 55 | if FileWriter.sharedWriter.isRecording{ 56 | FileWriter.sharedWriter.writeData(data) 57 | lastTimestampLabel.text = NSString(format: "Last timestamp: %10.5f", NSDate().timeIntervalSince1970 ) as String 58 | } 59 | } 60 | 61 | func memePeripheralDisconnected(peripheral: CBPeripheral!) { 62 | let notification = UILocalNotification() 63 | notification.alertBody = "The device has been disconnected." 64 | notification.soundName = UILocalNotificationDefaultSoundName 65 | UIApplication.sharedApplication().presentLocalNotificationNow(notification) 66 | 67 | if UIApplication.sharedApplication().applicationState == .Active { 68 | let alert = UIAlertController(title: "Disconnected", message: "The device has been disconnected.", preferredStyle: .Alert) 69 | alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil)) 70 | presentViewController(alert, animated: true, completion: nil) 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/SIFlatButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SIFlatButton.swift 3 | // MEMELogger 4 | // 5 | // Created by Shoya Ishimaru on 2015/06/06. 6 | // Copyright (c) 2015年 shoya140. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @IBDesignable 12 | class SIFlatButton: UIButton { 13 | 14 | @IBInspectable var inverse: Bool = false { 15 | didSet { 16 | updateButtonColor() 17 | } 18 | } 19 | 20 | @IBInspectable var buttonColor: UIColor = UIColor.blueColor() { 21 | didSet { 22 | updateButtonColor() 23 | } 24 | } 25 | 26 | func updateButtonColor() { 27 | if inverse { 28 | setTitleColor(UIColor.whiteColor(), forState: UIControlState.Normal) 29 | setTitleColor(buttonColor, forState: UIControlState.Highlighted) 30 | backgroundColor = buttonColor 31 | } else { 32 | setTitleColor(buttonColor, forState: UIControlState.Normal) 33 | setTitleColor(UIColor.whiteColor(), forState: UIControlState.Highlighted) 34 | backgroundColor = UIColor.whiteColor() 35 | } 36 | 37 | setTitleShadowColor(UIColor.clearColor(), forState: UIControlState.Normal) 38 | setTitleShadowColor(UIColor.clearColor(), forState: UIControlState.Highlighted) 39 | layer.borderColor = buttonColor.CGColor 40 | } 41 | 42 | @IBInspectable var cornerRadius: CGFloat = 0 { 43 | didSet { 44 | layer.cornerRadius = cornerRadius 45 | } 46 | } 47 | 48 | @IBInspectable var borderWidth: CGFloat = 0 { 49 | didSet { 50 | layer.borderWidth = borderWidth 51 | } 52 | } 53 | 54 | override var highlighted: Bool { 55 | didSet { 56 | if highlighted { 57 | if inverse { 58 | backgroundColor = UIColor.whiteColor() 59 | } else { 60 | backgroundColor = buttonColor 61 | } 62 | } else { 63 | if inverse { 64 | backgroundColor = buttonColor 65 | } else { 66 | backgroundColor = UIColor.whiteColor() 67 | } 68 | } 69 | } 70 | } 71 | 72 | } -------------------------------------------------------------------------------- /MEMELogger-iOS-developers/UIColor+Hex.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor.swift 3 | // MEMELogger 4 | // 5 | // Created by Shoya Ishimaru on 2015/12/31. 6 | // Copyright © 2015年 shoya140. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIColor { 12 | class func hex (code : NSString, alpha : CGFloat) -> UIColor { 13 | let code = code.stringByReplacingOccurrencesOfString("#", withString: "") 14 | let scanner = NSScanner(string: code as String) 15 | var color: UInt32 = 0 16 | if scanner.scanHexInt(&color) { 17 | let r = CGFloat((color & 0xFF0000) >> 16) / 255.0 18 | let g = CGFloat((color & 0x00FF00) >> 8) / 255.0 19 | let b = CGFloat(color & 0x0000FF) / 255.0 20 | return UIColor(red:r,green:g,blue:b,alpha:alpha) 21 | } else { 22 | print("invalid hex string") 23 | return UIColor.whiteColor(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MEMELogger-iOS-developers 2 | ============= 3 | 4 | Sensor logging application on **J!NS MEME for Developers** 5 | 6 | If your device is MEME Beta (pre-released version), please use [version/meme-beta](https://github.com/shoya140/MEMELogger-iOS-developers/tree/version/meme-beta) branch. 7 | 8 | 9 | 10 | ## Requirements 11 | 12 | - iOS 8.0+ 13 | - J!NS MEME for Developer 14 | 15 | ## Setup 16 | 17 | ### 1.Carthage update 18 | 19 | ``` 20 | $ brew install carthage # if necessary 21 | $ carthage update 22 | ``` 23 | 24 | ### 2.Create ```Key.h``` in the project 25 | 26 | ``` 27 | $ cp Key.h.org Key.h 28 | ``` 29 | 30 | ### 3.Write your MEME_APP_ID and MEME_APP_SECRET in ```Key.h```. 31 | 32 | 33 | --------------------------------------------------------------------------------