├── .gitignore ├── Harmony iOS ├── .gitignore ├── Harmony iOS │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── Screen Shot 2017-07-21 at 1.50.45 PM.imageset │ │ │ ├── Screen Shot 2017-07-21 at 1.50.45 PM.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Harmony iOS-Bridging-Header.h │ ├── PayloadConverter.m │ ├── PTExampleProtocol.h │ ├── Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── AppDelegate.swift │ ├── NSStream+BoundPairAdditions.m │ └── ViewController.swift ├── Pods │ ├── Target Support Files │ │ ├── PeerTalk │ │ │ ├── PeerTalk.modulemap │ │ │ ├── PeerTalk-dummy.m │ │ │ ├── PeerTalk-prefix.pch │ │ │ ├── PeerTalk.xcconfig │ │ │ ├── PeerTalk-umbrella.h │ │ │ └── Info.plist │ │ └── Pods-Harmony iOS │ │ │ ├── Pods-Harmony iOS.modulemap │ │ │ ├── Pods-Harmony iOS-dummy.m │ │ │ ├── Pods-Harmony iOS-umbrella.h │ │ │ ├── Info.plist │ │ │ ├── Pods-Harmony iOS.debug.xcconfig │ │ │ ├── Pods-Harmony iOS.release.xcconfig │ │ │ ├── Pods-Harmony iOS-resources.sh │ │ │ └── Pods-Harmony iOS-frameworks.sh │ ├── PeerTalk │ │ ├── peertalk │ │ │ ├── Peertalk.h │ │ │ ├── PTPrivate.h │ │ │ ├── PTUSBHub.h │ │ │ ├── PTProtocol.h │ │ │ ├── PTChannel.h │ │ │ └── PTProtocol.m │ │ ├── LICENSE.txt │ │ └── README.md │ ├── Pods.xcodeproj │ │ └── xcuserdata │ │ │ └── fred.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ ├── PeerTalk.xcscheme │ │ │ └── Pods-Harmony iOS.xcscheme │ ├── Manifest.lock │ └── Local Podspecs │ │ └── PeerTalk.podspec.json ├── Harmony iOS.xcworkspace │ ├── xcuserdata │ │ └── fred.xcuserdatad │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ └── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Harmony iOS.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── fred.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ ├── xcuserdata │ │ └── fred.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── Harmony iOS.xcscheme │ └── project.pbxproj ├── Podfile └── Podfile.lock ├── Harmony Desktop ├── .gitignore ├── Pods │ ├── Target Support Files │ │ ├── PeerTalk │ │ │ ├── PeerTalk.modulemap │ │ │ ├── PeerTalk-dummy.m │ │ │ ├── PeerTalk-prefix.pch │ │ │ ├── PeerTalk.xcconfig │ │ │ └── PeerTalk-umbrella.h │ │ └── Pods-Harmony Desktop │ │ │ ├── Pods-Harmony Desktop.modulemap │ │ │ ├── Pods-Harmony Desktop-dummy.m │ │ │ ├── Pods-Harmony Desktop-umbrella.h │ │ │ ├── Pods-Harmony Desktop.debug.xcconfig │ │ │ ├── Pods-Harmony Desktop.release.xcconfig │ │ │ ├── Pods-Harmony Desktop-acknowledgements.markdown │ │ │ ├── Pods-Harmony Desktop-acknowledgements.plist │ │ │ └── Pods-Harmony Desktop-frameworks.sh │ ├── PeerTalk │ │ ├── peertalk │ │ │ ├── Peertalk.h │ │ │ ├── PTPrivate.h │ │ │ ├── PTUSBHub.h │ │ │ ├── PTProtocol.h │ │ │ ├── PTChannel.h │ │ │ └── PTProtocol.m │ │ ├── LICENSE.txt │ │ └── README.md │ ├── Pods.xcodeproj │ │ └── xcuserdata │ │ │ └── fred.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ ├── PeerTalk.xcscheme │ │ │ └── Pods-Harmony Desktop.xcscheme │ ├── Manifest.lock │ └── Local Podspecs │ │ └── PeerTalk.podspec.json ├── Harmony Desktop.xcworkspace │ ├── xcuserdata │ │ └── fred.xcuserdatad │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ └── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Harmony Desktop.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcuserdata │ │ │ └── fred.xcuserdatad │ │ │ │ └── UserInterfaceState.xcuserstate │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── fred.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── Harmony Desktop.xcscheme ├── Harmony Desktop │ ├── Harmony Desktop-Bridging-Header.h │ ├── AppDelegate.swift │ ├── PayloadConverter.m │ ├── Info.plist │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── PTExampleProtocol.h │ ├── MouseController.swift │ └── ViewController.swift ├── Podfile └── Podfile.lock └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | peertalk -------------------------------------------------------------------------------- /Harmony iOS/.gitignore: -------------------------------------------------------------------------------- 1 | Pods -------------------------------------------------------------------------------- /Harmony Desktop/.gitignore: -------------------------------------------------------------------------------- 1 | Pods -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/PeerTalk/PeerTalk.modulemap: -------------------------------------------------------------------------------- 1 | framework module PeerTalk { 2 | umbrella header "PeerTalk-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/PeerTalk/PeerTalk.modulemap: -------------------------------------------------------------------------------- 1 | framework module PeerTalk { 2 | umbrella header "PeerTalk-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/PeerTalk/PeerTalk-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PeerTalk : NSObject 3 | @end 4 | @implementation PodsDummy_PeerTalk 5 | @end 6 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/PeerTalk/PeerTalk-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PeerTalk : NSObject 3 | @end 4 | @implementation PodsDummy_PeerTalk 5 | @end 6 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Harmony_iOS { 2 | umbrella header "Pods-Harmony iOS-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Harmony_iOS : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Harmony_iOS 5 | @end 6 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/Pods-Harmony Desktop/Pods-Harmony Desktop.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Harmony_Desktop { 2 | umbrella header "Pods-Harmony Desktop-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS.xcworkspace/xcuserdata/fred.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrederickGeek8/Harmony/HEAD/Harmony iOS/Harmony iOS.xcworkspace/xcuserdata/fred.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/Pods-Harmony Desktop/Pods-Harmony Desktop-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Harmony_Desktop : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Harmony_Desktop 5 | @end 6 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop.xcworkspace/xcuserdata/fred.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrederickGeek8/Harmony/HEAD/Harmony Desktop/Harmony Desktop.xcworkspace/xcuserdata/fred.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS.xcodeproj/project.xcworkspace/xcuserdata/fred.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrederickGeek8/Harmony/HEAD/Harmony iOS/Harmony iOS.xcodeproj/project.xcworkspace/xcuserdata/fred.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop.xcodeproj/project.xcworkspace/xcuserdata/fred.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrederickGeek8/Harmony/HEAD/Harmony Desktop/Harmony Desktop.xcodeproj/project.xcworkspace/xcuserdata/fred.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/Assets.xcassets/Screen Shot 2017-07-21 at 1.50.45 PM.imageset/Screen Shot 2017-07-21 at 1.50.45 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FrederickGeek8/Harmony/HEAD/Harmony iOS/Harmony iOS/Assets.xcassets/Screen Shot 2017-07-21 at 1.50.45 PM.imageset/Screen Shot 2017-07-21 at 1.50.45 PM.png -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/Harmony iOS-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "PTExampleProtocol.h" 6 | #import "PeerTalk/PTChannel.h" 7 | #import "MobileVLCKit/MobileVLCKit.h" 8 | #import "PayloadConverter.m" 9 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop/Harmony Desktop-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | #import "Peertalk/PTChannel.h" 5 | #import "Peertalk/PTUSBHub.h" 6 | #import "PTExampleProtocol.h" 7 | 8 | #import "PayloadConverter.m" 9 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/PeerTalk/PeerTalk-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/PeerTalk/PeerTalk-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Harmony iOS/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '8.4' 3 | 4 | target 'Harmony iOS' do 5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | pod 'PeerTalk', :git => 'https://github.com/rsms/peertalk' 8 | pod 'MobileVLCKit' 9 | # Pods for Duet Desktop 10 | end 11 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_Harmony_iOSVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_Harmony_iOSVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/PeerTalk/PeerTalk.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PeerTalk 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_ROOT = ${SRCROOT} 6 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/PeerTalk 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/Pods-Harmony Desktop/Pods-Harmony Desktop-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_Harmony_DesktopVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_Harmony_DesktopVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Harmony Desktop/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :osx, '10.10' 3 | 4 | target 'Harmony Desktop' do 5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | pod 'PeerTalk', :git => 'https://github.com/rsms/peertalk' 8 | pod 'CocoaAsyncSocket' 9 | # pod 'SwiftSocket', :git => 'https://github.com/FrederickGeek8/SwiftSocket' 10 | # Pods for Duet Desktop 11 | end 12 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/Assets.xcassets/Screen Shot 2017-07-21 at 1.50.45 PM.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Screen Shot 2017-07-21 at 1.50.45 PM.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/PeerTalk/PeerTalk.xcconfig: -------------------------------------------------------------------------------- 1 | CODE_SIGN_IDENTITY = 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PeerTalk 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/PeerTalk 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/PeerTalk/PeerTalk-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "Peertalk.h" 14 | #import "PTChannel.h" 15 | #import "PTPrivate.h" 16 | #import "PTProtocol.h" 17 | #import "PTUSBHub.h" 18 | 19 | FOUNDATION_EXPORT double PeerTalkVersionNumber; 20 | FOUNDATION_EXPORT const unsigned char PeerTalkVersionString[]; 21 | 22 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/PeerTalk/PeerTalk-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "Peertalk.h" 14 | #import "PTChannel.h" 15 | #import "PTPrivate.h" 16 | #import "PTProtocol.h" 17 | #import "PTUSBHub.h" 18 | 19 | FOUNDATION_EXPORT double PeerTalkVersionNumber; 20 | FOUNDATION_EXPORT const unsigned char PeerTalkVersionString[]; 21 | 22 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS.xcodeproj/xcuserdata/fred.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Harmony iOS.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B65D1A641F21400C00972655 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop.xcodeproj/xcuserdata/fred.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Harmony Desktop.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B6C3F8B21F2109EC00B9B488 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Harmony Desktop 4 | // 5 | // Created by Frederick Morlock on 7/20/17. 6 | // Copyright © 2017 Frederick Morlock. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | 15 | 16 | func applicationDidFinishLaunching(_ aNotification: Notification) { 17 | // Insert code here to initialize your application 18 | } 19 | 20 | func applicationWillTerminate(_ aNotification: Notification) { 21 | // Insert code here to tear down your application 22 | } 23 | 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/PeerTalk/peertalk/Peertalk.h: -------------------------------------------------------------------------------- 1 | // 2 | // Peertalk.h 3 | // Peertalk 4 | // 5 | // Created by Marek Cirkos on 12/04/2016. 6 | // 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Peertalk. 12 | FOUNDATION_EXPORT double PeertalkVersionNumber; 13 | 14 | //! Project version string for Peertalk. 15 | FOUNDATION_EXPORT const unsigned char PeertalkVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | #import 21 | #import 22 | #import 23 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/PeerTalk/peertalk/Peertalk.h: -------------------------------------------------------------------------------- 1 | // 2 | // Peertalk.h 3 | // Peertalk 4 | // 5 | // Created by Marek Cirkos on 12/04/2016. 6 | // 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Peertalk. 12 | FOUNDATION_EXPORT double PeertalkVersionNumber; 13 | 14 | //! Project version string for Peertalk. 15 | FOUNDATION_EXPORT const unsigned char PeertalkVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | #import 21 | #import 22 | #import 23 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/PeerTalk/peertalk/PTPrivate.h: -------------------------------------------------------------------------------- 1 | #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \ 2 | (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8)) 3 | #define PT_DISPATCH_RETAIN_RELEASE 1 4 | #else 5 | #define PT_DISPATCH_RETAIN_RELEASE 0 6 | #endif 7 | 8 | #if PT_DISPATCH_RETAIN_RELEASE 9 | #define PT_PRECISE_LIFETIME 10 | #define PT_PRECISE_LIFETIME_UNUSED 11 | #else 12 | #define PT_PRECISE_LIFETIME __attribute__((objc_precise_lifetime)) 13 | #define PT_PRECISE_LIFETIME_UNUSED __attribute__((objc_precise_lifetime, unused)) 14 | #endif 15 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/PeerTalk/peertalk/PTPrivate.h: -------------------------------------------------------------------------------- 1 | #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \ 2 | (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8)) 3 | #define PT_DISPATCH_RETAIN_RELEASE 1 4 | #else 5 | #define PT_DISPATCH_RETAIN_RELEASE 0 6 | #endif 7 | 8 | #if PT_DISPATCH_RETAIN_RELEASE 9 | #define PT_PRECISE_LIFETIME 10 | #define PT_PRECISE_LIFETIME_UNUSED 11 | #else 12 | #define PT_PRECISE_LIFETIME __attribute__((objc_precise_lifetime)) 13 | #define PT_PRECISE_LIFETIME_UNUSED __attribute__((objc_precise_lifetime, unused)) 14 | #endif 15 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Pods.xcodeproj/xcuserdata/fred.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MobileVLCKit.xcscheme 8 | 9 | isShown 10 | 11 | 12 | PeerTalk.xcscheme 13 | 14 | isShown 15 | 16 | 17 | Pods-Harmony iOS.xcscheme 18 | 19 | isShown 20 | 21 | 22 | 23 | SuppressBuildableAutocreation 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Pods.xcodeproj/xcuserdata/fred.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CocoaAsyncSocket.xcscheme 8 | 9 | isShown 10 | 11 | 12 | PeerTalk.xcscheme 13 | 14 | isShown 15 | 16 | 17 | Pods-Harmony Desktop.xcscheme 18 | 19 | isShown 20 | 21 | 22 | 23 | SuppressBuildableAutocreation 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Harmony iOS/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MobileVLCKit (3.1.5) 3 | - PeerTalk (0.0.2) 4 | 5 | DEPENDENCIES: 6 | - MobileVLCKit 7 | - PeerTalk (from `https://github.com/rsms/peertalk`) 8 | 9 | SPEC REPOS: 10 | https://github.com/cocoapods/specs.git: 11 | - MobileVLCKit 12 | 13 | EXTERNAL SOURCES: 14 | PeerTalk: 15 | :git: https://github.com/rsms/peertalk 16 | 17 | CHECKOUT OPTIONS: 18 | PeerTalk: 19 | :commit: 5de384b349a1d51fc148c45f8ce0ac46b9bce39e 20 | :git: https://github.com/rsms/peertalk 21 | 22 | SPEC CHECKSUMS: 23 | MobileVLCKit: 4d44e56380d0ee41c76f9ec7015d3a4b62a963a3 24 | PeerTalk: f5389c286e4d477e59b73dfbf25c5c70a2464761 25 | 26 | PODFILE CHECKSUM: 5245fa66ea6eaf332c960d33a4a4390850ccde93 27 | 28 | COCOAPODS: 1.7.2 29 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MobileVLCKit (3.1.5) 3 | - PeerTalk (0.0.2) 4 | 5 | DEPENDENCIES: 6 | - MobileVLCKit 7 | - PeerTalk (from `https://github.com/rsms/peertalk`) 8 | 9 | SPEC REPOS: 10 | https://github.com/cocoapods/specs.git: 11 | - MobileVLCKit 12 | 13 | EXTERNAL SOURCES: 14 | PeerTalk: 15 | :git: https://github.com/rsms/peertalk 16 | 17 | CHECKOUT OPTIONS: 18 | PeerTalk: 19 | :commit: 5de384b349a1d51fc148c45f8ce0ac46b9bce39e 20 | :git: https://github.com/rsms/peertalk 21 | 22 | SPEC CHECKSUMS: 23 | MobileVLCKit: 4d44e56380d0ee41c76f9ec7015d3a4b62a963a3 24 | PeerTalk: f5389c286e4d477e59b73dfbf25c5c70a2464761 25 | 26 | PODFILE CHECKSUM: 5245fa66ea6eaf332c960d33a4a4390850ccde93 27 | 28 | COCOAPODS: 1.7.2 29 | -------------------------------------------------------------------------------- /Harmony Desktop/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CocoaAsyncSocket (7.6.3) 3 | - PeerTalk (0.0.2) 4 | 5 | DEPENDENCIES: 6 | - CocoaAsyncSocket 7 | - PeerTalk (from `https://github.com/rsms/peertalk`) 8 | 9 | SPEC REPOS: 10 | https://github.com/cocoapods/specs.git: 11 | - CocoaAsyncSocket 12 | 13 | EXTERNAL SOURCES: 14 | PeerTalk: 15 | :git: https://github.com/rsms/peertalk 16 | 17 | CHECKOUT OPTIONS: 18 | PeerTalk: 19 | :commit: 5de384b349a1d51fc148c45f8ce0ac46b9bce39e 20 | :git: https://github.com/rsms/peertalk 21 | 22 | SPEC CHECKSUMS: 23 | CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987 24 | PeerTalk: f5389c286e4d477e59b73dfbf25c5c70a2464761 25 | 26 | PODFILE CHECKSUM: a6f62a586f3a62a25724a51d1c5c18fe6b88a532 27 | 28 | COCOAPODS: 1.7.2 29 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CocoaAsyncSocket (7.6.3) 3 | - PeerTalk (0.0.2) 4 | 5 | DEPENDENCIES: 6 | - CocoaAsyncSocket 7 | - PeerTalk (from `https://github.com/rsms/peertalk`) 8 | 9 | SPEC REPOS: 10 | https://github.com/cocoapods/specs.git: 11 | - CocoaAsyncSocket 12 | 13 | EXTERNAL SOURCES: 14 | PeerTalk: 15 | :git: https://github.com/rsms/peertalk 16 | 17 | CHECKOUT OPTIONS: 18 | PeerTalk: 19 | :commit: 5de384b349a1d51fc148c45f8ce0ac46b9bce39e 20 | :git: https://github.com/rsms/peertalk 21 | 22 | SPEC CHECKSUMS: 23 | CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987 24 | PeerTalk: f5389c286e4d477e59b73dfbf25c5c70a2464761 25 | 26 | PODFILE CHECKSUM: a6f62a586f3a62a25724a51d1c5c18fe6b88a532 27 | 28 | COCOAPODS: 1.7.2 29 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/PayloadConverter.m: -------------------------------------------------------------------------------- 1 | // 2 | // Conversion.m 3 | // Harmony iOS 4 | // 5 | // Created by Frederick Morlock on 7/20/17. 6 | // Copyright © 2017 Frederick Morlock. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PTExampleProtocol.h" 11 | #import "PeerTalk/PTChannel.h" 12 | 13 | @interface PayloadConverter : NSObject 14 | -(NSString *)convertToString:(PTData*) payload; 15 | @end 16 | 17 | @implementation PayloadConverter : NSObject 18 | 19 | -(NSString *)convertToString:(PTData*) payload{ 20 | PTExampleTextFrame *textFrame = (PTExampleTextFrame*)payload.data; 21 | textFrame->length = ntohl(textFrame->length); 22 | NSString *message = [[NSString alloc] initWithBytes:textFrame->utf8text length:textFrame->length encoding:NSUTF8StringEncoding]; 23 | 24 | return message; 25 | } 26 | 27 | @end 28 | 29 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop/PayloadConverter.m: -------------------------------------------------------------------------------- 1 | // 2 | // Conversion.m 3 | // Harmony iOS 4 | // 5 | // Created by Frederick Morlock on 7/20/17. 6 | // Copyright © 2017 Frederick Morlock. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PTExampleProtocol.h" 11 | #import "PeerTalk/PTChannel.h" 12 | 13 | @interface PayloadConverter : NSObject 14 | -(NSString *)convertToString:(PTData*) payload; 15 | @end 16 | 17 | @implementation PayloadConverter : NSObject 18 | 19 | -(NSString *)convertToString:(PTData*) payload{ 20 | PTExampleTextFrame *textFrame = (PTExampleTextFrame*)payload.data; 21 | textFrame->length = ntohl(textFrame->length); 22 | NSString *message = [[NSString alloc] initWithBytes:textFrame->utf8text length:textFrame->length encoding:NSUTF8StringEncoding]; 23 | 24 | return message; 25 | } 26 | 27 | @end 28 | 29 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/Pods-Harmony Desktop/Pods-Harmony Desktop.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaAsyncSocket" "${PODS_CONFIGURATION_BUILD_DIR}/PeerTalk" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaAsyncSocket/CocoaAsyncSocket.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/PeerTalk/PeerTalk.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "CocoaAsyncSocket" -framework "CoreServices" -framework "PeerTalk" -framework "Security" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/Pods-Harmony Desktop/Pods-Harmony Desktop.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaAsyncSocket" "${PODS_CONFIGURATION_BUILD_DIR}/PeerTalk" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaAsyncSocket/CocoaAsyncSocket.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/PeerTalk/PeerTalk.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "CocoaAsyncSocket" -framework "CoreServices" -framework "PeerTalk" -framework "Security" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/PeerTalk/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 | FMWK 17 | CFBundleShortVersionString 18 | 0.0.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/Pods-Harmony iOS/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_CXX_LANGUAGE_STANDARD = c++11 2 | CLANG_CXX_LIBRARY = libc++ 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PeerTalk" "${PODS_ROOT}/MobileVLCKit" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PeerTalk/PeerTalk.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 7 | OTHER_LDFLAGS = $(inherited) -ObjC -l"bz2" -l"c++" -l"iconv" -l"xml2" -l"z" -framework "AVFoundation" -framework "AudioToolbox" -framework "CFNetwork" -framework "CoreGraphics" -framework "CoreMedia" -framework "CoreText" -framework "MobileVLCKit" -framework "OpenGLES" -framework "PeerTalk" -framework "QuartzCore" -framework "Security" -framework "VideoToolbox" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_CXX_LANGUAGE_STANDARD = c++11 2 | CLANG_CXX_LIBRARY = libc++ 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PeerTalk" "${PODS_ROOT}/MobileVLCKit" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PeerTalk/PeerTalk.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 7 | OTHER_LDFLAGS = $(inherited) -ObjC -l"bz2" -l"c++" -l"iconv" -l"xml2" -l"z" -framework "AVFoundation" -framework "AudioToolbox" -framework "CFNetwork" -framework "CoreGraphics" -framework "CoreMedia" -framework "CoreText" -framework "MobileVLCKit" -framework "OpenGLES" -framework "PeerTalk" -framework "QuartzCore" -framework "Security" -framework "VideoToolbox" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Local Podspecs/PeerTalk.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PeerTalk", 3 | "version": "0.0.2", 4 | "license": { 5 | "type": "MIT" 6 | }, 7 | "homepage": "http://rsms.me/peertalk/", 8 | "authors": { 9 | "Rasmus Andersson": "rasmus@notion.se" 10 | }, 11 | "summary": "iOS and OS X Cocoa library for communicating over USB and TCP.", 12 | "source": { 13 | "git": "https://github.com/rsms/PeerTalk.git", 14 | "tag": "0.0.2" 15 | }, 16 | "source_files": "peertalk/*.{h,m}", 17 | "requires_arc": true, 18 | "platforms": { 19 | "ios": "8.4", 20 | "osx": "10.10" 21 | }, 22 | "description": "PeerTalk is a iOS and OS X Cocoa library for communicating over USB and TCP.\n\nHighlights:\n\n* Provides you with USB device attach/detach events and attached device's info\n* Can connect to TCP services on supported attached devices (e.g. an iPhone), bridging the communication over USB transport\n* Offers a higher-level API (PTChannel and PTProtocol) for convenient implementations.\n* Tested and designed for libdispatch (aka Grand Central Dispatch)." 23 | } 24 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Local Podspecs/PeerTalk.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PeerTalk", 3 | "version": "0.0.2", 4 | "license": { 5 | "type": "MIT" 6 | }, 7 | "homepage": "http://rsms.me/peertalk/", 8 | "authors": { 9 | "Rasmus Andersson": "rasmus@notion.se" 10 | }, 11 | "summary": "iOS and OS X Cocoa library for communicating over USB and TCP.", 12 | "source": { 13 | "git": "https://github.com/rsms/PeerTalk.git", 14 | "tag": "0.0.2" 15 | }, 16 | "source_files": "peertalk/*.{h,m}", 17 | "requires_arc": true, 18 | "platforms": { 19 | "ios": "8.4", 20 | "osx": "10.10" 21 | }, 22 | "description": "PeerTalk is a iOS and OS X Cocoa library for communicating over USB and TCP.\n\nHighlights:\n\n* Provides you with USB device attach/detach events and attached device's info\n* Can connect to TCP services on supported attached devices (e.g. an iPhone), bridging the communication over USB transport\n* Offers a higher-level API (PTChannel and PTProtocol) for convenient implementations.\n* Tested and designed for libdispatch (aka Grand Central Dispatch)." 23 | } 24 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/PeerTalk/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Rasmus Andersson 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Harmony Desktop/Pods/PeerTalk/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Rasmus Andersson 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2017 Frederick Morlock. All rights reserved. 27 | NSMainStoryboardFile 28 | Main 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/PTExampleProtocol.h: -------------------------------------------------------------------------------- 1 | #ifndef peertalk_PTExampleProtocol_h 2 | #define peertalk_PTExampleProtocol_h 3 | 4 | #import 5 | #include 6 | 7 | static const int PTExampleProtocolIPv4PortNumber = 2345; 8 | 9 | enum { 10 | PTExampleFrameTypeDeviceInfo = 100, 11 | PTExampleFrameTypeTextMessage = 101, 12 | PTExampleFrameTypePing = 102, 13 | PTExampleFrameTypePong = 103, 14 | PTExampleFrameTypeData = 104 15 | }; 16 | 17 | typedef struct _PTExampleTextFrame { 18 | uint32_t length; 19 | uint8_t utf8text[0]; 20 | } PTExampleTextFrame; 21 | 22 | 23 | static dispatch_data_t PTExampleTextDispatchDataWithString(NSString *message) { 24 | // Use a custom struct 25 | const char *utf8text = [message cStringUsingEncoding:NSUTF8StringEncoding]; 26 | size_t length = strlen(utf8text); 27 | PTExampleTextFrame *textFrame = CFAllocatorAllocate(nil, sizeof(PTExampleTextFrame) + length, 0); 28 | memcpy(textFrame->utf8text, utf8text, length); // Copy bytes to utf8text array 29 | textFrame->length = htonl(length); // Convert integer to network byte order 30 | 31 | // Wrap the textFrame in a dispatch data object 32 | return dispatch_data_create((const void*)textFrame, sizeof(PTExampleTextFrame)+length, nil, ^{ 33 | CFAllocatorDeallocate(nil, textFrame); 34 | }); 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop/PTExampleProtocol.h: -------------------------------------------------------------------------------- 1 | #ifndef peertalk_PTExampleProtocol_h 2 | #define peertalk_PTExampleProtocol_h 3 | 4 | #import 5 | #include 6 | 7 | static const int PTExampleProtocolIPv4PortNumber = 2345; 8 | 9 | enum { 10 | PTExampleFrameTypeDeviceInfo = 100, 11 | PTExampleFrameTypeTextMessage = 101, 12 | PTExampleFrameTypePing = 102, 13 | PTExampleFrameTypePong = 103, 14 | PTExampleFrameTypeData = 104 15 | }; 16 | 17 | typedef struct _PTExampleTextFrame { 18 | uint32_t length; 19 | uint8_t utf8text[0]; 20 | } PTExampleTextFrame; 21 | 22 | 23 | static dispatch_data_t PTExampleTextDispatchDataWithString(NSString *message) { 24 | // Use a custom struct 25 | const char *utf8text = [message cStringUsingEncoding:NSUTF8StringEncoding]; 26 | size_t length = strlen(utf8text); 27 | PTExampleTextFrame *textFrame = CFAllocatorAllocate(nil, sizeof(PTExampleTextFrame) + length, 0); 28 | memcpy(textFrame->utf8text, utf8text, length); // Copy bytes to utf8text array 29 | textFrame->length = htonl(length); // Convert integer to network byte order 30 | 31 | // Wrap the textFrame in a dispatch data object 32 | return dispatch_data_create((const void*)textFrame, sizeof(PTExampleTextFrame)+length, nil, ^{ 33 | CFAllocatorDeallocate(nil, textFrame); 34 | }); 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Harmony 2 | An open-source "clone" of [Duet Display](https://www.duetdisplay.com/)... or at least thats what I want it to be. The aim of this project is to create a mirrored macOS display on your iPad which can be interacted with to create a high-end Wacom like experience. 3 | 4 | ## A Story (What Works and What Doesn't Work) 5 | This is a project that desperately needs help from engineers of all backgrounds. Right now mouse-pointer integration is complete (the easy part), however mirroring the display of the computer is not done, and perhaps will never be done. 6 | 7 | ### The Problem 8 | Fitting an uncompressed, full-sized TIFF of a Retina display down any size pipe in real-time is damn near impossible. What needs to be done is down-scaling and compression, however that is something that is best executed on the GPU, something that I do not have experience dappling in. 9 | 10 | In short, I need help. Lots of help. This project needs help. If there is anything you can contribute please do. Even if its just advice and a new direction for the project to move in. 11 | 12 | ## Contributing 13 | Any contributions are welcome. I have commented out the initialization code for the screen-mirroring technologies so that those who are just interested in the mouse-pointer capabilities may use this project to their heart's content. 14 | 15 | ## Further Reading 16 | [Inside DuetDisplay and Unattributed Open-Source](http://ich.deanmcnamee.com/re/2014/12/18/DuetDisplay.html) 17 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIRequiresFullScreen 32 | 33 | UIStatusBarHidden 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS.xcworkspace/xcuserdata/fred.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 12 | 13 | 14 | 16 | 22 | 23 | 24 | 26 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop/MouseController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MouseController.swift 3 | // Harmony Desktop 4 | // 5 | // Created by Frederick Morlock on 7/20/17. 6 | // Copyright © 2017 Frederick Morlock. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | final class MouseController { 12 | static let sharedInstanced = MouseController() 13 | private init() {} 14 | 15 | private var pos = CGPoint(x: 0, y: 0) 16 | 17 | static func moveTo(x: Int, y: Int) { 18 | sharedInstanced.pos.x = CGFloat(x) 19 | sharedInstanced.pos.y = CGFloat(y) 20 | let moveEvent = CGEvent(mouseEventSource: nil, mouseType: .mouseMoved, mouseCursorPosition: sharedInstanced.pos, mouseButton: .left) 21 | moveEvent?.post(tap: CGEventTapLocation.cghidEventTap) 22 | } 23 | 24 | static func dragTo(x: Int, y: Int) { 25 | sharedInstanced.pos.x = CGFloat(x) 26 | sharedInstanced.pos.y = CGFloat(y) 27 | let moveEvent = CGEvent(mouseEventSource: nil, mouseType: .leftMouseDragged, mouseCursorPosition: sharedInstanced.pos, mouseButton: .left) 28 | moveEvent?.post(tap: CGEventTapLocation.cghidEventTap) 29 | } 30 | 31 | static func mouseDown() { 32 | let moveEvent = CGEvent(mouseEventSource: nil, mouseType: .leftMouseDown, mouseCursorPosition: sharedInstanced.pos, mouseButton: .left) 33 | moveEvent?.post(tap: CGEventTapLocation.cghidEventTap) 34 | } 35 | 36 | static func mouseUp() { 37 | let moveEvent = CGEvent(mouseEventSource: nil, mouseType: .leftMouseUp, mouseCursorPosition: sharedInstanced.pos, mouseButton: .left) 38 | moveEvent?.post(tap: CGEventTapLocation.cghidEventTap) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/Pods-Harmony Desktop/Pods-Harmony Desktop-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## CocoaAsyncSocket 5 | 6 | Public Domain License 7 | 8 | The CocoaAsyncSocket project is in the public domain. 9 | 10 | The original TCP version (AsyncSocket) was created by Dustin Voss in January 2003. 11 | Updated and maintained by Deusty LLC and the Apple development community. 12 | 13 | 14 | ## PeerTalk 15 | 16 | Copyright (c) 2012 Rasmus Andersson 17 | 18 | Permission is hereby granted, free of charge, to any person obtaining a copy 19 | of this software and associated documentation files (the "Software"), to deal 20 | in the Software without restriction, including without limitation the rights 21 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 | copies of the Software, and to permit persons to whom the Software is 23 | furnished to do so, subject to the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be included in 26 | all copies or substantial portions of the Software. 27 | 28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 34 | THE SOFTWARE. 35 | Generated by CocoaPods - https://cocoapods.org 36 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/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 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/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 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Harmony iOS 4 | // 5 | // Created by Frederick Morlock on 7/20/17. 6 | // Copyright © 2017 Frederick Morlock. 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: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Pods.xcodeproj/xcuserdata/fred.xcuserdatad/xcschemes/PeerTalk.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Pods.xcodeproj/xcuserdata/fred.xcuserdatad/xcschemes/PeerTalk.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/NSStream+BoundPairAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Stream.h 3 | // Harmony iOS 4 | // 5 | // Created by Frederick Morlock on 6/21/19. 6 | // Copyright © 2019 Frederick Morlock. All rights reserved. 7 | // 8 | 9 | #import 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | static void CFStreamCreateBoundPairCompat( 16 | CFAllocatorRef alloc, 17 | CFReadStreamRef * readStreamPtr, 18 | CFWriteStreamRef * writeStreamPtr, 19 | CFIndex transferBufferSize 20 | ); 21 | 22 | @interface NSStream (BoundPairAdditions) 23 | + (void)createBoundInputStream:(NSInputStream **)inputStreamPtr outputStream:(NSOutputStream **)outputStreamPtr bufferSize:(NSUInteger)bufferSize; 24 | @end 25 | 26 | @implementation NSStream (BoundPairAdditions) 27 | 28 | + (void)createBoundInputStream:(NSInputStream **)inputStreamPtr outputStream:(NSOutputStream **)outputStreamPtr bufferSize:(NSUInteger)bufferSize 29 | { 30 | CFReadStreamRef readStream; 31 | CFWriteStreamRef writeStream; 32 | 33 | assert( (inputStreamPtr != NULL) || (outputStreamPtr != NULL) ); 34 | 35 | readStream = NULL; 36 | writeStream = NULL; 37 | 38 | #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (__MAC_OS_X_VERSION_MIN_REQUIRED < 1070) 39 | #error If you support Mac OS X prior to 10.7, you must re-enable CFStreamCreateBoundPairCompat. 40 | #endif 41 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < 50000) 42 | #error If you support iOS prior to 5.0, you must re-enable CFStreamCreateBoundPairCompat. 43 | #endif 44 | 45 | if (NO) { 46 | CFStreamCreateBoundPairCompat( 47 | NULL, 48 | ((inputStreamPtr != nil) ? &readStream : NULL), 49 | ((outputStreamPtr != nil) ? &writeStream : NULL), 50 | (CFIndex) bufferSize 51 | ); 52 | } else { 53 | CFStreamCreateBoundPair( 54 | NULL, 55 | ((inputStreamPtr != nil) ? &readStream : NULL), 56 | ((outputStreamPtr != nil) ? &writeStream : NULL), 57 | (CFIndex) bufferSize 58 | ); 59 | } 60 | 61 | if (inputStreamPtr != NULL) { 62 | *inputStreamPtr = CFBridgingRelease(readStream); 63 | } 64 | if (outputStreamPtr != NULL) { 65 | *outputStreamPtr = CFBridgingRelease(writeStream); 66 | } 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Pods.xcodeproj/xcuserdata/fred.xcuserdatad/xcschemes/Pods-Harmony iOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Pods.xcodeproj/xcuserdata/fred.xcuserdatad/xcschemes/Pods-Harmony Desktop.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/Pods-Harmony Desktop/Pods-Harmony Desktop-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Public Domain License 18 | 19 | The CocoaAsyncSocket project is in the public domain. 20 | 21 | The original TCP version (AsyncSocket) was created by Dustin Voss in January 2003. 22 | Updated and maintained by Deusty LLC and the Apple development community. 23 | 24 | License 25 | public domain 26 | Title 27 | CocoaAsyncSocket 28 | Type 29 | PSGroupSpecifier 30 | 31 | 32 | FooterText 33 | Copyright (c) 2012 Rasmus Andersson <http://rsms.me/> 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in 43 | all copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 51 | THE SOFTWARE. 52 | License 53 | MIT 54 | Title 55 | PeerTalk 56 | Type 57 | PSGroupSpecifier 58 | 59 | 60 | FooterText 61 | Generated by CocoaPods - https://cocoapods.org 62 | Title 63 | 64 | Type 65 | PSGroupSpecifier 66 | 67 | 68 | StringsTable 69 | Acknowledgements 70 | Title 71 | Acknowledgements 72 | 73 | 74 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/PeerTalk/peertalk/PTUSBHub.h: -------------------------------------------------------------------------------- 1 | #include 2 | #import 3 | 4 | // PTUSBDeviceDidAttachNotification 5 | // Posted when a device has been attached. Also posted for each device that is 6 | // already attached when the PTUSBHub starts listening. 7 | // 8 | // .userInfo = { 9 | // DeviceID = 3; 10 | // MessageType = Attached; 11 | // Properties = { 12 | // ConnectionSpeed = 480000000; 13 | // ConnectionType = USB; 14 | // DeviceID = 3; 15 | // LocationID = 1234567890; 16 | // ProductID = 1234; 17 | // SerialNumber = 0123456789abcdef0123456789abcdef01234567; 18 | // }; 19 | // } 20 | // 21 | FOUNDATION_EXPORT NSString * const PTUSBDeviceDidAttachNotification; 22 | 23 | // PTUSBDeviceDidDetachNotification 24 | // Posted when a device has been detached. 25 | // 26 | // .userInfo = { 27 | // DeviceID = 3; 28 | // MessageType = Detached; 29 | // } 30 | // 31 | FOUNDATION_EXPORT NSString * const PTUSBDeviceDidDetachNotification; 32 | 33 | // NSError domain 34 | FOUNDATION_EXPORT NSString * const PTUSBHubErrorDomain; 35 | 36 | // Error codes returned with NSError.code for NSError domain PTUSBHubErrorDomain 37 | typedef enum { 38 | PTUSBHubErrorBadDevice = 2, 39 | PTUSBHubErrorConnectionRefused = 3, 40 | } PTUSBHubError; 41 | 42 | @interface PTUSBHub : NSObject 43 | 44 | // Shared, implicitly opened hub. 45 | + (PTUSBHub*)sharedHub; 46 | 47 | // Connect to a TCP *port* on a device, while the actual transport is over USB. 48 | // Upon success, *error* is nil and *channel* is a duplex I/O channel. 49 | // You can retrieve the underlying file descriptor using 50 | // dispatch_io_get_descriptor(channel). The dispatch_io_t channel behaves just 51 | // like any stream type dispatch_io_t, making it possible to use the same logic 52 | // for both USB bridged connections and e.g. ethernet-based connections. 53 | // 54 | // *onStart* is called either when a connection failed, in which case the error 55 | // argument is non-nil, or when the connection was successfully established (the 56 | // error argument is nil). Must not be NULL. 57 | // 58 | // *onEnd* is called when a connection was open and just did close. If the error 59 | // argument is non-nil, the channel closed because of an error. Pass NULL for no 60 | // callback. 61 | // 62 | - (void)connectToDevice:(NSNumber*)deviceID 63 | port:(int)port 64 | onStart:(void(^)(NSError *error, dispatch_io_t channel))onStart 65 | onEnd:(void(^)(NSError *error))onEnd; 66 | 67 | // Start listening for devices. You only need to invoke this method on custom 68 | // instances to start receiving notifications. The shared instance returned from 69 | // +sharedHub is always in listening mode. 70 | // 71 | // *onStart* is called either when the system failed to start listening, in 72 | // which case the error argument is non-nil, or when the receiver is listening. 73 | // Pass NULL for no callback. 74 | // 75 | // *onEnd* is called when listening stopped. If the error argument is non-nil, 76 | // listening stopped because of an error. Pass NULL for no callback. 77 | // 78 | - (void)listenOnQueue:(dispatch_queue_t)queue 79 | onStart:(void(^)(NSError*))onStart 80 | onEnd:(void(^)(NSError*))onEnd; 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/PeerTalk/peertalk/PTUSBHub.h: -------------------------------------------------------------------------------- 1 | #include 2 | #import 3 | 4 | // PTUSBDeviceDidAttachNotification 5 | // Posted when a device has been attached. Also posted for each device that is 6 | // already attached when the PTUSBHub starts listening. 7 | // 8 | // .userInfo = { 9 | // DeviceID = 3; 10 | // MessageType = Attached; 11 | // Properties = { 12 | // ConnectionSpeed = 480000000; 13 | // ConnectionType = USB; 14 | // DeviceID = 3; 15 | // LocationID = 1234567890; 16 | // ProductID = 1234; 17 | // SerialNumber = 0123456789abcdef0123456789abcdef01234567; 18 | // }; 19 | // } 20 | // 21 | FOUNDATION_EXPORT NSString * const PTUSBDeviceDidAttachNotification; 22 | 23 | // PTUSBDeviceDidDetachNotification 24 | // Posted when a device has been detached. 25 | // 26 | // .userInfo = { 27 | // DeviceID = 3; 28 | // MessageType = Detached; 29 | // } 30 | // 31 | FOUNDATION_EXPORT NSString * const PTUSBDeviceDidDetachNotification; 32 | 33 | // NSError domain 34 | FOUNDATION_EXPORT NSString * const PTUSBHubErrorDomain; 35 | 36 | // Error codes returned with NSError.code for NSError domain PTUSBHubErrorDomain 37 | typedef enum { 38 | PTUSBHubErrorBadDevice = 2, 39 | PTUSBHubErrorConnectionRefused = 3, 40 | } PTUSBHubError; 41 | 42 | @interface PTUSBHub : NSObject 43 | 44 | // Shared, implicitly opened hub. 45 | + (PTUSBHub*)sharedHub; 46 | 47 | // Connect to a TCP *port* on a device, while the actual transport is over USB. 48 | // Upon success, *error* is nil and *channel* is a duplex I/O channel. 49 | // You can retrieve the underlying file descriptor using 50 | // dispatch_io_get_descriptor(channel). The dispatch_io_t channel behaves just 51 | // like any stream type dispatch_io_t, making it possible to use the same logic 52 | // for both USB bridged connections and e.g. ethernet-based connections. 53 | // 54 | // *onStart* is called either when a connection failed, in which case the error 55 | // argument is non-nil, or when the connection was successfully established (the 56 | // error argument is nil). Must not be NULL. 57 | // 58 | // *onEnd* is called when a connection was open and just did close. If the error 59 | // argument is non-nil, the channel closed because of an error. Pass NULL for no 60 | // callback. 61 | // 62 | - (void)connectToDevice:(NSNumber*)deviceID 63 | port:(int)port 64 | onStart:(void(^)(NSError *error, dispatch_io_t channel))onStart 65 | onEnd:(void(^)(NSError *error))onEnd; 66 | 67 | // Start listening for devices. You only need to invoke this method on custom 68 | // instances to start receiving notifications. The shared instance returned from 69 | // +sharedHub is always in listening mode. 70 | // 71 | // *onStart* is called either when the system failed to start listening, in 72 | // which case the error argument is non-nil, or when the receiver is listening. 73 | // Pass NULL for no callback. 74 | // 75 | // *onEnd* is called when listening stopped. If the error argument is non-nil, 76 | // listening stopped because of an error. Pass NULL for no callback. 77 | // 78 | - (void)listenOnQueue:(dispatch_queue_t)queue 79 | onStart:(void(^)(NSError*))onStart 80 | onEnd:(void(^)(NSError*))onEnd; 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/PeerTalk/README.md: -------------------------------------------------------------------------------- 1 | # peertalk 2 | 3 | PeerTalk is an iOS and Mac Cocoa library for communicating over USB. 4 | 5 | 6 | ┌──────────────────────────────┐ 7 | │ ┌──────────────────────────┐ │ 8 | │ │ │ │ 9 | ┌─────────┐ │ │ │ │ 10 | │┌───────┐│ │ │ Hello │ │ 11 | ││ ││ │ │ │ │ 12 | ││ Hello ││ │ │ │ │ 13 | ││ ││ │ │ │ │ 14 | │└───────┘│ │ └──────────────────────────┘ │ 15 | │ ⃝ │ \ ─────────────────────────── \ 16 | └────╦────┘ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 17 | ║ ╔══════════■ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 18 | ╚═════════╝ \ ─────────────────────────── \ 19 | - meep - └─────────────────────────────┘ 20 | - beep - 21 | 22 | 23 | #### Highlights 24 | 25 | 1. Provides you with USB device attach/detach events and attached device's info 26 | 27 | 2. Can connect to TCP services on supported attached devices (e.g. an iPhone), 28 | bridging the communication over USB transport 29 | 30 | 3. Offers a higher-level API (PTChannel and PTProtocol) for convenient 31 | implementations. 32 | 33 | 4. Tested and designed for libdispatch (aka Grand Central Dispatch). 34 | 35 | Grab the goods from [https://github.com/rsms/peertalk](https://github.com/rsms/peertalk) 36 | 37 | 38 | ### Usage in Apple App Store 39 | 40 | PeerTalk has successfully been released on both the iOS and OS X app store. 41 | 42 | A great example is [Duet Display](http://www.duetdisplay.com/) which is a fantastic piece of software allowing you to use your iDevice as an extra display for your Mac using the Lightning or 30-pin cable. 43 | 44 | Facebook's [Origami](http://facebook.github.io/origami/) uses PeerTalk for it's Origami Live iOS app (in fact, this is where PeerTalk was first used, back in 2012) 45 | 46 | This *probably* means that you can use PeerTalk for apps aiming at the App Store. 47 | 48 | ## Getting started 49 | 50 | Suck down the code and open *peertalk.xcodeproj* in Xcode 4.3 or later on OS X 10.7 or later. 51 | 52 | 1. Select the "peertalk" target and hit Cmd+U (Product → Test) and verify that the unit tests passed. 53 | 54 | 2. Select the "Peertalk Example" target and hit Cmd+R (Product → Run). You should se a less than-pretty, standard window with some text saying it's ready. That's the OS X example app you're looking at. 55 | 56 | 3. In Xcode, select the "Peertalk iOS Example" target for the iPhone Simulator, and hit Cmd+R (Product → Run). There should be some action going on now. Try sending some messages between the OS X app and the app running in the iPhone simulator. 57 | 58 | 3. Connect your iOS device (iPhone, iPod or iPad) and kill the iPhone simulator and go back to Xcode. Select the "Peertalk iOS Example" target for your connected iOS device. Hit Cmd+R (Product → Run) to build and run the sample app on your device. 59 | 60 | It _should_ work. 61 | 62 | Demo video: [http://www.youtube.com/watch?v=kQPWy8N0mBg](http://www.youtube.com/watch?v=kQPWy8N0mBg) 63 | 64 | 65 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/PeerTalk/README.md: -------------------------------------------------------------------------------- 1 | # peertalk 2 | 3 | PeerTalk is an iOS and Mac Cocoa library for communicating over USB. 4 | 5 | 6 | ┌──────────────────────────────┐ 7 | │ ┌──────────────────────────┐ │ 8 | │ │ │ │ 9 | ┌─────────┐ │ │ │ │ 10 | │┌───────┐│ │ │ Hello │ │ 11 | ││ ││ │ │ │ │ 12 | ││ Hello ││ │ │ │ │ 13 | ││ ││ │ │ │ │ 14 | │└───────┘│ │ └──────────────────────────┘ │ 15 | │ ⃝ │ \ ─────────────────────────── \ 16 | └────╦────┘ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 17 | ║ ╔══════════■ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 18 | ╚═════════╝ \ ─────────────────────────── \ 19 | - meep - └─────────────────────────────┘ 20 | - beep - 21 | 22 | 23 | #### Highlights 24 | 25 | 1. Provides you with USB device attach/detach events and attached device's info 26 | 27 | 2. Can connect to TCP services on supported attached devices (e.g. an iPhone), 28 | bridging the communication over USB transport 29 | 30 | 3. Offers a higher-level API (PTChannel and PTProtocol) for convenient 31 | implementations. 32 | 33 | 4. Tested and designed for libdispatch (aka Grand Central Dispatch). 34 | 35 | Grab the goods from [https://github.com/rsms/peertalk](https://github.com/rsms/peertalk) 36 | 37 | 38 | ### Usage in Apple App Store 39 | 40 | PeerTalk has successfully been released on both the iOS and OS X app store. 41 | 42 | A great example is [Duet Display](http://www.duetdisplay.com/) which is a fantastic piece of software allowing you to use your iDevice as an extra display for your Mac using the Lightning or 30-pin cable. 43 | 44 | Facebook's [Origami](http://facebook.github.io/origami/) uses PeerTalk for it's Origami Live iOS app (in fact, this is where PeerTalk was first used, back in 2012) 45 | 46 | This *probably* means that you can use PeerTalk for apps aiming at the App Store. 47 | 48 | ## Getting started 49 | 50 | Suck down the code and open *peertalk.xcodeproj* in Xcode 4.3 or later on OS X 10.7 or later. 51 | 52 | 1. Select the "peertalk" target and hit Cmd+U (Product → Test) and verify that the unit tests passed. 53 | 54 | 2. Select the "Peertalk Example" target and hit Cmd+R (Product → Run). You should se a less than-pretty, standard window with some text saying it's ready. That's the OS X example app you're looking at. 55 | 56 | 3. In Xcode, select the "Peertalk iOS Example" target for the iPhone Simulator, and hit Cmd+R (Product → Run). There should be some action going on now. Try sending some messages between the OS X app and the app running in the iPhone simulator. 57 | 58 | 3. Connect your iOS device (iPhone, iPod or iPad) and kill the iPhone simulator and go back to Xcode. Select the "Peertalk iOS Example" target for your connected iOS device. Hit Cmd+R (Product → Run) to build and run the sample app on your device. 59 | 60 | It _should_ work. 61 | 62 | Demo video: [http://www.youtube.com/watch?v=kQPWy8N0mBg](http://www.youtube.com/watch?v=kQPWy8N0mBg) 63 | 64 | 65 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS.xcodeproj/xcuserdata/fred.xcuserdatad/xcschemes/Harmony iOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop.xcodeproj/xcuserdata/fred.xcuserdatad/xcschemes/Harmony Desktop.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop.xcworkspace/xcuserdata/fred.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 56 | 68 | 69 | 70 | 72 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/PeerTalk/peertalk/PTProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // A universal frame-based communication protocol which can be used to exchange 3 | // arbitrary structured data. 4 | // 5 | // In short: 6 | // 7 | // - Each transmission is comprised by one fixed-size frame. 8 | // - Each frame contains a protocol version number. 9 | // - Each frame contains an application frame type. 10 | // - Each frame can contain an identifying tag. 11 | // - Each frame can have application-specific data of up to UINT32_MAX size. 12 | // - Transactions style messaging can be modeled on top using frame tags. 13 | // - Lightweight API on top of libdispatch (aka GCD) -- close to the metal. 14 | // 15 | #include 16 | #import 17 | 18 | // Special frame tag that signifies "no tag". Your implementation should never 19 | // create a reply for a frame with this tag. 20 | static const uint32_t PTFrameNoTag = 0; 21 | 22 | // Special frame type that signifies that the stream has ended. 23 | static const uint32_t PTFrameTypeEndOfStream = 0; 24 | 25 | // NSError domain 26 | FOUNDATION_EXPORT NSString * const PTProtocolErrorDomain; 27 | 28 | 29 | @interface PTProtocol : NSObject 30 | 31 | // Queue on which to run data processing blocks. 32 | @property dispatch_queue_t queue; 33 | 34 | // Get the shared protocol object for *queue* 35 | + (PTProtocol*)sharedProtocolForQueue:(dispatch_queue_t)queue; 36 | 37 | // Initialize a new protocol object to use a specific queue. 38 | - (id)initWithDispatchQueue:(dispatch_queue_t)queue; 39 | 40 | // Initialize a new protocol object to use the current calling queue. 41 | - (id)init; 42 | 43 | #pragma mark Sending frames 44 | 45 | // Generate a new tag that is unique within this protocol object. 46 | - (uint32_t)newTag; 47 | 48 | // Send a frame over *channel* with an optional payload and optional callback. 49 | // If *callback* is not NULL, the block is invoked when either an error occured 50 | // or when the frame (and payload, if any) has been completely sent. 51 | - (void)sendFrameOfType:(uint32_t)frameType 52 | tag:(uint32_t)tag 53 | withPayload:(dispatch_data_t)payload 54 | overChannel:(dispatch_io_t)channel 55 | callback:(void(^)(NSError *error))callback; 56 | 57 | #pragma mark Receiving frames 58 | 59 | // Read frames over *channel* as they arrive. 60 | // The onFrame handler is responsible for reading (or discarding) any payload 61 | // and call *resumeReadingFrames* afterwards to resume reading frames. 62 | // To stop reading frames, simply do not invoke *resumeReadingFrames*. 63 | // When the stream ends, a frame of type PTFrameTypeEndOfStream is received. 64 | - (void)readFramesOverChannel:(dispatch_io_t)channel 65 | onFrame:(void(^)(NSError *error, 66 | uint32_t type, 67 | uint32_t tag, 68 | uint32_t payloadSize, 69 | dispatch_block_t resumeReadingFrames))onFrame; 70 | 71 | // Read a single frame over *channel*. A frame of type PTFrameTypeEndOfStream 72 | // denotes the stream has ended. 73 | - (void)readFrameOverChannel:(dispatch_io_t)channel 74 | callback:(void(^)(NSError *error, 75 | uint32_t frameType, 76 | uint32_t frameTag, 77 | uint32_t payloadSize))callback; 78 | 79 | #pragma mark Receiving frame payloads 80 | 81 | // Read a complete payload. It's the callers responsibility to make sure 82 | // payloadSize is not too large since memory will be automatically allocated 83 | // where only payloadSize is the limit. 84 | // The returned dispatch_data_t object owns *buffer* and thus you need to call 85 | // dispatch_retain on *contiguousData* if you plan to keep *buffer* around after 86 | // returning from the callback. 87 | - (void)readPayloadOfSize:(size_t)payloadSize 88 | overChannel:(dispatch_io_t)channel 89 | callback:(void(^)(NSError *error, 90 | dispatch_data_t contiguousData, 91 | const uint8_t *buffer, 92 | size_t bufferSize))callback; 93 | 94 | // Discard data of *size* waiting on *channel*. *callback* can be NULL. 95 | - (void)readAndDiscardDataOfSize:(size_t)size 96 | overChannel:(dispatch_io_t)channel 97 | callback:(void(^)(NSError *error, BOOL endOfStream))callback; 98 | 99 | @end 100 | 101 | @interface NSData (PTProtocol) 102 | // Creates a new dispatch_data_t object which references the receiver and uses 103 | // the receivers bytes as its backing data. The returned dispatch_data_t object 104 | // holds a reference to the recevier. It's the callers responsibility to call 105 | // dispatch_release on the returned object when done. 106 | - (dispatch_data_t)createReferencingDispatchData; 107 | + (NSData *)dataWithContentsOfDispatchData:(dispatch_data_t)data; 108 | @end 109 | 110 | @interface NSDictionary (PTProtocol) 111 | // See description of -[NSData(PTProtocol) createReferencingDispatchData] 112 | - (dispatch_data_t)createReferencingDispatchData; 113 | 114 | // Decode *data* as a peroperty list-encoded dictionary. Returns nil on failure. 115 | + (NSDictionary*)dictionaryWithContentsOfDispatchData:(dispatch_data_t)data; 116 | @end 117 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/PeerTalk/peertalk/PTProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // A universal frame-based communication protocol which can be used to exchange 3 | // arbitrary structured data. 4 | // 5 | // In short: 6 | // 7 | // - Each transmission is comprised by one fixed-size frame. 8 | // - Each frame contains a protocol version number. 9 | // - Each frame contains an application frame type. 10 | // - Each frame can contain an identifying tag. 11 | // - Each frame can have application-specific data of up to UINT32_MAX size. 12 | // - Transactions style messaging can be modeled on top using frame tags. 13 | // - Lightweight API on top of libdispatch (aka GCD) -- close to the metal. 14 | // 15 | #include 16 | #import 17 | 18 | // Special frame tag that signifies "no tag". Your implementation should never 19 | // create a reply for a frame with this tag. 20 | static const uint32_t PTFrameNoTag = 0; 21 | 22 | // Special frame type that signifies that the stream has ended. 23 | static const uint32_t PTFrameTypeEndOfStream = 0; 24 | 25 | // NSError domain 26 | FOUNDATION_EXPORT NSString * const PTProtocolErrorDomain; 27 | 28 | 29 | @interface PTProtocol : NSObject 30 | 31 | // Queue on which to run data processing blocks. 32 | @property dispatch_queue_t queue; 33 | 34 | // Get the shared protocol object for *queue* 35 | + (PTProtocol*)sharedProtocolForQueue:(dispatch_queue_t)queue; 36 | 37 | // Initialize a new protocol object to use a specific queue. 38 | - (id)initWithDispatchQueue:(dispatch_queue_t)queue; 39 | 40 | // Initialize a new protocol object to use the current calling queue. 41 | - (id)init; 42 | 43 | #pragma mark Sending frames 44 | 45 | // Generate a new tag that is unique within this protocol object. 46 | - (uint32_t)newTag; 47 | 48 | // Send a frame over *channel* with an optional payload and optional callback. 49 | // If *callback* is not NULL, the block is invoked when either an error occured 50 | // or when the frame (and payload, if any) has been completely sent. 51 | - (void)sendFrameOfType:(uint32_t)frameType 52 | tag:(uint32_t)tag 53 | withPayload:(dispatch_data_t)payload 54 | overChannel:(dispatch_io_t)channel 55 | callback:(void(^)(NSError *error))callback; 56 | 57 | #pragma mark Receiving frames 58 | 59 | // Read frames over *channel* as they arrive. 60 | // The onFrame handler is responsible for reading (or discarding) any payload 61 | // and call *resumeReadingFrames* afterwards to resume reading frames. 62 | // To stop reading frames, simply do not invoke *resumeReadingFrames*. 63 | // When the stream ends, a frame of type PTFrameTypeEndOfStream is received. 64 | - (void)readFramesOverChannel:(dispatch_io_t)channel 65 | onFrame:(void(^)(NSError *error, 66 | uint32_t type, 67 | uint32_t tag, 68 | uint32_t payloadSize, 69 | dispatch_block_t resumeReadingFrames))onFrame; 70 | 71 | // Read a single frame over *channel*. A frame of type PTFrameTypeEndOfStream 72 | // denotes the stream has ended. 73 | - (void)readFrameOverChannel:(dispatch_io_t)channel 74 | callback:(void(^)(NSError *error, 75 | uint32_t frameType, 76 | uint32_t frameTag, 77 | uint32_t payloadSize))callback; 78 | 79 | #pragma mark Receiving frame payloads 80 | 81 | // Read a complete payload. It's the callers responsibility to make sure 82 | // payloadSize is not too large since memory will be automatically allocated 83 | // where only payloadSize is the limit. 84 | // The returned dispatch_data_t object owns *buffer* and thus you need to call 85 | // dispatch_retain on *contiguousData* if you plan to keep *buffer* around after 86 | // returning from the callback. 87 | - (void)readPayloadOfSize:(size_t)payloadSize 88 | overChannel:(dispatch_io_t)channel 89 | callback:(void(^)(NSError *error, 90 | dispatch_data_t contiguousData, 91 | const uint8_t *buffer, 92 | size_t bufferSize))callback; 93 | 94 | // Discard data of *size* waiting on *channel*. *callback* can be NULL. 95 | - (void)readAndDiscardDataOfSize:(size_t)size 96 | overChannel:(dispatch_io_t)channel 97 | callback:(void(^)(NSError *error, BOOL endOfStream))callback; 98 | 99 | @end 100 | 101 | @interface NSData (PTProtocol) 102 | // Creates a new dispatch_data_t object which references the receiver and uses 103 | // the receivers bytes as its backing data. The returned dispatch_data_t object 104 | // holds a reference to the recevier. It's the callers responsibility to call 105 | // dispatch_release on the returned object when done. 106 | - (dispatch_data_t)createReferencingDispatchData; 107 | + (NSData *)dataWithContentsOfDispatchData:(dispatch_data_t)data; 108 | @end 109 | 110 | @interface NSDictionary (PTProtocol) 111 | // See description of -[NSData(PTProtocol) createReferencingDispatchData] 112 | - (dispatch_data_t)createReferencingDispatchData; 113 | 114 | // Decode *data* as a peroperty list-encoded dictionary. Returns nil on failure. 115 | + (NSDictionary*)dictionaryWithContentsOfDispatchData:(dispatch_data_t)data; 116 | @end 117 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/PeerTalk/peertalk/PTChannel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Represents a communication channel between two endpoints talking the same 3 | // PTProtocol. 4 | // 5 | #import 6 | #import 7 | #import 8 | #import 9 | 10 | #import "PTProtocol.h" 11 | #import "PTUSBHub.h" 12 | 13 | @class PTData, PTAddress; 14 | @protocol PTChannelDelegate; 15 | 16 | @interface PTChannel : NSObject 17 | 18 | // Delegate 19 | @property (strong) id delegate; 20 | 21 | // Communication protocol. Must not be nil. 22 | @property PTProtocol *protocol; 23 | 24 | // YES if this channel is a listening server 25 | @property (readonly) BOOL isListening; 26 | 27 | // YES if this channel is a connected peer 28 | @property (readonly) BOOL isConnected; 29 | 30 | // Arbitrary attachment. Note that if you set this, the object will grow by 31 | // 8 bytes (64 bits). 32 | @property (strong) id userInfo; 33 | 34 | // Create a new channel using the shared PTProtocol for the current dispatch 35 | // queue, with *delegate*. 36 | + (PTChannel*)channelWithDelegate:(id)delegate; 37 | 38 | 39 | // Initialize a new frame channel, configuring it to use the calling queue's 40 | // protocol instance (as returned by [PTProtocol sharedProtocolForQueue: 41 | // dispatch_get_current_queue()]) 42 | - (id)init; 43 | 44 | // Initialize a new frame channel with a specific protocol. 45 | - (id)initWithProtocol:(PTProtocol*)protocol; 46 | 47 | // Initialize a new frame channel with a specific protocol and delegate. 48 | - (id)initWithProtocol:(PTProtocol*)protocol delegate:(id)delegate; 49 | 50 | 51 | // Connect to a TCP port on a device connected over USB 52 | - (void)connectToPort:(int)port overUSBHub:(PTUSBHub*)usbHub deviceID:(NSNumber*)deviceID callback:(void(^)(NSError *error))callback; 53 | 54 | // Connect to a TCP port at IPv4 address. Provided port must NOT be in network 55 | // byte order. Provided in_addr_t must NOT be in network byte order. A value returned 56 | // from inet_aton() will be in network byte order. You can use a value of inet_aton() 57 | // as the address parameter here, but you must flip the byte order before passing the 58 | // in_addr_t to this function. 59 | - (void)connectToPort:(in_port_t)port IPv4Address:(in_addr_t)address callback:(void(^)(NSError *error, PTAddress *address))callback; 60 | 61 | // Listen for connections on port and address, effectively starting a socket 62 | // server. Provided port must NOT be in network byte order. Provided in_addr_t 63 | // must NOT be in network byte order. 64 | // For this to make sense, you should provide a onAccept block handler 65 | // or a delegate implementing ioFrameChannel:didAcceptConnection:. 66 | - (void)listenOnPort:(in_port_t)port IPv4Address:(in_addr_t)address callback:(void(^)(NSError *error))callback; 67 | 68 | // Send a frame with an optional payload and optional callback. 69 | // If *callback* is not NULL, the block is invoked when either an error occured 70 | // or when the frame (and payload, if any) has been completely sent. 71 | - (void)sendFrameOfType:(uint32_t)frameType tag:(uint32_t)tag withPayload:(dispatch_data_t)payload callback:(void(^)(NSError *error))callback; 72 | 73 | // Lower-level method to assign a connected dispatch IO channel to this channel 74 | - (BOOL)startReadingFromConnectedChannel:(dispatch_io_t)channel error:(__autoreleasing NSError**)error; 75 | 76 | // Close the channel, preventing further reading and writing. Any ongoing and 77 | // queued reads and writes will be aborted. 78 | - (void)close; 79 | 80 | // "graceful" close -- any ongoing and queued reads and writes will complete 81 | // before the channel ends. 82 | - (void)cancel; 83 | 84 | @end 85 | 86 | 87 | // Wraps a mapped dispatch_data_t object. The memory pointed to by *data* is 88 | // valid until *dispatchData* is deallocated (normally when the receiver is 89 | // deallocated). 90 | @interface PTData : NSObject 91 | @property (readonly) dispatch_data_t dispatchData; 92 | @property (readonly) void *data; 93 | @property (readonly) size_t length; 94 | @end 95 | 96 | 97 | // Represents a peer's address 98 | @interface PTAddress : NSObject 99 | // For network addresses, this is the IP address in textual format 100 | @property (readonly) NSString *name; 101 | // For network addresses, this is the port number. Otherwise 0 (zero). 102 | @property (readonly) NSInteger port; 103 | @end 104 | 105 | 106 | // Protocol for PTChannel delegates 107 | @protocol PTChannelDelegate 108 | 109 | @required 110 | // Invoked when a new frame has arrived on a channel. 111 | - (void)ioFrameChannel:(PTChannel*)channel didReceiveFrameOfType:(uint32_t)type tag:(uint32_t)tag payload:(PTData*)payload; 112 | 113 | @optional 114 | // Invoked to accept an incoming frame on a channel. Reply NO ignore the 115 | // incoming frame. If not implemented by the delegate, all frames are accepted. 116 | - (BOOL)ioFrameChannel:(PTChannel*)channel shouldAcceptFrameOfType:(uint32_t)type tag:(uint32_t)tag payloadSize:(uint32_t)payloadSize; 117 | 118 | // Invoked when the channel closed. If it closed because of an error, *error* is 119 | // a non-nil NSError object. 120 | - (void)ioFrameChannel:(PTChannel*)channel didEndWithError:(NSError*)error; 121 | 122 | // For listening channels, this method is invoked when a new connection has been 123 | // accepted. 124 | - (void)ioFrameChannel:(PTChannel*)channel didAcceptConnection:(PTChannel*)otherChannel fromAddress:(PTAddress*)address; 125 | 126 | @end 127 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/PeerTalk/peertalk/PTChannel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Represents a communication channel between two endpoints talking the same 3 | // PTProtocol. 4 | // 5 | #import 6 | #import 7 | #import 8 | #import 9 | 10 | #import "PTProtocol.h" 11 | #import "PTUSBHub.h" 12 | 13 | @class PTData, PTAddress; 14 | @protocol PTChannelDelegate; 15 | 16 | @interface PTChannel : NSObject 17 | 18 | // Delegate 19 | @property (strong) id delegate; 20 | 21 | // Communication protocol. Must not be nil. 22 | @property PTProtocol *protocol; 23 | 24 | // YES if this channel is a listening server 25 | @property (readonly) BOOL isListening; 26 | 27 | // YES if this channel is a connected peer 28 | @property (readonly) BOOL isConnected; 29 | 30 | // Arbitrary attachment. Note that if you set this, the object will grow by 31 | // 8 bytes (64 bits). 32 | @property (strong) id userInfo; 33 | 34 | // Create a new channel using the shared PTProtocol for the current dispatch 35 | // queue, with *delegate*. 36 | + (PTChannel*)channelWithDelegate:(id)delegate; 37 | 38 | 39 | // Initialize a new frame channel, configuring it to use the calling queue's 40 | // protocol instance (as returned by [PTProtocol sharedProtocolForQueue: 41 | // dispatch_get_current_queue()]) 42 | - (id)init; 43 | 44 | // Initialize a new frame channel with a specific protocol. 45 | - (id)initWithProtocol:(PTProtocol*)protocol; 46 | 47 | // Initialize a new frame channel with a specific protocol and delegate. 48 | - (id)initWithProtocol:(PTProtocol*)protocol delegate:(id)delegate; 49 | 50 | 51 | // Connect to a TCP port on a device connected over USB 52 | - (void)connectToPort:(int)port overUSBHub:(PTUSBHub*)usbHub deviceID:(NSNumber*)deviceID callback:(void(^)(NSError *error))callback; 53 | 54 | // Connect to a TCP port at IPv4 address. Provided port must NOT be in network 55 | // byte order. Provided in_addr_t must NOT be in network byte order. A value returned 56 | // from inet_aton() will be in network byte order. You can use a value of inet_aton() 57 | // as the address parameter here, but you must flip the byte order before passing the 58 | // in_addr_t to this function. 59 | - (void)connectToPort:(in_port_t)port IPv4Address:(in_addr_t)address callback:(void(^)(NSError *error, PTAddress *address))callback; 60 | 61 | // Listen for connections on port and address, effectively starting a socket 62 | // server. Provided port must NOT be in network byte order. Provided in_addr_t 63 | // must NOT be in network byte order. 64 | // For this to make sense, you should provide a onAccept block handler 65 | // or a delegate implementing ioFrameChannel:didAcceptConnection:. 66 | - (void)listenOnPort:(in_port_t)port IPv4Address:(in_addr_t)address callback:(void(^)(NSError *error))callback; 67 | 68 | // Send a frame with an optional payload and optional callback. 69 | // If *callback* is not NULL, the block is invoked when either an error occured 70 | // or when the frame (and payload, if any) has been completely sent. 71 | - (void)sendFrameOfType:(uint32_t)frameType tag:(uint32_t)tag withPayload:(dispatch_data_t)payload callback:(void(^)(NSError *error))callback; 72 | 73 | // Lower-level method to assign a connected dispatch IO channel to this channel 74 | - (BOOL)startReadingFromConnectedChannel:(dispatch_io_t)channel error:(__autoreleasing NSError**)error; 75 | 76 | // Close the channel, preventing further reading and writing. Any ongoing and 77 | // queued reads and writes will be aborted. 78 | - (void)close; 79 | 80 | // "graceful" close -- any ongoing and queued reads and writes will complete 81 | // before the channel ends. 82 | - (void)cancel; 83 | 84 | @end 85 | 86 | 87 | // Wraps a mapped dispatch_data_t object. The memory pointed to by *data* is 88 | // valid until *dispatchData* is deallocated (normally when the receiver is 89 | // deallocated). 90 | @interface PTData : NSObject 91 | @property (readonly) dispatch_data_t dispatchData; 92 | @property (readonly) void *data; 93 | @property (readonly) size_t length; 94 | @end 95 | 96 | 97 | // Represents a peer's address 98 | @interface PTAddress : NSObject 99 | // For network addresses, this is the IP address in textual format 100 | @property (readonly) NSString *name; 101 | // For network addresses, this is the port number. Otherwise 0 (zero). 102 | @property (readonly) NSInteger port; 103 | @end 104 | 105 | 106 | // Protocol for PTChannel delegates 107 | @protocol PTChannelDelegate 108 | 109 | @required 110 | // Invoked when a new frame has arrived on a channel. 111 | - (void)ioFrameChannel:(PTChannel*)channel didReceiveFrameOfType:(uint32_t)type tag:(uint32_t)tag payload:(PTData*)payload; 112 | 113 | @optional 114 | // Invoked to accept an incoming frame on a channel. Reply NO ignore the 115 | // incoming frame. If not implemented by the delegate, all frames are accepted. 116 | - (BOOL)ioFrameChannel:(PTChannel*)channel shouldAcceptFrameOfType:(uint32_t)type tag:(uint32_t)tag payloadSize:(uint32_t)payloadSize; 117 | 118 | // Invoked when the channel closed. If it closed because of an error, *error* is 119 | // a non-nil NSError object. 120 | - (void)ioFrameChannel:(PTChannel*)channel didEndWithError:(NSError*)error; 121 | 122 | // For listening channels, this method is invoked when a new connection has been 123 | // accepted. 124 | - (void)ioFrameChannel:(PTChannel*)channel didAcceptConnection:(PTChannel*)otherChannel fromAddress:(PTAddress*)address; 125 | 126 | @end 127 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | 3) 22 | TARGET_DEVICE_ARGS="--target-device tv" 23 | ;; 24 | 4) 25 | TARGET_DEVICE_ARGS="--target-device watch" 26 | ;; 27 | *) 28 | TARGET_DEVICE_ARGS="--target-device mac" 29 | ;; 30 | esac 31 | 32 | install_resource() 33 | { 34 | if [[ "$1" = /* ]] ; then 35 | RESOURCE_PATH="$1" 36 | else 37 | RESOURCE_PATH="${PODS_ROOT}/$1" 38 | fi 39 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 40 | cat << EOM 41 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 42 | EOM 43 | exit 1 44 | fi 45 | case $RESOURCE_PATH in 46 | *.storyboard) 47 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 48 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 49 | ;; 50 | *.xib) 51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 53 | ;; 54 | *.framework) 55 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 57 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 58 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 59 | ;; 60 | *.xcdatamodel) 61 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 62 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 63 | ;; 64 | *.xcdatamodeld) 65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 67 | ;; 68 | *.xcmappingmodel) 69 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 70 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 71 | ;; 72 | *.xcassets) 73 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 74 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 75 | ;; 76 | *) 77 | echo "$RESOURCE_PATH" 78 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 79 | ;; 80 | esac 81 | } 82 | 83 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 84 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 85 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 86 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 87 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 88 | fi 89 | rm -f "$RESOURCES_TO_COPY" 90 | 91 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 92 | then 93 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 94 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 95 | while read line; do 96 | if [[ $line != "${PODS_ROOT}*" ]]; then 97 | XCASSET_FILES+=("$line") 98 | fi 99 | done <<<"$OTHER_XCASSETS" 100 | 101 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 102 | fi 103 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | if [ -r "$source" ]; then 88 | # Copy the dSYM into a the targets temp dir. 89 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 90 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 91 | 92 | local basename 93 | basename="$(basename -s .framework.dSYM "$source")" 94 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 95 | 96 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 97 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 98 | strip_invalid_archs "$binary" 99 | fi 100 | 101 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 102 | # Move the stripped file into its final destination. 103 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 104 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 105 | else 106 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 107 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 108 | fi 109 | fi 110 | } 111 | 112 | # Copies the bcsymbolmap files of a vendored framework 113 | install_bcsymbolmap() { 114 | local bcsymbolmap_path="$1" 115 | local destination="${BUILT_PRODUCTS_DIR}" 116 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 117 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 118 | } 119 | 120 | # Signs a framework with the provided identity 121 | code_sign_if_enabled() { 122 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 123 | # Use the current code_sign_identity 124 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 125 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 126 | 127 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 128 | code_sign_cmd="$code_sign_cmd &" 129 | fi 130 | echo "$code_sign_cmd" 131 | eval "$code_sign_cmd" 132 | fi 133 | } 134 | 135 | # Strip invalid architectures 136 | strip_invalid_archs() { 137 | binary="$1" 138 | # Get architectures for current target binary 139 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 140 | # Intersect them with the architectures we are building for 141 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 142 | # If there are no archs supported by this binary then warn the user 143 | if [[ -z "$intersected_archs" ]]; then 144 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 145 | STRIP_BINARY_RETVAL=0 146 | return 147 | fi 148 | stripped="" 149 | for arch in $binary_archs; do 150 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 151 | # Strip non-valid architectures in-place 152 | lipo -remove "$arch" -output "$binary" "$binary" 153 | stripped="$stripped $arch" 154 | fi 155 | done 156 | if [[ "$stripped" ]]; then 157 | echo "Stripped $binary of architectures:$stripped" 158 | fi 159 | STRIP_BINARY_RETVAL=1 160 | } 161 | 162 | 163 | if [[ "$CONFIGURATION" == "Debug" ]]; then 164 | install_framework "${BUILT_PRODUCTS_DIR}/PeerTalk/PeerTalk.framework" 165 | fi 166 | if [[ "$CONFIGURATION" == "Release" ]]; then 167 | install_framework "${BUILT_PRODUCTS_DIR}/PeerTalk/PeerTalk.framework" 168 | fi 169 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 170 | wait 171 | fi 172 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/Target Support Files/Pods-Harmony Desktop/Pods-Harmony Desktop-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | if [ -r "$source" ]; then 88 | # Copy the dSYM into a the targets temp dir. 89 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 90 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 91 | 92 | local basename 93 | basename="$(basename -s .framework.dSYM "$source")" 94 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 95 | 96 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 97 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 98 | strip_invalid_archs "$binary" 99 | fi 100 | 101 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 102 | # Move the stripped file into its final destination. 103 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 104 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 105 | else 106 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 107 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 108 | fi 109 | fi 110 | } 111 | 112 | # Copies the bcsymbolmap files of a vendored framework 113 | install_bcsymbolmap() { 114 | local bcsymbolmap_path="$1" 115 | local destination="${BUILT_PRODUCTS_DIR}" 116 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 117 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 118 | } 119 | 120 | # Signs a framework with the provided identity 121 | code_sign_if_enabled() { 122 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 123 | # Use the current code_sign_identity 124 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 125 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 126 | 127 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 128 | code_sign_cmd="$code_sign_cmd &" 129 | fi 130 | echo "$code_sign_cmd" 131 | eval "$code_sign_cmd" 132 | fi 133 | } 134 | 135 | # Strip invalid architectures 136 | strip_invalid_archs() { 137 | binary="$1" 138 | # Get architectures for current target binary 139 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 140 | # Intersect them with the architectures we are building for 141 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 142 | # If there are no archs supported by this binary then warn the user 143 | if [[ -z "$intersected_archs" ]]; then 144 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 145 | STRIP_BINARY_RETVAL=0 146 | return 147 | fi 148 | stripped="" 149 | for arch in $binary_archs; do 150 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 151 | # Strip non-valid architectures in-place 152 | lipo -remove "$arch" -output "$binary" "$binary" 153 | stripped="$stripped $arch" 154 | fi 155 | done 156 | if [[ "$stripped" ]]; then 157 | echo "Stripped $binary of architectures:$stripped" 158 | fi 159 | STRIP_BINARY_RETVAL=1 160 | } 161 | 162 | 163 | if [[ "$CONFIGURATION" == "Debug" ]]; then 164 | install_framework "${BUILT_PRODUCTS_DIR}/CocoaAsyncSocket/CocoaAsyncSocket.framework" 165 | install_framework "${BUILT_PRODUCTS_DIR}/PeerTalk/PeerTalk.framework" 166 | fi 167 | if [[ "$CONFIGURATION" == "Release" ]]; then 168 | install_framework "${BUILT_PRODUCTS_DIR}/CocoaAsyncSocket/CocoaAsyncSocket.framework" 169 | install_framework "${BUILT_PRODUCTS_DIR}/PeerTalk/PeerTalk.framework" 170 | fi 171 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 172 | wait 173 | fi 174 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Duet 4 | // 5 | // Created by Frederick Morlock on 7/19/17. 6 | // Copyright © 2017 Frederick Morlock. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PeerTalk.PTChannel 11 | 12 | class ViewController: UIViewController { 13 | 14 | @IBOutlet var movieView: UIView! 15 | weak var serverChannel_: PTChannel? 16 | weak var peerChannel_: PTChannel? 17 | 18 | struct Streams { 19 | let input: InputStream 20 | let output: OutputStream 21 | } 22 | 23 | var boundStreams: Streams? 24 | var canWrite = false 25 | 26 | var mediaPlayer = VLCMediaPlayer() 27 | 28 | override func viewDidLoad() { 29 | super.viewDidLoad() 30 | // Do any additional setup after loading the view, typically from a nib. 31 | 32 | let channel = PTChannel.init(delegate: self) 33 | channel?.listen(onPort: in_port_t(PTExampleProtocolIPv4PortNumber), iPv4Address: INADDR_LOOPBACK, callback: {(error: Error?) -> Void in 34 | if (error) != nil { 35 | print("Failed to listen on 127.0.0.1:" + String(PTExampleProtocolIPv4PortNumber)) 36 | print("Error: " + String(describing: error)) 37 | } else { 38 | print("Listening on 127.0.0.1:" + String(PTExampleProtocolIPv4PortNumber)) 39 | self.serverChannel_ = channel 40 | } 41 | }) 42 | 43 | var inputOrNil: InputStream? = nil 44 | var outputOrNil: OutputStream? = nil 45 | Stream.getBoundStreams(withBufferSize: 8096, 46 | inputStream: &inputOrNil, 47 | outputStream: &outputOrNil) 48 | guard let input = inputOrNil, let output = outputOrNil else { 49 | fatalError("On return of `getBoundStreams`, both `inputStream` and `outputStream` will contain non-nil streams.") 50 | } 51 | // configure and open output stream 52 | 53 | output.schedule(in: .current, forMode: .default) 54 | output.open() 55 | boundStreams = Streams(input: input, output: output) 56 | 57 | 58 | let media = VLCMedia(stream: boundStreams!.input) 59 | mediaPlayer.media = media 60 | mediaPlayer.drawable = movieView 61 | mediaPlayer.play() 62 | } 63 | 64 | override func didReceiveMemoryWarning() { 65 | super.didReceiveMemoryWarning() 66 | // Dispose of any resources that can be recreated. 67 | if ((serverChannel_) != nil) { 68 | serverChannel_?.close() 69 | } 70 | } 71 | 72 | override var prefersStatusBarHidden: Bool { 73 | return true 74 | } 75 | 76 | override func touchesBegan(_ touches: Set, with event: UIEvent?) { 77 | let aTouch = touches.first 78 | let point = aTouch!.location(in: self.view) 79 | let message: String = "d," + String(describing: point.x) + "," + String(describing: point.y) 80 | let payload: DispatchData = PTExampleTextDispatchDataWithString(message) as DispatchData 81 | 82 | peerChannel_?.sendFrame(ofType: UInt32(PTExampleFrameTypeTextMessage), tag: PTFrameNoTag, withPayload: payload as __DispatchData, callback: {(_ error: Error?) -> Void in 83 | if error != nil { 84 | print("Failed to send message: \(error)") 85 | } 86 | }) 87 | print(point) 88 | } 89 | 90 | override func touchesMoved(_ touches: Set, with event: UIEvent?) { 91 | let aTouch = touches.first 92 | let point = aTouch!.location(in: self.view) 93 | let message: String = "m," + String(describing: point.x) + "," + String(describing: point.y) 94 | let payload: DispatchData = PTExampleTextDispatchDataWithString(message) as DispatchData 95 | 96 | peerChannel_?.sendFrame(ofType: UInt32(PTExampleFrameTypeTextMessage), tag: PTFrameNoTag, withPayload: payload as __DispatchData, callback: {(_ error: Error?) -> Void in 97 | if error != nil { 98 | print("Failed to send message: \(error)") 99 | } 100 | }) 101 | print(point) 102 | } 103 | 104 | override func touchesEnded(_ touches: Set, with event: UIEvent?) { 105 | let aTouch = touches.first 106 | let point = aTouch!.location(in: self.view) 107 | let message: String = "u," + String(describing: point.x) + "," + String(describing: point.y) 108 | let payload: DispatchData = PTExampleTextDispatchDataWithString(message) as DispatchData 109 | 110 | peerChannel_?.sendFrame(ofType: UInt32(PTExampleFrameTypeTextMessage), tag: PTFrameNoTag, withPayload: payload as __DispatchData, callback: {(_ error: Error?) -> Void in 111 | if error != nil { 112 | print("Failed to send message: \(error)") 113 | } 114 | }) 115 | print(point) 116 | // point.x and point.y have the coordinates of the touch 117 | } 118 | 119 | // MARK: Communicating 120 | func sendDeviceInfo() { 121 | if (peerChannel_ == nil) { 122 | return 123 | } 124 | 125 | print("Sending device info") 126 | 127 | // TODO 128 | let screenSize = UIScreen.main.bounds 129 | let dimString = String(describing: screenSize.width) + "x" + String(describing: screenSize.height) 130 | let payload: DispatchData = PTExampleTextDispatchDataWithString(dimString) as DispatchData 131 | 132 | peerChannel_?.sendFrame(ofType: UInt32(PTExampleFrameTypeDeviceInfo), tag: PTFrameNoTag, withPayload: payload as __DispatchData, callback: {(_ error: Error?) -> Void in 133 | if error != nil { 134 | print("Failed to send message: \(error)") 135 | } 136 | }) 137 | } 138 | 139 | 140 | } 141 | // MARK: PTChannelDelegate 142 | extension ViewController: PTChannelDelegate { 143 | func ioFrameChannel(_ channel: PTChannel, shouldAcceptFrameOfType type: UInt32, tag: UInt32, payloadSize: UInt32) -> Bool { 144 | if channel != peerChannel_ { 145 | // A previous channel that has been canceled but not yet ended. Ignore. 146 | return false 147 | } else if type != UInt32(PTExampleFrameTypeTextMessage) && type != UInt32(PTExampleFrameTypePing) && type != UInt32(PTExampleFrameTypeData) { 148 | print("Unexpected frame of type \(type)") 149 | channel.close() 150 | return false 151 | } 152 | return true 153 | } 154 | 155 | func ioFrameChannel(_ channel: PTChannel, didReceiveFrameOfType type: UInt32, tag: UInt32, payload: PTData!) { 156 | /* if (type == PTExampleFrameTypeTextMessage) { 157 | PTExampleTextFrame *textFrame = (PTExampleTextFrame*)payload.data; 158 | textFrame->length = ntohl(textFrame->length); 159 | NSString *message = [[NSString alloc] initWithBytes:textFrame->utf8text length:textFrame->length encoding:NSUTF8StringEncoding]; 160 | [self appendOutputMessage:[NSString stringWithFormat:@"[%@]: %@", channel.userInfo, message]]; 161 | } else if (type == PTExampleFrameTypePing && peerChannel_) { 162 | [peerChannel_ sendFrameOfType:PTExampleFrameTypePong tag:tag withPayload:nil callback:nil]; 163 | } 164 | */ 165 | if type == UInt32(PTExampleFrameTypeTextMessage) { 166 | let textFrame = PayloadConverter().convert(toString: payload); 167 | print(textFrame) 168 | } else if type == UInt32(PTExampleFrameTypeData) { 169 | if ((boundStreams?.output.hasSpaceAvailable)!) { 170 | let data = NSData.init(bytes: payload.data, length: payload.length) 171 | boundStreams?.output.write([UInt8](data), maxLength: payload.length) 172 | } 173 | } else if type == UInt32(PTExampleFrameTypePing) && (peerChannel_ != nil) { 174 | peerChannel_?.sendFrame(ofType: UInt32(PTExampleFrameTypePong), tag: tag, withPayload: nil, callback: nil) 175 | } 176 | } 177 | 178 | func ioFrameChannel(_ channel: PTChannel, didEndWithError error: NSError) { 179 | if (error != nil) { 180 | print("Ended with error " + String(describing: error)) 181 | } else { 182 | print("Disconnect from ") 183 | } 184 | } 185 | 186 | func ioFrameChannel(_ channel: PTChannel, didAcceptConnection otherChannel: PTChannel, from address: PTAddress) { 187 | if ((peerChannel_) != nil) { 188 | peerChannel_?.cancel() 189 | } 190 | 191 | peerChannel_ = otherChannel 192 | peerChannel_?.userInfo = address 193 | 194 | print("Connected to new user") 195 | 196 | self.sendDeviceInfo() 197 | } 198 | 199 | 200 | } 201 | 202 | -------------------------------------------------------------------------------- /Harmony Desktop/Harmony Desktop/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Harmony Desktop 4 | // 5 | // Created by Frederick Morlock on 7/20/17. 6 | // Copyright © 2017 Frederick Morlock. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import PeerTalk 11 | import AVFoundation 12 | import CocoaAsyncSocket 13 | 14 | class ViewController: NSViewController, GCDAsyncUdpSocketDelegate { 15 | 16 | @IBOutlet weak var imageView: NSImageView! 17 | private(set) var connectedDeviceID: NSNumber? 18 | private let PTAppReconnectDelay: TimeInterval = 1.0 19 | var connectingToDeviceID_: NSNumber? 20 | var connectedDeviceID_: NSNumber? 21 | var connectedDeviceProperties_ = [AnyHashable: Any]() 22 | var remoteDeviceInfo_ = [AnyHashable: Any]() 23 | var notConnectedQueue_ = DispatchQueue(label: "PTExample.notConnectedQueue") 24 | var notConnectedQueueSuspended_: Bool = false 25 | var connectedChannel_: PTChannel? 26 | var consoleTextAttributes_ = [AnyHashable: Any]() 27 | var consoleStatusTextAttributes_ = [AnyHashable: Any]() 28 | var pings_ = [AnyHashable: Any]() 29 | var scaleX = Float() 30 | var scaleY = Float() 31 | 32 | var udpSocket: GCDAsyncUdpSocket? 33 | 34 | override func viewDidLoad() { 35 | super.viewDidLoad() 36 | 37 | self.startListeningForDevices() 38 | self.enqueueConnectToLocalIPv4Port() 39 | self.ping() 40 | 41 | 42 | udpSocket = GCDAsyncUdpSocket(delegate: self, delegateQueue: DispatchQueue.main) 43 | try! udpSocket?.bind(toPort: 4000) 44 | try! udpSocket?.enableBroadcast(true) 45 | try! udpSocket?.beginReceiving() 46 | 47 | 48 | // Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(transmit), userInfo: nil, repeats: true) 49 | 50 | // Do any additional setup after loading the view. 51 | } 52 | 53 | override var representedObject: Any? { 54 | didSet { 55 | // Update the view, if already loaded. 56 | } 57 | } 58 | 59 | func udpSocket(_ sock: GCDAsyncUdpSocket, didReceive data: Data, fromAddress address: Data, withFilterContext filterContext: Any?) { 60 | sendImage(data: data) 61 | } 62 | 63 | func sendImage(data: Data) { 64 | if ((connectedChannel_) != nil) { 65 | let dataLoad = data as NSData 66 | let payload = dataLoad.createReferencingDispatchData() 67 | connectedChannel_?.sendFrame(ofType: UInt32(PTExampleFrameTypeData), tag: PTFrameNoTag, withPayload: payload, callback: {(_ error: Error?) -> Void in 68 | if error != nil { 69 | print("Failed to send message: \(error!)") 70 | } 71 | }) 72 | } 73 | } 74 | 75 | @objc func transmit() { 76 | } 77 | 78 | func interpretMessage(message: String) { 79 | let splitString = message.components(separatedBy: ",") 80 | 81 | if (splitString[0] == "d") { 82 | MouseController.moveTo(x: Int(Float(splitString[1])! * scaleX), y: Int(Float(splitString[2])! * scaleY)) 83 | MouseController.mouseDown() 84 | } else if (splitString[0] == "m") { 85 | MouseController.dragTo(x: Int(Float(splitString[1])! * scaleX), y: Int(Float(splitString[2])! * scaleY)) 86 | } else if (splitString[0] == "u") { 87 | MouseController.dragTo(x: Int(Float(splitString[1])! * scaleX), y: Int(Float(splitString[2])! * scaleY)) 88 | MouseController.mouseUp() 89 | } 90 | 91 | } 92 | 93 | func setScale(message: String) { 94 | let splitString = message.components(separatedBy: "x") 95 | let x = Float(splitString[0])! 96 | let y = Float(splitString[1])! 97 | 98 | let screenSize = NSScreen.main?.frame; 99 | scaleX = Float(screenSize!.width) / x 100 | scaleY = Float(screenSize!.height) / y 101 | 102 | } 103 | 104 | func setConnectedChannel(connectedChannel: PTChannel?) { 105 | connectedChannel_ = connectedChannel 106 | 107 | if (connectedChannel_ == nil && notConnectedQueueSuspended_) { 108 | notConnectedQueue_.resume() 109 | notConnectedQueueSuspended_ = false; 110 | } else if (connectedChannel_ != nil && !notConnectedQueueSuspended_) { 111 | notConnectedQueue_.suspend() 112 | notConnectedQueueSuspended_ = true; 113 | } 114 | 115 | if (connectedChannel_ == nil && (connectingToDeviceID_ != nil)) { 116 | self.enqueueConnectToUSBDevice() 117 | } 118 | } 119 | 120 | // MARK: Ping 121 | 122 | func pong(withTag tagno: UInt32, error: Error?) { 123 | let tag = Int(tagno) 124 | var pingInfo = pings_[tag] as? [AnyHashable: Any] ?? [AnyHashable: Any]() 125 | if ((pingInfo) != nil) { 126 | let now = Date() 127 | pingInfo["date ended"] = now 128 | pings_.removeValue(forKey: tag) 129 | print(String(format: "Ping total roundtrip time: %.3f ms", now.timeIntervalSince(pingInfo["date created"] as! Date) * 1000.0)) 130 | } 131 | } 132 | 133 | @objc func ping() { 134 | if connectedChannel_ != nil { 135 | 136 | if !pings_.isEmpty { 137 | pings_ = [AnyHashable: Any]() 138 | } 139 | 140 | let tagno = connectedChannel_?.protocol.newTag() 141 | let tag = Int(tagno!) 142 | var pingInfo: [AnyHashable: Any] = [ 143 | "date created" : Date() 144 | ] 145 | 146 | pings_[tag] = pingInfo 147 | connectedChannel_!.sendFrame(ofType: UInt32(PTExampleFrameTypePing), tag: tagno!, withPayload: nil, callback: {(_ error: Error?) -> Void in 148 | self.perform(#selector(self.ping), with: nil, afterDelay: 1.0) 149 | pingInfo["date sent"] = Date() 150 | if error != nil { 151 | self.pings_.removeValue(forKey: tag) 152 | } 153 | }) 154 | } else { 155 | perform(#selector(self.ping), with: nil, afterDelay: 1.0) 156 | } 157 | } 158 | 159 | // MARK: Wired device connections 160 | 161 | func startListeningForDevices() { 162 | let nc = NotificationCenter.default 163 | 164 | nc.addObserver(forName: NSNotification.Name.PTUSBDeviceDidAttach, object: PTUSBHub.shared(), queue: nil, using: {(_ note: Notification) -> Void in 165 | let deviceID = note.userInfo?["DeviceID"] 166 | print("PTUSBDeviceDidAttachNotification: \(deviceID)") 167 | 168 | self.notConnectedQueue_.async(execute: {() -> Void in 169 | if !(self.connectingToDeviceID_ != nil) || !(deviceID as! NSNumber == self.connectingToDeviceID_) { 170 | self.disconnectFromCurrentChannel() 171 | self.connectingToDeviceID_ = deviceID as! NSNumber 172 | self.connectedDeviceProperties_ = note.userInfo?["Properties"] as! [AnyHashable : Any] 173 | self.enqueueConnectToUSBDevice() 174 | } 175 | }) 176 | }) 177 | 178 | nc.addObserver(forName: NSNotification.Name.PTUSBDeviceDidDetach, object: PTUSBHub.shared(), queue: nil) { (_ note: Notification) -> Void in 179 | let deviceID = note.userInfo?["DeviceID"] 180 | print("PTUSBDeviceDidDetachNotification: \(deviceID)") 181 | if (self.connectingToDeviceID_ == deviceID as? NSNumber) { 182 | self.connectedDeviceProperties_ = [AnyHashable: Any]() 183 | self.connectingToDeviceID_ = nil 184 | if (self.connectedChannel_ != nil) { 185 | self.connectedChannel_?.close() 186 | } 187 | } 188 | } 189 | } 190 | 191 | func didDisconnect(fromDevice deviceID: NSNumber) { 192 | print("Disconnected from device") 193 | if (connectedDeviceID_ == deviceID) { 194 | willChangeValue(forKey: "connectedDeviceID") 195 | connectedDeviceID_ = nil 196 | didChangeValue(forKey: "connectedDeviceID") 197 | } 198 | } 199 | 200 | func disconnectFromCurrentChannel() { 201 | if (connectedDeviceID_ != nil) && (connectedChannel_ != nil) { 202 | connectedChannel_?.close() 203 | setConnectedChannel(connectedChannel: nil) 204 | } 205 | } 206 | 207 | @objc func enqueueConnectToLocalIPv4Port() { 208 | notConnectedQueue_.async(execute: {() -> Void in 209 | DispatchQueue.main.async(execute: {() -> Void in 210 | self.connectToLocalIPv4Port() 211 | }) 212 | }) 213 | } 214 | 215 | func connectToLocalIPv4Port() { 216 | var channel = PTChannel.init(delegate: self) 217 | channel?.userInfo = "127.0.0.1:\(PTExampleProtocolIPv4PortNumber)" 218 | channel?.connect(toPort: in_port_t(PTExampleProtocolIPv4PortNumber), iPv4Address: INADDR_LOOPBACK, callback: {(_ error: Error?, _ address: PTAddress?) -> Void in 219 | 220 | let cerror = (error as? NSError) 221 | if error != nil { 222 | if cerror?.domain == NSPOSIXErrorDomain && (cerror?.code == Int(ECONNREFUSED) || cerror?.code == Int(ETIMEDOUT)) { 223 | // this is an expected state 224 | } else { 225 | print("Failed to connect to 127.0.0.1:\(PTExampleProtocolIPv4PortNumber): \(error)") 226 | } 227 | } else { 228 | self.disconnectFromCurrentChannel() 229 | self.setConnectedChannel(connectedChannel: channel) 230 | channel?.userInfo = address 231 | print("Connected to \(address)") 232 | } 233 | self.perform(#selector(self.enqueueConnectToLocalIPv4Port), with: nil, afterDelay: self.PTAppReconnectDelay) 234 | }) 235 | } 236 | 237 | @objc func enqueueConnectToUSBDevice() { 238 | notConnectedQueue_.async(execute: {() -> Void in 239 | DispatchQueue.main.async(execute: {() -> Void in 240 | self.connectToUSBDevice() 241 | }) 242 | }) 243 | } 244 | 245 | func connectToUSBDevice() { 246 | var channel = PTChannel.init(delegate: self) 247 | channel?.userInfo = connectingToDeviceID_ 248 | channel?.delegate = self 249 | 250 | channel?.connect(toPort: PTExampleProtocolIPv4PortNumber, overUSBHub: PTUSBHub.shared(), deviceID: connectingToDeviceID_, callback: {(_ error: Error?) -> Void in 251 | let cerror = (error as? NSError) 252 | if error != nil { 253 | if cerror?.domain == PTUSBHubErrorDomain && PTUSBHubError(UInt32((cerror?.code)!)) == PTUSBHubErrorConnectionRefused { 254 | print("Failed to connect to device #\(channel?.userInfo): \(error)") 255 | } else { 256 | print("Failed to connect to device #\(channel?.userInfo): \(error)") 257 | } 258 | if channel?.userInfo as? NSNumber == self.connectingToDeviceID_ { 259 | self.perform(#selector(self.enqueueConnectToUSBDevice), with: nil, afterDelay: self.PTAppReconnectDelay) 260 | } 261 | } 262 | else { 263 | self.connectedDeviceID_ = self.connectingToDeviceID_ 264 | self.setConnectedChannel(connectedChannel: channel) 265 | //NSLog(@"Connected to device #%@\n%@", connectingToDeviceID_, connectedDeviceProperties_); 266 | //infoTextField_.stringValue = [NSString stringWithFormat:@"Connected to device #%@\n%@", deviceID, connectedDeviceProperties_]; 267 | } 268 | }) 269 | } 270 | 271 | } 272 | 273 | extension ViewController: PTChannelDelegate { 274 | func ioFrameChannel(_ channel: PTChannel, shouldAcceptFrameOfType type: UInt32, tag: UInt32, payloadSize: UInt32) -> Bool { 275 | if type != UInt32(PTExampleFrameTypeDeviceInfo) 276 | && type != UInt32(PTExampleFrameTypeTextMessage) 277 | && type != UInt32(PTExampleFrameTypePing) 278 | && type != UInt32(PTExampleFrameTypePong) 279 | && type != UInt32(PTFrameTypeEndOfStream) { 280 | print("Unexpected frame of type " + String(type)) 281 | channel.close(); 282 | return false; 283 | } else { 284 | return true; 285 | } 286 | } 287 | 288 | func ioFrameChannel(_ channel: PTChannel, didReceiveFrameOfType type: UInt32, tag: UInt32, payload: PTData!) { 289 | if (type == UInt32(PTExampleFrameTypeDeviceInfo)) { 290 | let textFrame = PayloadConverter().convert(toString: payload) 291 | setScale(message: textFrame!) 292 | print(">> Recieved coordinates: " + textFrame!) 293 | } else if (type == UInt32(PTExampleFrameTypeTextMessage)) { 294 | let textFrame = PayloadConverter().convert(toString: payload) 295 | interpretMessage(message: textFrame!) 296 | } else if (type == UInt32(PTExampleFrameTypePong)) { 297 | self.pong(withTag: tag, error: nil) 298 | } 299 | } 300 | 301 | func ioFrameChannel(_ channel: PTChannel, didEndWithError error: NSError) { 302 | if ((connectedDeviceID_ != nil) && (connectedDeviceID_ == channel.userInfo as! NSNumber)) { 303 | self.didDisconnect(fromDevice: connectedDeviceID_!) 304 | } 305 | 306 | if connectedChannel_ == channel { 307 | print("Disconnected from \(channel.userInfo)") 308 | setConnectedChannel(connectedChannel: nil) 309 | } 310 | } 311 | } 312 | -------------------------------------------------------------------------------- /Harmony iOS/Pods/PeerTalk/peertalk/PTProtocol.m: -------------------------------------------------------------------------------- 1 | #import "PTProtocol.h" 2 | #import "PTPrivate.h" 3 | #import 4 | 5 | static const uint32_t PTProtocolVersion1 = 1; 6 | 7 | NSString * const PTProtocolErrorDomain = @"PTProtocolError"; 8 | 9 | // This is what we send as the header for each frame. 10 | typedef struct _PTFrame { 11 | // The version of the frame and protocol. 12 | uint32_t version; 13 | 14 | // Type of frame 15 | uint32_t type; 16 | 17 | // Unless zero, a tag is retained in frames that are responses to previous 18 | // frames. Applications can use this to build transactions or request-response 19 | // logic. 20 | uint32_t tag; 21 | 22 | // If payloadSize is larger than zero, *payloadSize* number of bytes are 23 | // following, constituting application-specific data. 24 | uint32_t payloadSize; 25 | 26 | } PTFrame; 27 | 28 | 29 | @interface PTProtocol () { 30 | uint32_t nextFrameTag_; 31 | @public 32 | dispatch_queue_t queue_; 33 | } 34 | - (dispatch_data_t)createDispatchDataWithFrameOfType:(uint32_t)type frameTag:(uint32_t)frameTag payload:(dispatch_data_t)payload; 35 | @end 36 | 37 | 38 | static void _release_queue_local_protocol(void *objcobj) { 39 | if (objcobj) { 40 | PTProtocol *protocol = (__bridge_transfer id)objcobj; 41 | protocol->queue_ = NULL; 42 | } 43 | } 44 | 45 | 46 | @interface RQueueLocalIOFrameProtocol : PTProtocol 47 | @end 48 | @implementation RQueueLocalIOFrameProtocol 49 | - (void)setQueue:(dispatch_queue_t)queue { 50 | } 51 | @end 52 | 53 | 54 | @implementation PTProtocol 55 | 56 | 57 | + (PTProtocol*)sharedProtocolForQueue:(dispatch_queue_t)queue { 58 | static const char currentQueueFrameProtocolKey; 59 | //dispatch_queue_t queue = dispatch_get_current_queue(); 60 | PTProtocol *currentQueueFrameProtocol = (__bridge PTProtocol*)dispatch_queue_get_specific(queue, ¤tQueueFrameProtocolKey); 61 | if (!currentQueueFrameProtocol) { 62 | currentQueueFrameProtocol = [[RQueueLocalIOFrameProtocol alloc] initWithDispatchQueue:NULL]; 63 | currentQueueFrameProtocol->queue_ = queue; // reference, no retain, since we would create cyclic references 64 | dispatch_queue_set_specific(queue, ¤tQueueFrameProtocolKey, (__bridge_retained void*)currentQueueFrameProtocol, &_release_queue_local_protocol); 65 | return (__bridge PTProtocol*)dispatch_queue_get_specific(queue, ¤tQueueFrameProtocolKey); // to avoid race conds 66 | } else { 67 | return currentQueueFrameProtocol; 68 | } 69 | } 70 | 71 | 72 | - (id)initWithDispatchQueue:(dispatch_queue_t)queue { 73 | if (!(self = [super init])) return nil; 74 | queue_ = queue; 75 | #if PT_DISPATCH_RETAIN_RELEASE 76 | if (queue_) dispatch_retain(queue_); 77 | #endif 78 | return self; 79 | } 80 | 81 | - (id)init { 82 | return [self initWithDispatchQueue:dispatch_get_main_queue()]; 83 | } 84 | 85 | - (void)dealloc { 86 | if (queue_) { 87 | #if PT_DISPATCH_RETAIN_RELEASE 88 | dispatch_release(queue_); 89 | #endif 90 | } 91 | } 92 | 93 | - (dispatch_queue_t)queue { 94 | return queue_; 95 | } 96 | 97 | - (void)setQueue:(dispatch_queue_t)queue { 98 | #if PT_DISPATCH_RETAIN_RELEASE 99 | dispatch_queue_t prev_queue = queue_; 100 | queue_ = queue; 101 | if (queue_) dispatch_retain(queue_); 102 | if (prev_queue) dispatch_release(prev_queue); 103 | #else 104 | queue_ = queue; 105 | #endif 106 | } 107 | 108 | 109 | - (uint32_t)newTag { 110 | return ++nextFrameTag_; 111 | } 112 | 113 | 114 | #pragma mark - 115 | #pragma mark Creating frames 116 | 117 | 118 | - (dispatch_data_t)createDispatchDataWithFrameOfType:(uint32_t)type frameTag:(uint32_t)frameTag payload:(dispatch_data_t)payload { 119 | PTFrame *frame = CFAllocatorAllocate(kCFAllocatorDefault, sizeof(PTFrame), 0); 120 | frame->version = htonl(PTProtocolVersion1); 121 | frame->type = htonl(type); 122 | frame->tag = htonl(frameTag); 123 | 124 | if (payload) { 125 | size_t payloadSize = dispatch_data_get_size(payload); 126 | assert(payloadSize <= UINT32_MAX); 127 | frame->payloadSize = htonl((uint32_t)payloadSize); 128 | } else { 129 | frame->payloadSize = 0; 130 | } 131 | 132 | dispatch_data_t frameData = dispatch_data_create((const void*)frame, sizeof(PTFrame), queue_, ^{ 133 | CFAllocatorDeallocate(kCFAllocatorDefault, (void*)frame); 134 | }); 135 | 136 | if (payload && frame->payloadSize != 0) { 137 | // chain frame + payload 138 | dispatch_data_t data = dispatch_data_create_concat(frameData, payload); 139 | #if PT_DISPATCH_RETAIN_RELEASE 140 | dispatch_release(frameData); 141 | #endif 142 | frameData = data; 143 | } 144 | 145 | return frameData; 146 | } 147 | 148 | 149 | #pragma mark - 150 | #pragma mark Sending frames 151 | 152 | 153 | - (void)sendFrameOfType:(uint32_t)frameType tag:(uint32_t)tag withPayload:(dispatch_data_t)payload overChannel:(dispatch_io_t)channel callback:(void(^)(NSError*))callback { 154 | dispatch_data_t frame = [self createDispatchDataWithFrameOfType:frameType frameTag:tag payload:payload]; 155 | dispatch_io_write(channel, 0, frame, queue_, ^(bool done, dispatch_data_t data, int _errno) { 156 | if (done && callback) { 157 | callback(_errno == 0 ? nil : [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:_errno userInfo:nil]); 158 | } 159 | }); 160 | #if PT_DISPATCH_RETAIN_RELEASE 161 | dispatch_release(frame); 162 | #endif 163 | } 164 | 165 | 166 | #pragma mark - 167 | #pragma mark Receiving frames 168 | 169 | 170 | - (void)readFrameOverChannel:(dispatch_io_t)channel callback:(void(^)(NSError *error, uint32_t frameType, uint32_t frameTag, uint32_t payloadSize))callback { 171 | __block dispatch_data_t allData = NULL; 172 | 173 | dispatch_io_read(channel, 0, sizeof(PTFrame), queue_, ^(bool done, dispatch_data_t data, int error) { 174 | //NSLog(@"dispatch_io_read: done=%d data=%p error=%d", done, data, error); 175 | size_t dataSize = data ? dispatch_data_get_size(data) : 0; 176 | 177 | if (dataSize) { 178 | if (!allData) { 179 | allData = data; 180 | #if PT_DISPATCH_RETAIN_RELEASE 181 | dispatch_retain(allData); 182 | #endif 183 | } else { 184 | #if PT_DISPATCH_RETAIN_RELEASE 185 | dispatch_data_t allDataPrev = allData; 186 | allData = dispatch_data_create_concat(allData, data); 187 | dispatch_release(allDataPrev); 188 | #else 189 | allData = dispatch_data_create_concat(allData, data); 190 | #endif 191 | } 192 | } 193 | 194 | if (done) { 195 | if (error != 0) { 196 | callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], 0, 0, 0); 197 | return; 198 | } 199 | 200 | if (dataSize == 0) { 201 | callback(nil, PTFrameTypeEndOfStream, 0, 0); 202 | return; 203 | } 204 | 205 | if (!allData || dispatch_data_get_size(allData) < sizeof(PTFrame)) { 206 | #if PT_DISPATCH_RETAIN_RELEASE 207 | if (allData) dispatch_release(allData); 208 | #endif 209 | callback([[NSError alloc] initWithDomain:PTProtocolErrorDomain code:0 userInfo:nil], 0, 0, 0); 210 | return; 211 | } 212 | 213 | PTFrame *frame = NULL; 214 | size_t size = 0; 215 | 216 | PT_PRECISE_LIFETIME dispatch_data_t contiguousData = dispatch_data_create_map(allData, (const void **)&frame, &size); // precise lifetime guarantees bytes in frame will stay valid till the end of scope 217 | #if PT_DISPATCH_RETAIN_RELEASE 218 | dispatch_release(allData); 219 | #endif 220 | if (!contiguousData) { 221 | callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:ENOMEM userInfo:nil], 0, 0, 0); 222 | return; 223 | } 224 | 225 | frame->version = ntohl(frame->version); 226 | if (frame->version != PTProtocolVersion1) { 227 | callback([[NSError alloc] initWithDomain:PTProtocolErrorDomain code:0 userInfo:nil], 0, 0, 0); 228 | } else { 229 | frame->type = ntohl(frame->type); 230 | frame->tag = ntohl(frame->tag); 231 | frame->payloadSize = ntohl(frame->payloadSize); 232 | callback(nil, frame->type, frame->tag, frame->payloadSize); 233 | } 234 | 235 | #if PT_DISPATCH_RETAIN_RELEASE 236 | dispatch_release(contiguousData); 237 | #endif 238 | } 239 | }); 240 | } 241 | 242 | 243 | - (void)readPayloadOfSize:(size_t)payloadSize overChannel:(dispatch_io_t)channel callback:(void(^)(NSError *error, dispatch_data_t contiguousData, const uint8_t *buffer, size_t bufferSize))callback { 244 | __block dispatch_data_t allData = NULL; 245 | dispatch_io_read(channel, 0, payloadSize, queue_, ^(bool done, dispatch_data_t data, int error) { 246 | //NSLog(@"dispatch_io_read: done=%d data=%p error=%d", done, data, error); 247 | size_t dataSize = dispatch_data_get_size(data); 248 | 249 | if (dataSize) { 250 | if (!allData) { 251 | allData = data; 252 | #if PT_DISPATCH_RETAIN_RELEASE 253 | dispatch_retain(allData); 254 | #endif 255 | } else { 256 | #if PT_DISPATCH_RETAIN_RELEASE 257 | dispatch_data_t allDataPrev = allData; 258 | allData = dispatch_data_create_concat(allData, data); 259 | dispatch_release(allDataPrev); 260 | #else 261 | allData = dispatch_data_create_concat(allData, data); 262 | #endif 263 | } 264 | } 265 | 266 | if (done) { 267 | if (error != 0) { 268 | #if PT_DISPATCH_RETAIN_RELEASE 269 | if (allData) dispatch_release(allData); 270 | #endif 271 | callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], NULL, NULL, 0); 272 | return; 273 | } 274 | 275 | if (dataSize == 0) { 276 | #if PT_DISPATCH_RETAIN_RELEASE 277 | if (allData) dispatch_release(allData); 278 | #endif 279 | callback(nil, NULL, NULL, 0); 280 | return; 281 | } 282 | 283 | uint8_t *buffer = NULL; 284 | size_t bufferSize = 0; 285 | PT_PRECISE_LIFETIME dispatch_data_t contiguousData = NULL; 286 | 287 | if (allData) { 288 | contiguousData = dispatch_data_create_map(allData, (const void **)&buffer, &bufferSize); 289 | #if PT_DISPATCH_RETAIN_RELEASE 290 | dispatch_release(allData); allData = NULL; 291 | #endif 292 | if (!contiguousData) { 293 | callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:ENOMEM userInfo:nil], NULL, NULL, 0); 294 | return; 295 | } 296 | } 297 | 298 | callback(nil, contiguousData, buffer, bufferSize); 299 | #if PT_DISPATCH_RETAIN_RELEASE 300 | if (contiguousData) dispatch_release(contiguousData); 301 | #endif 302 | } 303 | }); 304 | } 305 | 306 | 307 | - (void)readAndDiscardDataOfSize:(size_t)size overChannel:(dispatch_io_t)channel callback:(void(^)(NSError*, BOOL))callback { 308 | dispatch_io_read(channel, 0, size, queue_, ^(bool done, dispatch_data_t data, int error) { 309 | if (done && callback) { 310 | size_t dataSize = dispatch_data_get_size(data); 311 | callback(error == 0 ? nil : [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], dataSize == 0); 312 | } 313 | }); 314 | } 315 | 316 | 317 | - (void)readFramesOverChannel:(dispatch_io_t)channel onFrame:(void(^)(NSError*, uint32_t, uint32_t, uint32_t, dispatch_block_t))onFrame { 318 | [self readFrameOverChannel:channel callback:^(NSError *error, uint32_t type, uint32_t tag, uint32_t payloadSize) { 319 | onFrame(error, type, tag, payloadSize, ^{ 320 | if (type != PTFrameTypeEndOfStream) { 321 | [self readFramesOverChannel:channel onFrame:onFrame]; 322 | } 323 | }); 324 | }]; 325 | } 326 | 327 | 328 | @end 329 | 330 | 331 | @interface _PTDispatchData : NSObject { 332 | dispatch_data_t dispatchData_; 333 | } 334 | @end 335 | @implementation _PTDispatchData 336 | - (id)initWithDispatchData:(dispatch_data_t)dispatchData { 337 | if (!(self = [super init])) return nil; 338 | dispatchData_ = dispatchData; 339 | #if PT_DISPATCH_RETAIN_RELEASE 340 | dispatch_retain(dispatchData_); 341 | #endif 342 | return self; 343 | } 344 | - (void)dealloc { 345 | #if PT_DISPATCH_RETAIN_RELEASE 346 | if (dispatchData_) dispatch_release(dispatchData_); 347 | #endif 348 | } 349 | @end 350 | 351 | @implementation NSData (PTProtocol) 352 | 353 | #pragma clang diagnostic push 354 | #pragma clang diagnostic ignored "-Wunused-getter-return-value" 355 | 356 | - (dispatch_data_t)createReferencingDispatchData { 357 | // Note: The queue is used to submit the destructor. Since we only perform an 358 | // atomic release of self, it doesn't really matter which queue is used, thus 359 | // we use the current calling queue. 360 | return dispatch_data_create((const void*)self.bytes, self.length, dispatch_get_main_queue(), ^{ 361 | // trick to have the block capture the data, thus retain/releasing 362 | [self length]; 363 | }); 364 | } 365 | 366 | #pragma clang diagnostic pop 367 | 368 | + (NSData *)dataWithContentsOfDispatchData:(dispatch_data_t)data { 369 | if (!data) { 370 | return nil; 371 | } 372 | uint8_t *buffer = NULL; 373 | size_t bufferSize = 0; 374 | PT_PRECISE_LIFETIME dispatch_data_t contiguousData = dispatch_data_create_map(data, (const void **)&buffer, &bufferSize); 375 | if (!contiguousData) { 376 | return nil; 377 | } 378 | 379 | _PTDispatchData *dispatchDataRef = [[_PTDispatchData alloc] initWithDispatchData:contiguousData]; 380 | NSData *newData = [NSData dataWithBytesNoCopy:(void*)buffer length:bufferSize freeWhenDone:NO]; 381 | #if PT_DISPATCH_RETAIN_RELEASE 382 | dispatch_release(contiguousData); 383 | #endif 384 | static const bool kDispatchDataRefKey; 385 | objc_setAssociatedObject(newData, (const void*)kDispatchDataRefKey, dispatchDataRef, OBJC_ASSOCIATION_RETAIN); 386 | 387 | return newData; 388 | } 389 | 390 | @end 391 | 392 | 393 | @implementation NSDictionary (PTProtocol) 394 | 395 | - (dispatch_data_t)createReferencingDispatchData { 396 | NSError *error = nil; 397 | NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:self format:NSPropertyListBinaryFormat_v1_0 options:0 error:&error]; 398 | if (!plistData) { 399 | NSLog(@"Failed to serialize property list: %@", error); 400 | return nil; 401 | } else { 402 | return [plistData createReferencingDispatchData]; 403 | } 404 | } 405 | 406 | // Decode *data* as a peroperty list-encoded dictionary. Returns nil on failure. 407 | + (NSDictionary*)dictionaryWithContentsOfDispatchData:(dispatch_data_t)data { 408 | if (!data) { 409 | return nil; 410 | } 411 | uint8_t *buffer = NULL; 412 | size_t bufferSize = 0; 413 | PT_PRECISE_LIFETIME dispatch_data_t contiguousData = dispatch_data_create_map(data, (const void **)&buffer, &bufferSize); 414 | if (!contiguousData) { 415 | return nil; 416 | } 417 | NSDictionary *dict = [NSPropertyListSerialization propertyListWithData:[NSData dataWithBytesNoCopy:(void*)buffer length:bufferSize freeWhenDone:NO] options:NSPropertyListImmutable format:NULL error:nil]; 418 | #if PT_DISPATCH_RETAIN_RELEASE 419 | dispatch_release(contiguousData); 420 | #endif 421 | return dict; 422 | } 423 | 424 | @end 425 | -------------------------------------------------------------------------------- /Harmony Desktop/Pods/PeerTalk/peertalk/PTProtocol.m: -------------------------------------------------------------------------------- 1 | #import "PTProtocol.h" 2 | #import "PTPrivate.h" 3 | #import 4 | 5 | static const uint32_t PTProtocolVersion1 = 1; 6 | 7 | NSString * const PTProtocolErrorDomain = @"PTProtocolError"; 8 | 9 | // This is what we send as the header for each frame. 10 | typedef struct _PTFrame { 11 | // The version of the frame and protocol. 12 | uint32_t version; 13 | 14 | // Type of frame 15 | uint32_t type; 16 | 17 | // Unless zero, a tag is retained in frames that are responses to previous 18 | // frames. Applications can use this to build transactions or request-response 19 | // logic. 20 | uint32_t tag; 21 | 22 | // If payloadSize is larger than zero, *payloadSize* number of bytes are 23 | // following, constituting application-specific data. 24 | uint32_t payloadSize; 25 | 26 | } PTFrame; 27 | 28 | 29 | @interface PTProtocol () { 30 | uint32_t nextFrameTag_; 31 | @public 32 | dispatch_queue_t queue_; 33 | } 34 | - (dispatch_data_t)createDispatchDataWithFrameOfType:(uint32_t)type frameTag:(uint32_t)frameTag payload:(dispatch_data_t)payload; 35 | @end 36 | 37 | 38 | static void _release_queue_local_protocol(void *objcobj) { 39 | if (objcobj) { 40 | PTProtocol *protocol = (__bridge_transfer id)objcobj; 41 | protocol->queue_ = NULL; 42 | } 43 | } 44 | 45 | 46 | @interface RQueueLocalIOFrameProtocol : PTProtocol 47 | @end 48 | @implementation RQueueLocalIOFrameProtocol 49 | - (void)setQueue:(dispatch_queue_t)queue { 50 | } 51 | @end 52 | 53 | 54 | @implementation PTProtocol 55 | 56 | 57 | + (PTProtocol*)sharedProtocolForQueue:(dispatch_queue_t)queue { 58 | static const char currentQueueFrameProtocolKey; 59 | //dispatch_queue_t queue = dispatch_get_current_queue(); 60 | PTProtocol *currentQueueFrameProtocol = (__bridge PTProtocol*)dispatch_queue_get_specific(queue, ¤tQueueFrameProtocolKey); 61 | if (!currentQueueFrameProtocol) { 62 | currentQueueFrameProtocol = [[RQueueLocalIOFrameProtocol alloc] initWithDispatchQueue:NULL]; 63 | currentQueueFrameProtocol->queue_ = queue; // reference, no retain, since we would create cyclic references 64 | dispatch_queue_set_specific(queue, ¤tQueueFrameProtocolKey, (__bridge_retained void*)currentQueueFrameProtocol, &_release_queue_local_protocol); 65 | return (__bridge PTProtocol*)dispatch_queue_get_specific(queue, ¤tQueueFrameProtocolKey); // to avoid race conds 66 | } else { 67 | return currentQueueFrameProtocol; 68 | } 69 | } 70 | 71 | 72 | - (id)initWithDispatchQueue:(dispatch_queue_t)queue { 73 | if (!(self = [super init])) return nil; 74 | queue_ = queue; 75 | #if PT_DISPATCH_RETAIN_RELEASE 76 | if (queue_) dispatch_retain(queue_); 77 | #endif 78 | return self; 79 | } 80 | 81 | - (id)init { 82 | return [self initWithDispatchQueue:dispatch_get_main_queue()]; 83 | } 84 | 85 | - (void)dealloc { 86 | if (queue_) { 87 | #if PT_DISPATCH_RETAIN_RELEASE 88 | dispatch_release(queue_); 89 | #endif 90 | } 91 | } 92 | 93 | - (dispatch_queue_t)queue { 94 | return queue_; 95 | } 96 | 97 | - (void)setQueue:(dispatch_queue_t)queue { 98 | #if PT_DISPATCH_RETAIN_RELEASE 99 | dispatch_queue_t prev_queue = queue_; 100 | queue_ = queue; 101 | if (queue_) dispatch_retain(queue_); 102 | if (prev_queue) dispatch_release(prev_queue); 103 | #else 104 | queue_ = queue; 105 | #endif 106 | } 107 | 108 | 109 | - (uint32_t)newTag { 110 | return ++nextFrameTag_; 111 | } 112 | 113 | 114 | #pragma mark - 115 | #pragma mark Creating frames 116 | 117 | 118 | - (dispatch_data_t)createDispatchDataWithFrameOfType:(uint32_t)type frameTag:(uint32_t)frameTag payload:(dispatch_data_t)payload { 119 | PTFrame *frame = CFAllocatorAllocate(kCFAllocatorDefault, sizeof(PTFrame), 0); 120 | frame->version = htonl(PTProtocolVersion1); 121 | frame->type = htonl(type); 122 | frame->tag = htonl(frameTag); 123 | 124 | if (payload) { 125 | size_t payloadSize = dispatch_data_get_size(payload); 126 | assert(payloadSize <= UINT32_MAX); 127 | frame->payloadSize = htonl((uint32_t)payloadSize); 128 | } else { 129 | frame->payloadSize = 0; 130 | } 131 | 132 | dispatch_data_t frameData = dispatch_data_create((const void*)frame, sizeof(PTFrame), queue_, ^{ 133 | CFAllocatorDeallocate(kCFAllocatorDefault, (void*)frame); 134 | }); 135 | 136 | if (payload && frame->payloadSize != 0) { 137 | // chain frame + payload 138 | dispatch_data_t data = dispatch_data_create_concat(frameData, payload); 139 | #if PT_DISPATCH_RETAIN_RELEASE 140 | dispatch_release(frameData); 141 | #endif 142 | frameData = data; 143 | } 144 | 145 | return frameData; 146 | } 147 | 148 | 149 | #pragma mark - 150 | #pragma mark Sending frames 151 | 152 | 153 | - (void)sendFrameOfType:(uint32_t)frameType tag:(uint32_t)tag withPayload:(dispatch_data_t)payload overChannel:(dispatch_io_t)channel callback:(void(^)(NSError*))callback { 154 | dispatch_data_t frame = [self createDispatchDataWithFrameOfType:frameType frameTag:tag payload:payload]; 155 | dispatch_io_write(channel, 0, frame, queue_, ^(bool done, dispatch_data_t data, int _errno) { 156 | if (done && callback) { 157 | callback(_errno == 0 ? nil : [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:_errno userInfo:nil]); 158 | } 159 | }); 160 | #if PT_DISPATCH_RETAIN_RELEASE 161 | dispatch_release(frame); 162 | #endif 163 | } 164 | 165 | 166 | #pragma mark - 167 | #pragma mark Receiving frames 168 | 169 | 170 | - (void)readFrameOverChannel:(dispatch_io_t)channel callback:(void(^)(NSError *error, uint32_t frameType, uint32_t frameTag, uint32_t payloadSize))callback { 171 | __block dispatch_data_t allData = NULL; 172 | 173 | dispatch_io_read(channel, 0, sizeof(PTFrame), queue_, ^(bool done, dispatch_data_t data, int error) { 174 | //NSLog(@"dispatch_io_read: done=%d data=%p error=%d", done, data, error); 175 | size_t dataSize = data ? dispatch_data_get_size(data) : 0; 176 | 177 | if (dataSize) { 178 | if (!allData) { 179 | allData = data; 180 | #if PT_DISPATCH_RETAIN_RELEASE 181 | dispatch_retain(allData); 182 | #endif 183 | } else { 184 | #if PT_DISPATCH_RETAIN_RELEASE 185 | dispatch_data_t allDataPrev = allData; 186 | allData = dispatch_data_create_concat(allData, data); 187 | dispatch_release(allDataPrev); 188 | #else 189 | allData = dispatch_data_create_concat(allData, data); 190 | #endif 191 | } 192 | } 193 | 194 | if (done) { 195 | if (error != 0) { 196 | callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], 0, 0, 0); 197 | return; 198 | } 199 | 200 | if (dataSize == 0) { 201 | callback(nil, PTFrameTypeEndOfStream, 0, 0); 202 | return; 203 | } 204 | 205 | if (!allData || dispatch_data_get_size(allData) < sizeof(PTFrame)) { 206 | #if PT_DISPATCH_RETAIN_RELEASE 207 | if (allData) dispatch_release(allData); 208 | #endif 209 | callback([[NSError alloc] initWithDomain:PTProtocolErrorDomain code:0 userInfo:nil], 0, 0, 0); 210 | return; 211 | } 212 | 213 | PTFrame *frame = NULL; 214 | size_t size = 0; 215 | 216 | PT_PRECISE_LIFETIME dispatch_data_t contiguousData = dispatch_data_create_map(allData, (const void **)&frame, &size); // precise lifetime guarantees bytes in frame will stay valid till the end of scope 217 | #if PT_DISPATCH_RETAIN_RELEASE 218 | dispatch_release(allData); 219 | #endif 220 | if (!contiguousData) { 221 | callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:ENOMEM userInfo:nil], 0, 0, 0); 222 | return; 223 | } 224 | 225 | frame->version = ntohl(frame->version); 226 | if (frame->version != PTProtocolVersion1) { 227 | callback([[NSError alloc] initWithDomain:PTProtocolErrorDomain code:0 userInfo:nil], 0, 0, 0); 228 | } else { 229 | frame->type = ntohl(frame->type); 230 | frame->tag = ntohl(frame->tag); 231 | frame->payloadSize = ntohl(frame->payloadSize); 232 | callback(nil, frame->type, frame->tag, frame->payloadSize); 233 | } 234 | 235 | #if PT_DISPATCH_RETAIN_RELEASE 236 | dispatch_release(contiguousData); 237 | #endif 238 | } 239 | }); 240 | } 241 | 242 | 243 | - (void)readPayloadOfSize:(size_t)payloadSize overChannel:(dispatch_io_t)channel callback:(void(^)(NSError *error, dispatch_data_t contiguousData, const uint8_t *buffer, size_t bufferSize))callback { 244 | __block dispatch_data_t allData = NULL; 245 | dispatch_io_read(channel, 0, payloadSize, queue_, ^(bool done, dispatch_data_t data, int error) { 246 | //NSLog(@"dispatch_io_read: done=%d data=%p error=%d", done, data, error); 247 | size_t dataSize = dispatch_data_get_size(data); 248 | 249 | if (dataSize) { 250 | if (!allData) { 251 | allData = data; 252 | #if PT_DISPATCH_RETAIN_RELEASE 253 | dispatch_retain(allData); 254 | #endif 255 | } else { 256 | #if PT_DISPATCH_RETAIN_RELEASE 257 | dispatch_data_t allDataPrev = allData; 258 | allData = dispatch_data_create_concat(allData, data); 259 | dispatch_release(allDataPrev); 260 | #else 261 | allData = dispatch_data_create_concat(allData, data); 262 | #endif 263 | } 264 | } 265 | 266 | if (done) { 267 | if (error != 0) { 268 | #if PT_DISPATCH_RETAIN_RELEASE 269 | if (allData) dispatch_release(allData); 270 | #endif 271 | callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], NULL, NULL, 0); 272 | return; 273 | } 274 | 275 | if (dataSize == 0) { 276 | #if PT_DISPATCH_RETAIN_RELEASE 277 | if (allData) dispatch_release(allData); 278 | #endif 279 | callback(nil, NULL, NULL, 0); 280 | return; 281 | } 282 | 283 | uint8_t *buffer = NULL; 284 | size_t bufferSize = 0; 285 | PT_PRECISE_LIFETIME dispatch_data_t contiguousData = NULL; 286 | 287 | if (allData) { 288 | contiguousData = dispatch_data_create_map(allData, (const void **)&buffer, &bufferSize); 289 | #if PT_DISPATCH_RETAIN_RELEASE 290 | dispatch_release(allData); allData = NULL; 291 | #endif 292 | if (!contiguousData) { 293 | callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:ENOMEM userInfo:nil], NULL, NULL, 0); 294 | return; 295 | } 296 | } 297 | 298 | callback(nil, contiguousData, buffer, bufferSize); 299 | #if PT_DISPATCH_RETAIN_RELEASE 300 | if (contiguousData) dispatch_release(contiguousData); 301 | #endif 302 | } 303 | }); 304 | } 305 | 306 | 307 | - (void)readAndDiscardDataOfSize:(size_t)size overChannel:(dispatch_io_t)channel callback:(void(^)(NSError*, BOOL))callback { 308 | dispatch_io_read(channel, 0, size, queue_, ^(bool done, dispatch_data_t data, int error) { 309 | if (done && callback) { 310 | size_t dataSize = dispatch_data_get_size(data); 311 | callback(error == 0 ? nil : [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], dataSize == 0); 312 | } 313 | }); 314 | } 315 | 316 | 317 | - (void)readFramesOverChannel:(dispatch_io_t)channel onFrame:(void(^)(NSError*, uint32_t, uint32_t, uint32_t, dispatch_block_t))onFrame { 318 | [self readFrameOverChannel:channel callback:^(NSError *error, uint32_t type, uint32_t tag, uint32_t payloadSize) { 319 | onFrame(error, type, tag, payloadSize, ^{ 320 | if (type != PTFrameTypeEndOfStream) { 321 | [self readFramesOverChannel:channel onFrame:onFrame]; 322 | } 323 | }); 324 | }]; 325 | } 326 | 327 | 328 | @end 329 | 330 | 331 | @interface _PTDispatchData : NSObject { 332 | dispatch_data_t dispatchData_; 333 | } 334 | @end 335 | @implementation _PTDispatchData 336 | - (id)initWithDispatchData:(dispatch_data_t)dispatchData { 337 | if (!(self = [super init])) return nil; 338 | dispatchData_ = dispatchData; 339 | #if PT_DISPATCH_RETAIN_RELEASE 340 | dispatch_retain(dispatchData_); 341 | #endif 342 | return self; 343 | } 344 | - (void)dealloc { 345 | #if PT_DISPATCH_RETAIN_RELEASE 346 | if (dispatchData_) dispatch_release(dispatchData_); 347 | #endif 348 | } 349 | @end 350 | 351 | @implementation NSData (PTProtocol) 352 | 353 | #pragma clang diagnostic push 354 | #pragma clang diagnostic ignored "-Wunused-getter-return-value" 355 | 356 | - (dispatch_data_t)createReferencingDispatchData { 357 | // Note: The queue is used to submit the destructor. Since we only perform an 358 | // atomic release of self, it doesn't really matter which queue is used, thus 359 | // we use the current calling queue. 360 | return dispatch_data_create((const void*)self.bytes, self.length, dispatch_get_main_queue(), ^{ 361 | // trick to have the block capture the data, thus retain/releasing 362 | [self length]; 363 | }); 364 | } 365 | 366 | #pragma clang diagnostic pop 367 | 368 | + (NSData *)dataWithContentsOfDispatchData:(dispatch_data_t)data { 369 | if (!data) { 370 | return nil; 371 | } 372 | uint8_t *buffer = NULL; 373 | size_t bufferSize = 0; 374 | PT_PRECISE_LIFETIME dispatch_data_t contiguousData = dispatch_data_create_map(data, (const void **)&buffer, &bufferSize); 375 | if (!contiguousData) { 376 | return nil; 377 | } 378 | 379 | _PTDispatchData *dispatchDataRef = [[_PTDispatchData alloc] initWithDispatchData:contiguousData]; 380 | NSData *newData = [NSData dataWithBytesNoCopy:(void*)buffer length:bufferSize freeWhenDone:NO]; 381 | #if PT_DISPATCH_RETAIN_RELEASE 382 | dispatch_release(contiguousData); 383 | #endif 384 | static const bool kDispatchDataRefKey; 385 | objc_setAssociatedObject(newData, (const void*)kDispatchDataRefKey, dispatchDataRef, OBJC_ASSOCIATION_RETAIN); 386 | 387 | return newData; 388 | } 389 | 390 | @end 391 | 392 | 393 | @implementation NSDictionary (PTProtocol) 394 | 395 | - (dispatch_data_t)createReferencingDispatchData { 396 | NSError *error = nil; 397 | NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:self format:NSPropertyListBinaryFormat_v1_0 options:0 error:&error]; 398 | if (!plistData) { 399 | NSLog(@"Failed to serialize property list: %@", error); 400 | return nil; 401 | } else { 402 | return [plistData createReferencingDispatchData]; 403 | } 404 | } 405 | 406 | // Decode *data* as a peroperty list-encoded dictionary. Returns nil on failure. 407 | + (NSDictionary*)dictionaryWithContentsOfDispatchData:(dispatch_data_t)data { 408 | if (!data) { 409 | return nil; 410 | } 411 | uint8_t *buffer = NULL; 412 | size_t bufferSize = 0; 413 | PT_PRECISE_LIFETIME dispatch_data_t contiguousData = dispatch_data_create_map(data, (const void **)&buffer, &bufferSize); 414 | if (!contiguousData) { 415 | return nil; 416 | } 417 | NSDictionary *dict = [NSPropertyListSerialization propertyListWithData:[NSData dataWithBytesNoCopy:(void*)buffer length:bufferSize freeWhenDone:NO] options:NSPropertyListImmutable format:NULL error:nil]; 418 | #if PT_DISPATCH_RETAIN_RELEASE 419 | dispatch_release(contiguousData); 420 | #endif 421 | return dict; 422 | } 423 | 424 | @end 425 | -------------------------------------------------------------------------------- /Harmony iOS/Harmony iOS.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 93FF91912B5F09944A5EB624 /* Pods_Harmony_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1297EAE33159964537091D6 /* Pods_Harmony_iOS.framework */; }; 11 | B6491E181F21642900B88B37 /* PayloadConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = B6491E171F21642900B88B37 /* PayloadConverter.m */; }; 12 | B65D1A691F21400C00972655 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B65D1A681F21400C00972655 /* AppDelegate.swift */; }; 13 | B65D1A6B1F21400C00972655 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B65D1A6A1F21400C00972655 /* ViewController.swift */; }; 14 | B65D1A6E1F21400C00972655 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B65D1A6C1F21400C00972655 /* Main.storyboard */; }; 15 | B65D1A701F21400C00972655 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B65D1A6F1F21400C00972655 /* Assets.xcassets */; }; 16 | B65D1A731F21400C00972655 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B65D1A711F21400C00972655 /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 4789CF136FFD3356E7908775 /* Pods-Harmony iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harmony iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS.release.xcconfig"; sourceTree = ""; }; 21 | 6F385DAF758D4A1D3CBF5531 /* Pods-Harmony iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harmony iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS.debug.xcconfig"; sourceTree = ""; }; 22 | B6491E111F2140D600B88B37 /* Harmony iOS-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Harmony iOS-Bridging-Header.h"; sourceTree = ""; }; 23 | B6491E141F21416C00B88B37 /* PTExampleProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PTExampleProtocol.h; sourceTree = ""; }; 24 | B6491E171F21642900B88B37 /* PayloadConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PayloadConverter.m; sourceTree = ""; }; 25 | B65D1A651F21400C00972655 /* Harmony iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Harmony iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | B65D1A681F21400C00972655 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 27 | B65D1A6A1F21400C00972655 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 28 | B65D1A6D1F21400C00972655 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 29 | B65D1A6F1F21400C00972655 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | B65D1A721F21400C00972655 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 31 | B65D1A741F21400C00972655 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | B678C8CD22BDF0B700F2E822 /* NSStream+BoundPairAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSStream+BoundPairAdditions.m"; sourceTree = ""; }; 33 | F1297EAE33159964537091D6 /* Pods_Harmony_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Harmony_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | B65D1A621F21400C00972655 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | 93FF91912B5F09944A5EB624 /* Pods_Harmony_iOS.framework in Frameworks */, 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | 7E4FEA0233DB6CA902703133 /* Pods */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | 6F385DAF758D4A1D3CBF5531 /* Pods-Harmony iOS.debug.xcconfig */, 52 | 4789CF136FFD3356E7908775 /* Pods-Harmony iOS.release.xcconfig */, 53 | ); 54 | name = Pods; 55 | sourceTree = ""; 56 | }; 57 | B60C73C7567DEC7FE6125771 /* Frameworks */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | F1297EAE33159964537091D6 /* Pods_Harmony_iOS.framework */, 61 | ); 62 | name = Frameworks; 63 | sourceTree = ""; 64 | }; 65 | B65D1A5C1F21400C00972655 = { 66 | isa = PBXGroup; 67 | children = ( 68 | B65D1A671F21400C00972655 /* Harmony iOS */, 69 | B65D1A661F21400C00972655 /* Products */, 70 | 7E4FEA0233DB6CA902703133 /* Pods */, 71 | B60C73C7567DEC7FE6125771 /* Frameworks */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | B65D1A661F21400C00972655 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | B65D1A651F21400C00972655 /* Harmony iOS.app */, 79 | ); 80 | name = Products; 81 | sourceTree = ""; 82 | }; 83 | B65D1A671F21400C00972655 /* Harmony iOS */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | B65D1A681F21400C00972655 /* AppDelegate.swift */, 87 | B65D1A6A1F21400C00972655 /* ViewController.swift */, 88 | B678C8CD22BDF0B700F2E822 /* NSStream+BoundPairAdditions.m */, 89 | B6491E171F21642900B88B37 /* PayloadConverter.m */, 90 | B65D1A6C1F21400C00972655 /* Main.storyboard */, 91 | B65D1A6F1F21400C00972655 /* Assets.xcassets */, 92 | B65D1A711F21400C00972655 /* LaunchScreen.storyboard */, 93 | B65D1A741F21400C00972655 /* Info.plist */, 94 | B6491E111F2140D600B88B37 /* Harmony iOS-Bridging-Header.h */, 95 | B6491E141F21416C00B88B37 /* PTExampleProtocol.h */, 96 | ); 97 | path = "Harmony iOS"; 98 | sourceTree = ""; 99 | }; 100 | /* End PBXGroup section */ 101 | 102 | /* Begin PBXNativeTarget section */ 103 | B65D1A641F21400C00972655 /* Harmony iOS */ = { 104 | isa = PBXNativeTarget; 105 | buildConfigurationList = B65D1A771F21400C00972655 /* Build configuration list for PBXNativeTarget "Harmony iOS" */; 106 | buildPhases = ( 107 | 23B70E70D52484FDDBF8EB75 /* [CP] Check Pods Manifest.lock */, 108 | B65D1A611F21400C00972655 /* Sources */, 109 | B65D1A621F21400C00972655 /* Frameworks */, 110 | B65D1A631F21400C00972655 /* Resources */, 111 | 0890CE3C1332100D9334C9A5 /* [CP] Embed Pods Frameworks */, 112 | ); 113 | buildRules = ( 114 | ); 115 | dependencies = ( 116 | ); 117 | name = "Harmony iOS"; 118 | productName = "Harmony iOS"; 119 | productReference = B65D1A651F21400C00972655 /* Harmony iOS.app */; 120 | productType = "com.apple.product-type.application"; 121 | }; 122 | /* End PBXNativeTarget section */ 123 | 124 | /* Begin PBXProject section */ 125 | B65D1A5D1F21400C00972655 /* Project object */ = { 126 | isa = PBXProject; 127 | attributes = { 128 | LastSwiftUpdateCheck = 0830; 129 | LastUpgradeCheck = 0830; 130 | ORGANIZATIONNAME = "Frederick Morlock"; 131 | TargetAttributes = { 132 | B65D1A641F21400C00972655 = { 133 | CreatedOnToolsVersion = 8.3.3; 134 | DevelopmentTeam = 9DA4RFE7AJ; 135 | LastSwiftMigration = 1020; 136 | ProvisioningStyle = Automatic; 137 | }; 138 | }; 139 | }; 140 | buildConfigurationList = B65D1A601F21400C00972655 /* Build configuration list for PBXProject "Harmony iOS" */; 141 | compatibilityVersion = "Xcode 3.2"; 142 | developmentRegion = English; 143 | hasScannedForEncodings = 0; 144 | knownRegions = ( 145 | English, 146 | en, 147 | Base, 148 | ); 149 | mainGroup = B65D1A5C1F21400C00972655; 150 | productRefGroup = B65D1A661F21400C00972655 /* Products */; 151 | projectDirPath = ""; 152 | projectRoot = ""; 153 | targets = ( 154 | B65D1A641F21400C00972655 /* Harmony iOS */, 155 | ); 156 | }; 157 | /* End PBXProject section */ 158 | 159 | /* Begin PBXResourcesBuildPhase section */ 160 | B65D1A631F21400C00972655 /* Resources */ = { 161 | isa = PBXResourcesBuildPhase; 162 | buildActionMask = 2147483647; 163 | files = ( 164 | B65D1A731F21400C00972655 /* LaunchScreen.storyboard in Resources */, 165 | B65D1A701F21400C00972655 /* Assets.xcassets in Resources */, 166 | B65D1A6E1F21400C00972655 /* Main.storyboard in Resources */, 167 | ); 168 | runOnlyForDeploymentPostprocessing = 0; 169 | }; 170 | /* End PBXResourcesBuildPhase section */ 171 | 172 | /* Begin PBXShellScriptBuildPhase section */ 173 | 0890CE3C1332100D9334C9A5 /* [CP] Embed Pods Frameworks */ = { 174 | isa = PBXShellScriptBuildPhase; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | ); 178 | inputPaths = ( 179 | "${PODS_ROOT}/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS-frameworks.sh", 180 | "${BUILT_PRODUCTS_DIR}/PeerTalk/PeerTalk.framework", 181 | ); 182 | name = "[CP] Embed Pods Frameworks"; 183 | outputPaths = ( 184 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PeerTalk.framework", 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | shellPath = /bin/sh; 188 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Harmony iOS/Pods-Harmony iOS-frameworks.sh\"\n"; 189 | showEnvVarsInLog = 0; 190 | }; 191 | 23B70E70D52484FDDBF8EB75 /* [CP] Check Pods Manifest.lock */ = { 192 | isa = PBXShellScriptBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | ); 196 | inputPaths = ( 197 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 198 | "${PODS_ROOT}/Manifest.lock", 199 | ); 200 | name = "[CP] Check Pods Manifest.lock"; 201 | outputPaths = ( 202 | "$(DERIVED_FILE_DIR)/Pods-Harmony iOS-checkManifestLockResult.txt", 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 207 | showEnvVarsInLog = 0; 208 | }; 209 | /* End PBXShellScriptBuildPhase section */ 210 | 211 | /* Begin PBXSourcesBuildPhase section */ 212 | B65D1A611F21400C00972655 /* Sources */ = { 213 | isa = PBXSourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | B6491E181F21642900B88B37 /* PayloadConverter.m in Sources */, 217 | B65D1A6B1F21400C00972655 /* ViewController.swift in Sources */, 218 | B65D1A691F21400C00972655 /* AppDelegate.swift in Sources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXSourcesBuildPhase section */ 223 | 224 | /* Begin PBXVariantGroup section */ 225 | B65D1A6C1F21400C00972655 /* Main.storyboard */ = { 226 | isa = PBXVariantGroup; 227 | children = ( 228 | B65D1A6D1F21400C00972655 /* Base */, 229 | ); 230 | name = Main.storyboard; 231 | sourceTree = ""; 232 | }; 233 | B65D1A711F21400C00972655 /* LaunchScreen.storyboard */ = { 234 | isa = PBXVariantGroup; 235 | children = ( 236 | B65D1A721F21400C00972655 /* Base */, 237 | ); 238 | name = LaunchScreen.storyboard; 239 | sourceTree = ""; 240 | }; 241 | /* End PBXVariantGroup section */ 242 | 243 | /* Begin XCBuildConfiguration section */ 244 | B65D1A751F21400C00972655 /* Debug */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | CLANG_ANALYZER_NONNULL = YES; 249 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 250 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 251 | CLANG_CXX_LIBRARY = "libc++"; 252 | CLANG_ENABLE_MODULES = YES; 253 | CLANG_ENABLE_OBJC_ARC = YES; 254 | CLANG_WARN_BOOL_CONVERSION = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 257 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INFINITE_RECURSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 264 | CLANG_WARN_UNREACHABLE_CODE = YES; 265 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 266 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 267 | COPY_PHASE_STRIP = NO; 268 | DEBUG_INFORMATION_FORMAT = dwarf; 269 | ENABLE_STRICT_OBJC_MSGSEND = YES; 270 | ENABLE_TESTABILITY = YES; 271 | GCC_C_LANGUAGE_STANDARD = gnu99; 272 | GCC_DYNAMIC_NO_PIC = NO; 273 | GCC_NO_COMMON_BLOCKS = YES; 274 | GCC_OPTIMIZATION_LEVEL = 0; 275 | GCC_PREPROCESSOR_DEFINITIONS = ( 276 | "DEBUG=1", 277 | "$(inherited)", 278 | ); 279 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 280 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 281 | GCC_WARN_UNDECLARED_SELECTOR = YES; 282 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 283 | GCC_WARN_UNUSED_FUNCTION = YES; 284 | GCC_WARN_UNUSED_VARIABLE = YES; 285 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 286 | MTL_ENABLE_DEBUG_INFO = YES; 287 | ONLY_ACTIVE_ARCH = YES; 288 | SDKROOT = iphoneos; 289 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 290 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 291 | TARGETED_DEVICE_FAMILY = "1,2"; 292 | }; 293 | name = Debug; 294 | }; 295 | B65D1A761F21400C00972655 /* Release */ = { 296 | isa = XCBuildConfiguration; 297 | buildSettings = { 298 | ALWAYS_SEARCH_USER_PATHS = NO; 299 | CLANG_ANALYZER_NONNULL = YES; 300 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 301 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 302 | CLANG_CXX_LIBRARY = "libc++"; 303 | CLANG_ENABLE_MODULES = YES; 304 | CLANG_ENABLE_OBJC_ARC = YES; 305 | CLANG_WARN_BOOL_CONVERSION = YES; 306 | CLANG_WARN_CONSTANT_CONVERSION = YES; 307 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 308 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 309 | CLANG_WARN_EMPTY_BODY = YES; 310 | CLANG_WARN_ENUM_CONVERSION = YES; 311 | CLANG_WARN_INFINITE_RECURSION = YES; 312 | CLANG_WARN_INT_CONVERSION = YES; 313 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 314 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 315 | CLANG_WARN_UNREACHABLE_CODE = YES; 316 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 317 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 318 | COPY_PHASE_STRIP = NO; 319 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 320 | ENABLE_NS_ASSERTIONS = NO; 321 | ENABLE_STRICT_OBJC_MSGSEND = YES; 322 | GCC_C_LANGUAGE_STANDARD = gnu99; 323 | GCC_NO_COMMON_BLOCKS = YES; 324 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 325 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 326 | GCC_WARN_UNDECLARED_SELECTOR = YES; 327 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 328 | GCC_WARN_UNUSED_FUNCTION = YES; 329 | GCC_WARN_UNUSED_VARIABLE = YES; 330 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 331 | MTL_ENABLE_DEBUG_INFO = NO; 332 | SDKROOT = iphoneos; 333 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 334 | TARGETED_DEVICE_FAMILY = "1,2"; 335 | VALIDATE_PRODUCT = YES; 336 | }; 337 | name = Release; 338 | }; 339 | B65D1A781F21400C00972655 /* Debug */ = { 340 | isa = XCBuildConfiguration; 341 | baseConfigurationReference = 6F385DAF758D4A1D3CBF5531 /* Pods-Harmony iOS.debug.xcconfig */; 342 | buildSettings = { 343 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 344 | CLANG_ENABLE_MODULES = YES; 345 | DEVELOPMENT_TEAM = 9DA4RFE7AJ; 346 | ENABLE_BITCODE = NO; 347 | INFOPLIST_FILE = "Harmony iOS/Info.plist"; 348 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 349 | PRODUCT_BUNDLE_IDENTIFIER = "us.freddy.Harmony-iOS"; 350 | PRODUCT_NAME = "$(TARGET_NAME)"; 351 | SWIFT_OBJC_BRIDGING_HEADER = "Harmony iOS/Harmony iOS-Bridging-Header.h"; 352 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 353 | SWIFT_VERSION = 5.0; 354 | }; 355 | name = Debug; 356 | }; 357 | B65D1A791F21400C00972655 /* Release */ = { 358 | isa = XCBuildConfiguration; 359 | baseConfigurationReference = 4789CF136FFD3356E7908775 /* Pods-Harmony iOS.release.xcconfig */; 360 | buildSettings = { 361 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 362 | CLANG_ENABLE_MODULES = YES; 363 | DEVELOPMENT_TEAM = 9DA4RFE7AJ; 364 | ENABLE_BITCODE = NO; 365 | INFOPLIST_FILE = "Harmony iOS/Info.plist"; 366 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 367 | PRODUCT_BUNDLE_IDENTIFIER = "us.freddy.Harmony-iOS"; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | SWIFT_OBJC_BRIDGING_HEADER = "Harmony iOS/Harmony iOS-Bridging-Header.h"; 370 | SWIFT_VERSION = 5.0; 371 | }; 372 | name = Release; 373 | }; 374 | /* End XCBuildConfiguration section */ 375 | 376 | /* Begin XCConfigurationList section */ 377 | B65D1A601F21400C00972655 /* Build configuration list for PBXProject "Harmony iOS" */ = { 378 | isa = XCConfigurationList; 379 | buildConfigurations = ( 380 | B65D1A751F21400C00972655 /* Debug */, 381 | B65D1A761F21400C00972655 /* Release */, 382 | ); 383 | defaultConfigurationIsVisible = 0; 384 | defaultConfigurationName = Release; 385 | }; 386 | B65D1A771F21400C00972655 /* Build configuration list for PBXNativeTarget "Harmony iOS" */ = { 387 | isa = XCConfigurationList; 388 | buildConfigurations = ( 389 | B65D1A781F21400C00972655 /* Debug */, 390 | B65D1A791F21400C00972655 /* Release */, 391 | ); 392 | defaultConfigurationIsVisible = 0; 393 | defaultConfigurationName = Release; 394 | }; 395 | /* End XCConfigurationList section */ 396 | }; 397 | rootObject = B65D1A5D1F21400C00972655 /* Project object */; 398 | } 399 | --------------------------------------------------------------------------------