[Libreoffice-commits] core.git: ios/iosremote
siqi
me at siqi.fr
Wed Jun 5 01:31:10 PDT 2013
ios/iosremote/iosremote/Communication/Client.h | 14 ++--
ios/iosremote/iosremote/Communication/Client.m | 34 +++++++---
ios/iosremote/iosremote/Communication/CommunicationManager.h | 11 +--
ios/iosremote/iosremote/Communication/CommunicationManager.m | 11 +--
ios/iosremote/iosremote/Communication/Receiver.h | 11 +--
ios/iosremote/iosremote/Communication/Receiver.m | 11 +--
ios/iosremote/iosremote/Communication/Server.h | 10 +-
ios/iosremote/iosremote/Communication/Server.m | 10 +-
ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard | 2
ios/iosremote/iosremote/libreoffice_sdremoteAppDelegate.h | 10 +-
ios/iosremote/iosremote/libreoffice_sdremoteAppDelegate.m | 10 +-
ios/iosremote/iosremote/libreoffice_sdremoteViewController.h | 11 +--
ios/iosremote/iosremote/libreoffice_sdremoteViewController.m | 24 ++++---
13 files changed, 99 insertions(+), 70 deletions(-)
New commits:
commit 628065f90a15f8663426de2c2de11bd3fa96d0cd
Author: siqi <me at siqi.fr>
Date: Wed Jun 5 10:29:11 2013 +0200
iPad talks to server! Need to implement receiver and manager now
diff --git a/ios/iosremote/iosremote/Communication/Client.h b/ios/iosremote/iosremote/Communication/Client.h
index 3827b2f..ac98afd 100644
--- a/ios/iosremote/iosremote/Communication/Client.h
+++ b/ios/iosremote/iosremote/Communication/Client.h
@@ -1,10 +1,10 @@
-//
-// Client.h
-//
-//
-// Created by Liu Siqi on 6/3/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
-//
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
#import <Foundation/Foundation.h>
#import "Server.h"
diff --git a/ios/iosremote/iosremote/Communication/Client.m b/ios/iosremote/iosremote/Communication/Client.m
index 5e18e6c..b5e6644 100644
--- a/ios/iosremote/iosremote/Communication/Client.m
+++ b/ios/iosremote/iosremote/Communication/Client.m
@@ -1,10 +1,11 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// Client.m
-// sdremote
-//
-// Created by Liu Siqi on 6/3/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#import "Client.h"
#import "Server.h"
@@ -20,7 +21,7 @@
@property (nonatomic, strong) NSString* mName;
@property uint mPort;
- at property (nonatomic, strong) Server* mServer;
+ at property (nonatomic, weak) Server* mServer;
@property (nonatomic, weak) Receiver* mReceiver;
@property (nonatomic, weak) CommunicationManager* mComManager;
@@ -49,8 +50,9 @@ NSString * const CHARSET = @"UTF-8";
managedBy:(CommunicationManager*)manager
interpretedBy:(Receiver*)receiver
{
- self.mPin = @"";
- self.mName = server.serverName;
+ self.mPin = [NSString stringWithFormat:@"%04d", arc4random() % 9999];
+ NSLog(@"mPin: %@", self.mPin);
+ self.mName = [[UIDevice currentDevice] name];
self.mServer = server;
self.mComManager = manager;
self.mReceiver = receiver;
@@ -83,12 +85,20 @@ NSString * const CHARSET = @"UTF-8";
[self.mOutputStream setDelegate:self];
[self.mOutputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[self.mOutputStream open];
- NSLog(@"Connected");
+
+// NSLog(@"Stream opened %@ %@", @"iPad", self.mPin);
+
+ NSArray *temp = [[NSArray alloc]initWithObjects:@"LO_SERVER_CLIENT_PAIR\n", self.mName, @"\n", self.mPin, @"\n\n", nil];
+
+ NSString *command = [temp componentsJoinedByString:@""];
+
+ [self sendCommand:command];
}
}
- (void) sendCommand:(NSString *)aCommand
{
+ NSLog(@"Sending command %@", aCommand);
// UTF-8 as speficied in specification
NSData * data = [aCommand dataUsingEncoding:NSUTF8StringEncoding];
@@ -98,6 +108,12 @@ NSString * const CHARSET = @"UTF-8";
- (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode {
switch(eventCode) {
+ case NSStreamEventOpenCompleted:
+ NSLog(@"Connection established");
+ break;
+ case NSStreamEventErrorOccurred:
+ NSLog(@"Connection error occured");
+ break;
case NSStreamEventHasBytesAvailable:
{
NSLog(@"NSStreamEventHasBytesAvailable");
diff --git a/ios/iosremote/iosremote/Communication/CommunicationManager.h b/ios/iosremote/iosremote/Communication/CommunicationManager.h
index d649e3c..152c779 100644
--- a/ios/iosremote/iosremote/Communication/CommunicationManager.h
+++ b/ios/iosremote/iosremote/Communication/CommunicationManager.h
@@ -1,10 +1,11 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// CommunicationManager.h
-// sdremote
-//
-// Created by Liu Siqi on 6/3/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#import <Foundation/Foundation.h>
diff --git a/ios/iosremote/iosremote/Communication/CommunicationManager.m b/ios/iosremote/iosremote/Communication/CommunicationManager.m
index c91b2f5..2e18432 100644
--- a/ios/iosremote/iosremote/Communication/CommunicationManager.m
+++ b/ios/iosremote/iosremote/Communication/CommunicationManager.m
@@ -1,10 +1,11 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// CommunicationManager.m
-// sdremote
-//
-// Created by Liu Siqi on 6/3/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#import "CommunicationManager.h"
diff --git a/ios/iosremote/iosremote/Communication/Receiver.h b/ios/iosremote/iosremote/Communication/Receiver.h
index 9889ec7..cf3781b 100644
--- a/ios/iosremote/iosremote/Communication/Receiver.h
+++ b/ios/iosremote/iosremote/Communication/Receiver.h
@@ -1,10 +1,11 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// Receiver.h
-// sdremote
-//
-// Created by Liu Siqi on 6/3/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#import <Foundation/Foundation.h>
diff --git a/ios/iosremote/iosremote/Communication/Receiver.m b/ios/iosremote/iosremote/Communication/Receiver.m
index 30a48c6..bffd302 100644
--- a/ios/iosremote/iosremote/Communication/Receiver.m
+++ b/ios/iosremote/iosremote/Communication/Receiver.m
@@ -1,10 +1,11 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// Receiver.m
-// sdremote
-//
-// Created by Liu Siqi on 6/3/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#import "Receiver.h"
diff --git a/ios/iosremote/iosremote/Communication/Server.h b/ios/iosremote/iosremote/Communication/Server.h
index 1cf483d..ceeff1f 100644
--- a/ios/iosremote/iosremote/Communication/Server.h
+++ b/ios/iosremote/iosremote/Communication/Server.h
@@ -1,10 +1,10 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// Server.h
-// sdremote
-//
-// Created by Liu Siqi on 6/3/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import <Foundation/Foundation.h>
diff --git a/ios/iosremote/iosremote/Communication/Server.m b/ios/iosremote/iosremote/Communication/Server.m
index 8cc7222..08061ff 100644
--- a/ios/iosremote/iosremote/Communication/Server.m
+++ b/ios/iosremote/iosremote/Communication/Server.m
@@ -1,10 +1,10 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// Server.m
-// sdremote
-//
-// Created by Liu Siqi on 6/3/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "Server.h"
diff --git a/ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard b/ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard
index 6206f16..0571d20 100644
--- a/ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard
+++ b/ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard
@@ -12,7 +12,7 @@
<rect key="frame" x="0.0" y="64" width="768" height="960"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="192.168.43.173" borderStyle="roundedRect" minimumFontSize="17" id="9w1-Ym-HcF">
+ <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="172.25.19.11" borderStyle="roundedRect" minimumFontSize="17" id="9w1-Ym-HcF">
<rect key="frame" x="234" y="402" width="301" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
diff --git a/ios/iosremote/iosremote/libreoffice_sdremoteAppDelegate.h b/ios/iosremote/iosremote/libreoffice_sdremoteAppDelegate.h
index 1507d06..9b87a86 100644
--- a/ios/iosremote/iosremote/libreoffice_sdremoteAppDelegate.h
+++ b/ios/iosremote/iosremote/libreoffice_sdremoteAppDelegate.h
@@ -1,10 +1,10 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// libreoffice_sdremoteAppDelegate.h
-// iosremote
-//
-// Created by Liu Siqi on 6/4/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import <UIKit/UIKit.h>
diff --git a/ios/iosremote/iosremote/libreoffice_sdremoteAppDelegate.m b/ios/iosremote/iosremote/libreoffice_sdremoteAppDelegate.m
index eab5461..0123ac6 100644
--- a/ios/iosremote/iosremote/libreoffice_sdremoteAppDelegate.m
+++ b/ios/iosremote/iosremote/libreoffice_sdremoteAppDelegate.m
@@ -1,10 +1,10 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// libreoffice_sdremoteAppDelegate.m
-// iosremote
-//
-// Created by Liu Siqi on 6/4/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "libreoffice_sdremoteAppDelegate.h"
diff --git a/ios/iosremote/iosremote/libreoffice_sdremoteViewController.h b/ios/iosremote/iosremote/libreoffice_sdremoteViewController.h
index fdeaf69..077b1b3 100644
--- a/ios/iosremote/iosremote/libreoffice_sdremoteViewController.h
+++ b/ios/iosremote/iosremote/libreoffice_sdremoteViewController.h
@@ -1,10 +1,11 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// libreoffice_sdremoteViewController.h
-// iosremote
-//
-// Created by Liu Siqi on 6/4/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#import <UIKit/UIKit.h>
diff --git a/ios/iosremote/iosremote/libreoffice_sdremoteViewController.m b/ios/iosremote/iosremote/libreoffice_sdremoteViewController.m
index 823c703..504b976 100644
--- a/ios/iosremote/iosremote/libreoffice_sdremoteViewController.m
+++ b/ios/iosremote/iosremote/libreoffice_sdremoteViewController.m
@@ -1,10 +1,11 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// libreoffice_sdremoteViewController.m
-// iosremote
-//
-// Created by Liu Siqi on 6/4/13.
-// Copyright (c) 2013 libreoffice. All rights reserved.
+// This file is part of the LibreOffice project.
//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
#import "libreoffice_sdremoteViewController.h"
#import "Server.h"
@@ -12,10 +13,17 @@
@interface libreoffice_sdremoteViewController ()
+// For debug use, will use a manager to manage server and client instead
+ at property (nonatomic, strong) Server* server;
+ at property (nonatomic, strong) Client* client;
+
@end
@implementation libreoffice_sdremoteViewController
+ at synthesize server = _server;
+ at synthesize client = _client;
+
- (void)viewDidLoad
{
[super viewDidLoad];
@@ -31,9 +39,9 @@
- (IBAction)connectToServer:(id)sender {
NSString * address = [self.ipAddressTextEdit text];
- Server * server = [[Server alloc] initWithProtocol:NETWORK atAddress:address ofName:@"Server"];
- Client * client = [[Client alloc] initWithServer:server managedBy:nil interpretedBy:nil];
- [client connect];
+ self.server = [[Server alloc] initWithProtocol:NETWORK atAddress:address ofName:@"Server"];
+ self.client = [[Client alloc] initWithServer:self.server managedBy:nil interpretedBy:nil];
+ [self.client connect];
}
More information about the Libreoffice-commits
mailing list