[Libreoffice-commits] core.git: ios/iosremote

siqi me at siqi.fr
Sun Jun 9 03:10:14 PDT 2013


 ios/iosremote/iosremote.xcodeproj/project.pbxproj            |    6 
 ios/iosremote/iosremote/Communication/Client.h               |    2 
 ios/iosremote/iosremote/Communication/CommandInterpreter.m   |    1 
 ios/iosremote/iosremote/Communication/CommandTransmitter.h   |   28 +++
 ios/iosremote/iosremote/Communication/CommandTransmitter.m   |   87 +++++++++++
 ios/iosremote/iosremote/Communication/CommunicationManager.m |    5 
 6 files changed, 128 insertions(+), 1 deletion(-)

New commits:
commit fce81f66c60769137fdaa1fbeddb218507cacff0
Author: siqi <me at siqi.fr>
Date:   Sun Jun 9 12:09:48 2013 +0200

    Transmitter

diff --git a/ios/iosremote/iosremote.xcodeproj/project.pbxproj b/ios/iosremote/iosremote.xcodeproj/project.pbxproj
index 9642a85..78103fa 100644
--- a/ios/iosremote/iosremote.xcodeproj/project.pbxproj
+++ b/ios/iosremote/iosremote.xcodeproj/project.pbxproj
@@ -9,6 +9,7 @@
 /* Begin PBXBuildFile section */
 		57B152991764703500EECC67 /* Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 57B152981764703500EECC67 /* Base64.m */; };
 		57B1529C1764714900EECC67 /* slideShowViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 57B1529B1764714900EECC67 /* slideShowViewController.m */; };
+		57B1529F176486C300EECC67 /* CommandTransmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 57B1529E176486C300EECC67 /* CommandTransmitter.m */; };
 		57B7625D17621E42007703F6 /* SlideShow.m in Sources */ = {isa = PBXBuildFile; fileRef = 57B7625C17621E42007703F6 /* SlideShow.m */; };
 		57C6E3F3175E06E800E8BC5F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57C6E3F2175E06E800E8BC5F /* UIKit.framework */; };
 		57C6E3F5175E06E800E8BC5F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57C6E3F4175E06E800E8BC5F /* Foundation.framework */; };
@@ -33,6 +34,8 @@
 		57B152981764703500EECC67 /* Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Base64.m; path = iosremote/Base64.m; sourceTree = "<group>"; };
 		57B1529A1764714900EECC67 /* slideShowViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slideShowViewController.h; sourceTree = "<group>"; };
 		57B1529B1764714900EECC67 /* slideShowViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = slideShowViewController.m; sourceTree = "<group>"; };
+		57B1529D176486C300EECC67 /* CommandTransmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommandTransmitter.h; sourceTree = "<group>"; };
+		57B1529E176486C300EECC67 /* CommandTransmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommandTransmitter.m; sourceTree = "<group>"; };
 		57B7625B17621E42007703F6 /* SlideShow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlideShow.h; sourceTree = "<group>"; };
 		57B7625C17621E42007703F6 /* SlideShow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SlideShow.m; sourceTree = "<group>"; };
 		57C6E3EF175E06E800E8BC5F /* iosremote.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iosremote.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -149,6 +152,8 @@
 				57C6E42D175E076900E8BC5F /* Server.m */,
 				57B7625B17621E42007703F6 /* SlideShow.h */,
 				57B7625C17621E42007703F6 /* SlideShow.m */,
+				57B1529D176486C300EECC67 /* CommandTransmitter.h */,
+				57B1529E176486C300EECC67 /* CommandTransmitter.m */,
 			);
 			name = Communication;
 			path = iosremote/Communication;
@@ -232,6 +237,7 @@
 				57B7625D17621E42007703F6 /* SlideShow.m in Sources */,
 				57B152991764703500EECC67 /* Base64.m in Sources */,
 				57B1529C1764714900EECC67 /* slideShowViewController.m in Sources */,
