Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Meder committed Oct 24, 2015
1 parent af8aa54 commit e758a52
Show file tree
Hide file tree
Showing 21 changed files with 1,758 additions and 7 deletions.
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# OS X
.DS_Store

# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
profile
*.moved-aside
DerivedData
*.hmap
*.ipa

# Bundler
.bundle

Carthage
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# Note: if you ignore the Pods directory, make sure to uncomment
# `pod install` in .travis.yml
#
Pods/
33 changes: 33 additions & 0 deletions DarkLightning.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Pod::Spec.new do |s|
s.name = "DarkLightning"
s.version = "0.1.0"
s.summary = "Simply the fastest way to transmit data between iOS and OSX"
s.description = <<-DESC
DarkLightning is a lightweight Objective-C library to allow data transmission between iOS devices (Lightning port or Dock connector) and OSX (USB) at 480MBit.
DESC

s.homepage = "https://github.com/jensmeder/DarkLightning"
s.license = 'MIT'
s.author = { "Jens Meder" => "[email protected]" }
s.source = { :git => "https://github.com/jensmeder/DarkLightning.git", :tag => s.version.to_s }

s.requires_arc = true
s.platform = :osx, '10.10'
s.platform = :ios, '8.0'

s.subspec "OSX" do |sp|

sp.source_files = 'Pod/OSX/**/*'
sp.platform = :osx, '10.9'
sp.private_header_files = "Pod/OSX/Internal/**/*.h"

end

s.subspec "iOS" do |sp|

sp.source_files = 'Pod/iOS/**/*'
sp.platform = :ios, '8.0'

end

end
11 changes: 4 additions & 7 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
The MIT License (MIT)

Copyright (c) 2015 Jens Meder

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -9,14 +7,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Empty file added Pod/OSX/.gitkeep
Empty file.
123 changes: 123 additions & 0 deletions Pod/OSX/Internal/JMUSBChannel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/**
* JMUSBChannel.h
* DarkLightning
*
*
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Jens Meder
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#import <Foundation/Foundation.h>

@class JMUSBChannel;

/**
* These constants indicate the state of a given JMUSBChannel.
*/
typedef NS_ENUM(NSUInteger, JMUSBChannelState)
{
/**
* Indicates that there is no valid connection to the usbmuxd service
*/
JMUSBChannelStateDisconnected = 0,

/**
* Indicates that the channel is attempting to connect to the usbmuxd service
*/
JMUSBChannelStateConnecting,

/**
* Indicates that there is a valid connection to the usxmuxd service.
*/
JMUSBChannelStateConnected
};

@protocol JMUSBChannelDelegate <NSObject>

@optional

/**
* Informs the delegate that the channel has received a new data package.
*
* @param channel The channel that has received the data
* @param data The data that has been received
*/
-(void) channel:(nonnull JMUSBChannel*)channel didReceiveData:(nonnull NSData*)data;

/**
* Informs the delegate that there has been a problem while trying to establish a connection to the usxmuxd service
*
* @param channel The channel that has detected a problem while trying to connect
* @param error An error object providing more information
*/
-(void) channel:(nonnull JMUSBChannel*)channel didFailToOpen:(nonnull NSError *)error;

/**
* Informs the delegate that the state of the channel has changed
*
* @param channel The channel that has changed its state
* @param state The new state of the channel
*/
-(void) channel:(nonnull JMUSBChannel*)channel didChangeState:(JMUSBChannelState)state;

@end

/**
* Represents a communication channel to the usbmuxd service on OSX.
*/
@interface JMUSBChannel : NSObject

@property (nonatomic, weak) id<JMUSBChannelDelegate> delegate;

/**
* The current connection state of the channel.
*/
@property (nonatomic, assign, readonly) JMUSBChannelState connectionState;

///----------------------------
/// @name Connection Management
///----------------------------

/**
* Attempts to open the usb channel.
*/
- (void) open;

/**
* Closes the usb channel.
*/
- (void) close;

///------------------------
/// @name Data Transmission
///------------------------

/**
* Transmits the given data to the usxmuxd service.
*
* @param data The data to be sent to the usxmuxd service
*
* @return YES if the data has been sent successfully, NO otherwise.
*/
- (BOOL) writeData:(nonnull NSData*)data;

@end
Loading

0 comments on commit e758a52

Please sign in to comment.