diff options
20 files changed, 426 insertions, 0 deletions
diff --git a/ios/sdremote/sdremote/Client.h b/ios/sdremote/sdremote/Client.h new file mode 100644 index 000000000000..4cb809d988a9 --- /dev/null +++ b/ios/sdremote/sdremote/Client.h @@ -0,0 +1,13 @@ +// +// Client.h +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@interface Client : NSObject + +@end diff --git a/ios/sdremote/sdremote/Client.m b/ios/sdremote/sdremote/Client.m new file mode 100644 index 000000000000..917b35770bbf --- /dev/null +++ b/ios/sdremote/sdremote/Client.m @@ -0,0 +1,13 @@ +// +// Client.m +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import "Client.h" + +@implementation Client + +@end diff --git a/ios/sdremote/sdremote/Communication/Client.h b/ios/sdremote/sdremote/Communication/Client.h new file mode 100644 index 000000000000..03a7a5a5d1ee --- /dev/null +++ b/ios/sdremote/sdremote/Communication/Client.h @@ -0,0 +1,17 @@ +// +// Client.h +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@interface Client : NSObject <NSStreamDelegate> + + ++(void) connect; + + +@end
\ No newline at end of file diff --git a/ios/sdremote/sdremote/Communication/Client.m b/ios/sdremote/sdremote/Communication/Client.m new file mode 100644 index 000000000000..386b7a61d77f --- /dev/null +++ b/ios/sdremote/sdremote/Communication/Client.m @@ -0,0 +1,90 @@ +// +// Client.m +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import "Client.h" +#import "Server.h" +#import "Receiver.h" +#import "CommunicationManager.h" + +@interface Client() + +@property (nonatomic, strong) NSInputStream* mInputStream; +@property (nonatomic, strong) NSOutputStream* mOutputStream; + +@property (nonatomic, strong) NSString* mPin; +@property (nonatomic, strong) NSString* mName; +@property int mPort; + +@property (nonatomic, weak) Server* mServer; +@property (nonatomic, weak) Receiver* mReceiver; +@property (nonatomic, weak) CommunicationManager* mComManager; + +@end + + + +@implementation Client + +@synthesize mInputStream = _mInputStream; +@synthesize mOutputStream = _mOutputStream; +@synthesize mPin = _mPin; +@synthesize mName = _mName; +@synthesize mServer = _mServer; +@synthesize mComManager = _mComManager; + +NSString * const CHARSET = @"UTF-8"; + +- (id) initWithServer:(Server*)server + managedBy:(CommunicationManager*)manager + interpretedBy:(Receiver*)receiver +{ + self.mPin = @""; + self.mName = server.serverName; + self.mComManager = manager; + self.mReceiver = receiver; + // hardcoded here to test the communication TODO + self.mPort = 1599; + + return self; +} + +- (void)streamOpenWithIp:(NSString *)ip withPortNumber:(int)portNumber +{ + CFReadStreamRef readStream; + CFWriteStreamRef writeStream; + CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, (__bridge CFStringRef)ip, portNumber, &readStream, &writeStream); + + if(readStream && writeStream) + { + CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); + CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); + + //Setup mInputStream + self.mInputStream = (__bridge NSInputStream *)readStream; + [self.mInputStream setDelegate:self]; + [self.mInputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; + [self.mInputStream open]; + + //Setup outputstream + self.mOutputStream = (__bridge NSOutputStream *)writeStream; + [self.mOutputStream setDelegate:self]; + [self.mOutputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; + [self.mOutputStream open]; + } +} + + +- (void) connect +{ + [self streamOpenWithIp:self.mServer.serverAddress withPortNumber:self.mPort]; + +} + + + +@end diff --git a/ios/sdremote/sdremote/Communication/CommunicationManager.h b/ios/sdremote/sdremote/Communication/CommunicationManager.h new file mode 100644 index 000000000000..d649e3c55beb --- /dev/null +++ b/ios/sdremote/sdremote/Communication/CommunicationManager.h @@ -0,0 +1,13 @@ +// +// CommunicationManager.h +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@interface CommunicationManager : NSObject + +@end diff --git a/ios/sdremote/sdremote/Communication/CommunicationManager.m b/ios/sdremote/sdremote/Communication/CommunicationManager.m new file mode 100644 index 000000000000..c91b2f5e2ae6 --- /dev/null +++ b/ios/sdremote/sdremote/Communication/CommunicationManager.m @@ -0,0 +1,13 @@ +// +// CommunicationManager.m +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import "CommunicationManager.h" + +@implementation CommunicationManager + +@end diff --git a/ios/sdremote/sdremote/Communication/Receiver.h b/ios/sdremote/sdremote/Communication/Receiver.h new file mode 100644 index 000000000000..9889ec749577 --- /dev/null +++ b/ios/sdremote/sdremote/Communication/Receiver.h @@ -0,0 +1,13 @@ +// +// Receiver.h +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@interface Receiver : NSObject + +@end diff --git a/ios/sdremote/sdremote/Communication/Receiver.m b/ios/sdremote/sdremote/Communication/Receiver.m new file mode 100644 index 000000000000..30a48c675d68 --- /dev/null +++ b/ios/sdremote/sdremote/Communication/Receiver.m @@ -0,0 +1,13 @@ +// +// Receiver.m +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import "Receiver.h" + +@implementation Receiver + +@end diff --git a/ios/sdremote/sdremote/Communication/Server.h b/ios/sdremote/sdremote/Communication/Server.h new file mode 100644 index 000000000000..2cf720e5fba2 --- /dev/null +++ b/ios/sdremote/sdremote/Communication/Server.h @@ -0,0 +1,19 @@ +// +// Server.h +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import <Foundation/Foundation.h> + +typedef enum protocol {NETWORK} Protocol_t; + +@interface Server : NSObject + +@property (nonatomic) Protocol_t protocol; +@property (nonatomic, strong) NSString* serverName; +@property (nonatomic, strong) NSString* serverAddress; + +@end diff --git a/ios/sdremote/sdremote/Communication/Server.m b/ios/sdremote/sdremote/Communication/Server.m new file mode 100644 index 000000000000..d7bf1adcf00c --- /dev/null +++ b/ios/sdremote/sdremote/Communication/Server.m @@ -0,0 +1,36 @@ +// +// Server.m +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import "Server.h" + +@interface Server() + +@end + +@implementation Server + +@synthesize protocol = _protocol; +@synthesize serverName = _serverName; +@synthesize serverAddress = _serverAddress; + +- (id)initWithProtocol:(Protocol_t)protocal + atAddress:(NSString*) address + ofName:(NSString*) name +{ + self = [self init]; + self.protocol = protocal; + self.serverAddress = address; + self.serverName = name; + return self; +} + +- (NSString *)description{ + return [NSString stringWithFormat:@"Server: Name:%@ Addr:%@", self.serverName, self.serverAddress]; +} + +@end diff --git a/ios/sdremote/sdremote/Default-568h@2x.png b/ios/sdremote/sdremote/Default-568h@2x.png Binary files differnew file mode 100644 index 000000000000..0891b7aabfcf --- /dev/null +++ b/ios/sdremote/sdremote/Default-568h@2x.png diff --git a/ios/sdremote/sdremote/Default.png b/ios/sdremote/sdremote/Default.png Binary files differnew file mode 100644 index 000000000000..4c8ca6f693f9 --- /dev/null +++ b/ios/sdremote/sdremote/Default.png diff --git a/ios/sdremote/sdremote/Default@2x.png b/ios/sdremote/sdremote/Default@2x.png Binary files differnew file mode 100644 index 000000000000..35b84cffeb4d --- /dev/null +++ b/ios/sdremote/sdremote/Default@2x.png diff --git a/ios/sdremote/sdremote/libreoffice_sdremoteAppDelegate.h b/ios/sdremote/sdremote/libreoffice_sdremoteAppDelegate.h new file mode 100644 index 000000000000..2d168765671d --- /dev/null +++ b/ios/sdremote/sdremote/libreoffice_sdremoteAppDelegate.h @@ -0,0 +1,15 @@ +// +// libreoffice_sdremoteAppDelegate.h +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface libreoffice_sdremoteAppDelegate : UIResponder <UIApplicationDelegate> + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/ios/sdremote/sdremote/libreoffice_sdremoteAppDelegate.m b/ios/sdremote/sdremote/libreoffice_sdremoteAppDelegate.m new file mode 100644 index 000000000000..2e13f912e51c --- /dev/null +++ b/ios/sdremote/sdremote/libreoffice_sdremoteAppDelegate.m @@ -0,0 +1,46 @@ +// +// libreoffice_sdremoteAppDelegate.m +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import "libreoffice_sdremoteAppDelegate.h" + +@implementation libreoffice_sdremoteAppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application +{ + // 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. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + // 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. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + // 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. +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/ios/sdremote/sdremote/libreoffice_sdremoteViewController.h b/ios/sdremote/sdremote/libreoffice_sdremoteViewController.h new file mode 100644 index 000000000000..2e56b7adcae0 --- /dev/null +++ b/ios/sdremote/sdremote/libreoffice_sdremoteViewController.h @@ -0,0 +1,13 @@ +// +// libreoffice_sdremoteViewController.h +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface libreoffice_sdremoteViewController : UIViewController + +@end diff --git a/ios/sdremote/sdremote/libreoffice_sdremoteViewController.m b/ios/sdremote/sdremote/libreoffice_sdremoteViewController.m new file mode 100644 index 000000000000..a955d8da1cb6 --- /dev/null +++ b/ios/sdremote/sdremote/libreoffice_sdremoteViewController.m @@ -0,0 +1,31 @@ +// +// libreoffice_sdremoteViewController.m +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import "libreoffice_sdremoteViewController.h" + +@interface libreoffice_sdremoteViewController () + +@end + +@implementation libreoffice_sdremoteViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/ios/sdremote/sdremote/main.m b/ios/sdremote/sdremote/main.m new file mode 100644 index 000000000000..33135deeab02 --- /dev/null +++ b/ios/sdremote/sdremote/main.m @@ -0,0 +1,18 @@ +// +// main.m +// sdremote +// +// Created by Liu Siqi on 6/3/13. +// Copyright (c) 2013 libreoffice. All rights reserved. +// + +#import <UIKit/UIKit.h> + +#import "libreoffice_sdremoteAppDelegate.h" + +int main(int argc, char *argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([libreoffice_sdremoteAppDelegate class])); + } +} diff --git a/ios/sdremote/sdremote/sdremote-Info.plist b/ios/sdremote/sdremote/sdremote-Info.plist new file mode 100644 index 000000000000..f2b1ca676dd1 --- /dev/null +++ b/ios/sdremote/sdremote/sdremote-Info.plist @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleDisplayName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIdentifier</key> + <string>org.libreoffice.${PRODUCT_NAME:rfc1034identifier}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>UIMainStoryboardFile</key> + <string>MainStoryboard_iPhone</string> + <key>UIMainStoryboardFile~ipad</key> + <string>MainStoryboard_iPad</string> + <key>UIRequiredDeviceCapabilities</key> + <array> + <string>armv7</string> + </array> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> +</dict> +</plist> diff --git a/ios/sdremote/sdremote/sdremote-Prefix.pch b/ios/sdremote/sdremote/sdremote-Prefix.pch new file mode 100644 index 000000000000..5f37a4d23f23 --- /dev/null +++ b/ios/sdremote/sdremote/sdremote-Prefix.pch @@ -0,0 +1,14 @@ +// +// Prefix header for all source files of the 'sdremote' target in the 'sdremote' project +// + +#import <Availability.h> + +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ + #import <UIKit/UIKit.h> + #import <Foundation/Foundation.h> +#endif |