diff options
author | siqi <me@siqi.fr> | 2013-06-09 12:09:48 +0200 |
---|---|---|
committer | siqi <me@siqi.fr> | 2013-06-09 12:09:48 +0200 |
commit | fce81f66c60769137fdaa1fbeddb218507cacff0 (patch) | |
tree | 171de2181e6d4a10966e6bc7b8bee5932471fe7d /ios | |
parent | 28faf7e3a91caab172bbd344bb568db4f66a433a (diff) |
Transmitter
Diffstat (limited to 'ios')
6 files changed, 128 insertions, 1 deletions
diff --git a/ios/iosremote/iosremote.xcodeproj/project.pbxproj b/ios/iosremote/iosremote.xcodeproj/project.pbxproj index 9642a8511c9c..78103fae4daa 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 5cd0a42535e8..94fe6c70749c 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 779e2f6359a4..05708e1553c9 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 000000000000..05ddc241d10e --- /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" + +@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; + +@end diff --git a/ios/iosremote/iosremote/Communication/CommandTransmitter.m b/ios/iosremote/iosremote/Communication/CommandTransmitter.m new file mode 100644 index 000000000000..43c1361b2bfa --- /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" + +@interface CommandTransmitter() + +@property (nonatomic, weak) Client* client; + +@end + +@implementation CommandTransmitter + +@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"]; +} + +@end diff --git a/ios/iosremote/iosremote/Communication/CommunicationManager.m b/ios/iosremote/iosremote/Communication/CommunicationManager.m index 2e1843226686..d155a4605541 100644 --- a/ios/iosremote/iosremote/Communication/CommunicationManager.m +++ b/ios/iosremote/iosremote/Communication/CommunicationManager.m @@ -9,6 +9,11 @@ #import "CommunicationManager.h" +@interface CommunicationManager() + + +@end + @implementation CommunicationManager @end |