+				57B1529F176486C300EECC67 /* CommandTransmitter.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/ios/iosremote/iosremote/Communication/Client.h b/ios/iosremote/iosremote/Communication/Client.h
index 5cd0a42..94fe6c7 100644
--- a/ios/iosremote/iosremote/Communication/Client.h
+++ b/ios/iosremote/iosremote/Communication/Client.h
@@ -23,6 +23,8 @@
             managedBy:(CommunicationManager*)manager
         interpretedBy:(CommandInterpreter*)receiver;
 
+- (void) sendCommand:(NSString *)aCommand;
+
 -(void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode;
 
 @end
\ No newline at end of file
diff --git a/ios/iosremote/iosremote/Communication/CommandInterpreter.m b/ios/iosremote/iosremote/Communication/CommandInterpreter.m
index 779e2f6..05708e1 100644
--- a/ios/iosremote/iosremote/Communication/CommandInterpreter.m
+++ b/ios/iosremote/iosremote/Communication/CommandInterpreter.m
@@ -41,7 +41,6 @@
         NSLog(@"Interpreter: slideshow_started");
         uint slideLength = [[command objectAtIndex:1] integerValue];
         uint currentSlide = [[command objectAtIndex:2] integerValue];
-        NSLog(@"Interpreter: with slideLength %u, currentSlide %u", slideLength, currentSlide);
         self.slideShow = [[SlideShow alloc] init];
         
         [self.slideShow setSize:slideLength];
diff --git a/ios/iosremote/iosremote/Communication/CommandTransmitter.h b/ios/iosremote/iosremote/Communication/CommandTransmitter.h
new file mode 100644
index 0000000..05ddc24
--- /dev/null
+++ b/ios/iosremote/iosremote/Communication/CommandTransmitter.h
@@ -0,0 +1,28 @@
+//
+//  CommandTransmitter.h
+//  iosremote
+//
+//  Created by Liu Siqi on 6/9/13.
+//  Copyright (c) 2013 libreoffice. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "Client.h"
+
+ at interface CommandTransmitter : NSObject
+
+- (CommandTransmitter*) initWithClient:(Client *)client;
+
+- (void) nextTransition;
+- (void) previousTransition;
+
+- (void) gotoSlide:(uint) slide;
+
+- (void) blankScreen;
+- (void) blankScreenWithColor:(UIColor*)color;
+- (void) resume;
+
+- (void) startPresentation;
+- (void) stopPresentation;
+
+ at end
diff --git a/ios/iosremote/iosremote/Communication/CommandTransmitter.m b/ios/iosremote/iosremote/Communication/CommandTransmitter.m
new file mode 100644
index 0000000..43c1361
--- /dev/null
+++ b/ios/iosremote/iosremote/Communication/CommandTransmitter.m
@@ -0,0 +1,87 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 "CommandTransmitter.h"
+#import "Client.h"
+
+ at interface CommandTransmitter()
+
+ at property (nonatomic, weak) Client* client;
+
+ at end
+
+ at implementation CommandTransmitter
+
+ at synthesize client = _client;
+
+- (CommandTransmitter*) initWithClient:(Client *)client
+{
+    self = [self init];
+    self.client = client;
+    return self;
+}
+
+- (void) nextTransition
+{
+    [self.client sendCommand:@"transition_next\n\n"];
+}
+
+- (void) previousTransition
+{
+    [self.client sendCommand:@"transition_previous\n\n"];
+}
+
+- (void) gotoSlide:(uint) slide
+{
+    [self.client sendCommand:[NSString stringWithFormat:@"goto_slide\n%u\n\n", slide]];
+}
+
+
+/**
+ * Blank the screen to the default colour (set server-side), which is
+ * generally black. This is slightly faster than using
+ * <code> blankScreen( colour ) </code>.
+ */
+- (void) blankScreen
+{
+    [self.client sendCommand:@"presentation_blank_screen\n\n"];
+}
+
+
+/**
+ * Set the screen to a specific colour. Only use if a non default colour is
+ * needed.
+ *
+ * @param aColor
+ */
+- (void) blankScreenWithColor:(UIColor*)color
+{
+    CGColorRef colorRef = color.CGColor;
+    NSString *colorString = [CIColor colorWithCGColor:colorRef].stringRepresentation;
+    
+    // Need new server-end interface, since this is a platform dependent representation
+    [self.client sendCommand:[NSString stringWithFormat:@"presentation_blank_screen\n%@\n\n", colorString]];
+}
+
+- (void) resume
+{
+    [self.client sendCommand:@"presentation_resume\n\n"];
+}
+
+- (void) startPresentation
+{
+    [self.client sendCommand:@"presentation_start\n\n"];
+}
+
+- (void) stopPresentation
+{
+    [self.client sendCommand:@"presentation_stop\n\n"];
+}
+
+ at end
diff --git a/ios/iosremote/iosremote/Communication/CommunicationManager.m b/ios/iosremote/iosremote/Communication/CommunicationManager.m
index 2e18432..d155a46 100644
--- a/ios/iosremote/iosremote/Communication/CommunicationManager.m
+++ b/ios/iosremote/iosremote/Communication/CommunicationManager.m
@@ -9,6 +9,11 @@
 
 #import "CommunicationManager.h"
 
+ at interface CommunicationManager()
+
+
+ at end
+
 @implementation CommunicationManager
 
 @end


More information about the Libreoffice-commits mailing list