Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
28faf7e3
Kaydet (Commit)
28faf7e3
authored
Haz 09, 2013
tarafından
siqi
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Command interpreter works, notification center can now call segua for view transition
üst
52a37758
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
244 additions
and
97 deletions
+244
-97
project.pbxproj
ios/iosremote/iosremote.xcodeproj/project.pbxproj
+12
-4
Base64.m
ios/iosremote/iosremote/Base64.m
+2
-2
Client.h
ios/iosremote/iosremote/Communication/Client.h
+3
-3
Client.m
ios/iosremote/iosremote/Communication/Client.m
+51
-45
CommandInterpreter.h
ios/iosremote/iosremote/Communication/CommandInterpreter.h
+1
-1
CommandInterpreter.m
ios/iosremote/iosremote/Communication/CommandInterpreter.m
+30
-19
SlideShow.h
ios/iosremote/iosremote/Communication/SlideShow.h
+10
-10
SlideShow.m
ios/iosremote/iosremote/Communication/SlideShow.m
+33
-9
MainStoryboard_iPad.storyboard
...sremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard
+27
-1
libreoffice_sdremoteViewController.m
ios/iosremote/iosremote/libreoffice_sdremoteViewController.m
+18
-3
slideShowViewController.h
ios/iosremote/iosremote/slideShowViewController.h
+15
-0
slideShowViewController.m
ios/iosremote/iosremote/slideShowViewController.m
+42
-0
No files found.
ios/iosremote/iosremote.xcodeproj/project.pbxproj
Dosyayı görüntüle @
28faf7e3
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
objects
=
{
objects
=
{
/* Begin PBXBuildFile section */
/* 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 */
;
};
57B7625D17621E42007703F6
/* SlideShow.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
57B7625C17621E42007703F6
/* SlideShow.m */
;
};
57B7625D17621E42007703F6
/* SlideShow.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
57B7625C17621E42007703F6
/* SlideShow.m */
;
};
57C6E3F3175E06E800E8BC5F
/* UIKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
57C6E3F2175E06E800E8BC5F
/* UIKit.framework */
;
};
57C6E3F3175E06E800E8BC5F
/* UIKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
57C6E3F2175E06E800E8BC5F
/* UIKit.framework */
;
};
57C6E3F5175E06E800E8BC5F
/* Foundation.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
57C6E3F4175E06E800E8BC5F
/* Foundation.framework */
;
};
57C6E3F5175E06E800E8BC5F
/* Foundation.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
57C6E3F4175E06E800E8BC5F
/* Foundation.framework */
;
};
...
@@ -27,10 +29,12 @@
...
@@ -27,10 +29,12 @@
/* End PBXBuildFile section */
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
57B152971764703500EECC67
/* Base64.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
Base64.h
;
path
=
iosremote/Base64.h
;
sourceTree
=
"<group>"
;
};
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>"
;
};
57B7625B17621E42007703F6
/* SlideShow.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
SlideShow.h
;
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>"
;
};
57B7625C17621E42007703F6
/* SlideShow.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
SlideShow.m
;
sourceTree
=
"<group>"
;
};
57B7625E1762368F007703F6
/* Base64.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
Base64.h
;
path
=
../Base64.h
;
sourceTree
=
"<group>"
;
};
57B7625F1762368F007703F6
/* Base64.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
Base64.m
;
path
=
../Base64.m
;
sourceTree
=
"<group>"
;
};
57C6E3EF175E06E800E8BC5F
/* iosremote.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
iosremote.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
57C6E3EF175E06E800E8BC5F
/* iosremote.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
iosremote.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
57C6E3F2175E06E800E8BC5F
/* UIKit.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
UIKit.framework
;
path
=
System/Library/Frameworks/UIKit.framework
;
sourceTree
=
SDKROOT
;
};
57C6E3F2175E06E800E8BC5F
/* UIKit.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
UIKit.framework
;
path
=
System/Library/Frameworks/UIKit.framework
;
sourceTree
=
SDKROOT
;
};
57C6E3F4175E06E800E8BC5F
/* Foundation.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
Foundation.framework
;
path
=
System/Library/Frameworks/Foundation.framework
;
sourceTree
=
SDKROOT
;
};
57C6E3F4175E06E800E8BC5F
/* Foundation.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
Foundation.framework
;
path
=
System/Library/Frameworks/Foundation.framework
;
sourceTree
=
SDKROOT
;
};
...
@@ -75,6 +79,8 @@
...
@@ -75,6 +79,8 @@
57C6E3E6175E06E800E8BC5F
=
{
57C6E3E6175E06E800E8BC5F
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
57B152971764703500EECC67
/* Base64.h */
,
57B152981764703500EECC67
/* Base64.m */
,
57C6E425175E076900E8BC5F
/* Communication */
,
57C6E425175E076900E8BC5F
/* Communication */
,
57C6E3F8175E06E800E8BC5F
/* iosremote */
,
57C6E3F8175E06E800E8BC5F
/* iosremote */
,
57C6E3F1175E06E800E8BC5F
/* Frameworks */
,
57C6E3F1175E06E800E8BC5F
/* Frameworks */
,
...
@@ -110,6 +116,8 @@
...
@@ -110,6 +116,8 @@
57C6E410175E06E800E8BC5F
/* libreoffice_sdremoteViewController.h */
,
57C6E410175E06E800E8BC5F
/* libreoffice_sdremoteViewController.h */
,
57C6E411175E06E800E8BC5F
/* libreoffice_sdremoteViewController.m */
,
57C6E411175E06E800E8BC5F
/* libreoffice_sdremoteViewController.m */
,
57C6E3F9175E06E800E8BC5F
/* Supporting Files */
,
57C6E3F9175E06E800E8BC5F
/* Supporting Files */
,
57B1529A1764714900EECC67
/* slideShowViewController.h */
,
57B1529B1764714900EECC67
/* slideShowViewController.m */
,
);
);
path
=
iosremote
;
path
=
iosremote
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -131,8 +139,6 @@
...
@@ -131,8 +139,6 @@
57C6E425175E076900E8BC5F
/* Communication */
=
{
57C6E425175E076900E8BC5F
/* Communication */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
57B7625E1762368F007703F6
/* Base64.h */
,
57B7625F1762368F007703F6
/* Base64.m */
,
57C6E426175E076900E8BC5F
/* Client.h */
,
57C6E426175E076900E8BC5F
/* Client.h */
,
57C6E427175E076900E8BC5F
/* Client.m */
,
57C6E427175E076900E8BC5F
/* Client.m */
,
57C6E428175E076900E8BC5F
/* CommunicationManager.h */
,
57C6E428175E076900E8BC5F
/* CommunicationManager.h */
,
...
@@ -224,6 +230,8 @@
...
@@ -224,6 +230,8 @@
57C6E430175E076900E8BC5F
/* CommandInterpreter.m in Sources */
,
57C6E430175E076900E8BC5F
/* CommandInterpreter.m in Sources */
,
57C6E431175E076900E8BC5F
/* Server.m in Sources */
,
57C6E431175E076900E8BC5F
/* Server.m in Sources */
,
57B7625D17621E42007703F6
/* SlideShow.m in Sources */
,
57B7625D17621E42007703F6
/* SlideShow.m in Sources */
,
57B152991764703500EECC67
/* Base64.m in Sources */
,
57B1529C1764714900EECC67
/* slideShowViewController.m in Sources */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
};
};
...
...
ios/iosremote/iosremote/Base64.m
Dosyayı görüntüle @
28faf7e3
...
@@ -46,8 +46,8 @@ static char decodingTable[128];
...
@@ -46,8 +46,8 @@ static char decodingTable[128];
output
[
index
+
3
]
=
(
i
+
2
)
<
length
?
encodingTable
[(
value
>>
0
)
&
0x3F
]
:
'='
;
output
[
index
+
3
]
=
(
i
+
2
)
<
length
?
encodingTable
[(
value
>>
0
)
&
0x3F
]
:
'='
;
}
}
return
[[
[
NSString
alloc
]
initWithData
:
data
return
[[
NSString
alloc
]
initWithData
:
data
encoding
:
NSASCIIStringEncoding
]
autorelease
]
;
encoding
:
NSASCIIStringEncoding
];
}
}
...
...
ios/iosremote/iosremote/Communication/Client.h
Dosyayı görüntüle @
28faf7e3
...
@@ -13,9 +13,9 @@
...
@@ -13,9 +13,9 @@
@interface
Client
:
NSObject
@interface
Client
:
NSObject
@property
BOOL
mR
eady
;
@property
BOOL
r
eady
;
@property
(
nonatomic
,
strong
)
NSNumber
*
mP
in
;
@property
(
nonatomic
,
strong
)
NSNumber
*
p
in
;
@property
(
nonatomic
,
strong
)
NSString
*
mN
ame
;
@property
(
nonatomic
,
strong
)
NSString
*
n
ame
;
-
(
void
)
connect
;
-
(
void
)
connect
;
...
...
ios/iosremote/iosremote/Communication/Client.m
Dosyayı görüntüle @
28faf7e3
...
@@ -12,16 +12,18 @@
...
@@ -12,16 +12,18 @@
#import "CommandInterpreter.h"
#import "CommandInterpreter.h"
#import "CommunicationManager.h"
#import "CommunicationManager.h"
#define CHARSET @"UTF-8"
@interface
Client
()
<
NSStreamDelegate
>
@interface
Client
()
<
NSStreamDelegate
>
@property
(
nonatomic
,
strong
)
NSInputStream
*
mI
nputStream
;
@property
(
nonatomic
,
strong
)
NSInputStream
*
i
nputStream
;
@property
(
nonatomic
,
strong
)
NSOutputStream
*
mO
utputStream
;
@property
(
nonatomic
,
strong
)
NSOutputStream
*
o
utputStream
;
@property
uint
mPort
;
@property
uint
mPort
;
@property
(
nonatomic
,
weak
)
Server
*
mS
erver
;
@property
(
nonatomic
,
weak
)
Server
*
s
erver
;
@property
(
nonatomic
,
weak
)
CommandInterpreter
*
mR
eceiver
;
@property
(
nonatomic
,
weak
)
CommandInterpreter
*
r
eceiver
;
@property
(
nonatomic
,
weak
)
CommunicationManager
*
mC
omManager
;
@property
(
nonatomic
,
weak
)
CommunicationManager
*
c
omManager
;
@end
@end
...
@@ -29,15 +31,14 @@
...
@@ -29,15 +31,14 @@
@implementation
Client
@implementation
Client
@synthesize
mInputStream
=
_mInputStream
;
@synthesize
inputStream
=
_mInputStream
;
@synthesize
mOutputStream
=
_mOutputStream
;
@synthesize
outputStream
=
_mOutputStream
;
@synthesize
mPin
=
_mPin
;
@synthesize
pin
=
_mPin
;
@synthesize
mName
=
_mName
;
@synthesize
name
=
_mName
;
@synthesize
mServer
=
_mServer
;
@synthesize
server
=
_mServer
;
@synthesize
mComManager
=
_mComManager
;
@synthesize
comManager
=
_mComManager
;
@synthesize
mReady
=
_mReady
;
@synthesize
ready
=
_mReady
;
@synthesize
receiver
=
_receiver
;
NSString
*
const
CHARSET
=
@"UTF-8"
;
-
(
id
)
initWithServer
:(
Server
*
)
server
-
(
id
)
initWithServer
:(
Server
*
)
server
managedBy
:(
CommunicationManager
*
)
manager
managedBy
:(
CommunicationManager
*
)
manager
...
@@ -46,12 +47,12 @@ NSString * const CHARSET = @"UTF-8";
...
@@ -46,12 +47,12 @@ NSString * const CHARSET = @"UTF-8";
self
=
[
self
init
];
self
=
[
self
init
];
if
(
self
)
if
(
self
)
{
{
self
.
mR
eady
=
NO
;
self
.
r
eady
=
NO
;
self
.
mN
ame
=
[[
UIDevice
currentDevice
]
name
];
self
.
n
ame
=
[[
UIDevice
currentDevice
]
name
];
self
.
mP
in
=
[
NSNumber
numberWithInteger
:[
self
getPin
]];
self
.
p
in
=
[
NSNumber
numberWithInteger
:[
self
getPin
]];
self
.
mS
erver
=
server
;
self
.
s
erver
=
server
;
self
.
mC
omManager
=
manager
;
self
.
c
omManager
=
manager
;
self
.
mR
eceiver
=
receiver
;
self
.
r
eceiver
=
receiver
;
self
.
mPort
=
1599
;
self
.
mPort
=
1599
;
}
}
return
self
;
return
self
;
...
@@ -64,12 +65,12 @@ NSString * const CHARSET = @"UTF-8";
...
@@ -64,12 +65,12 @@ NSString * const CHARSET = @"UTF-8";
if
(
!
userDefaluts
)
if
(
!
userDefaluts
)
NSLog
(
@"userDefaults nil"
);
NSLog
(
@"userDefaults nil"
);
NSInteger
newPin
=
[
userDefaluts
integerForKey
:
self
.
mN
ame
];
NSInteger
newPin
=
[
userDefaluts
integerForKey
:
self
.
n
ame
];
// If not, generate one.
// If not, generate one.
if
(
!
newPin
)
{
if
(
!
newPin
)
{
newPin
=
arc4random
()
%
9999
;
newPin
=
arc4random
()
%
9999
;
[
userDefaluts
setInteger
:
newPin
forKey
:
self
.
mN
ame
];
[
userDefaluts
setInteger
:
newPin
forKey
:
self
.
n
ame
];
}
}
return
newPin
;
return
newPin
;
...
@@ -88,20 +89,20 @@ NSString * const CHARSET = @"UTF-8";
...
@@ -88,20 +89,20 @@ NSString * const CHARSET = @"UTF-8";
CFWriteStreamSetProperty
(
writeStream
,
kCFStreamPropertyShouldCloseNativeSocket
,
kCFBooleanTrue
);
CFWriteStreamSetProperty
(
writeStream
,
kCFStreamPropertyShouldCloseNativeSocket
,
kCFBooleanTrue
);
//Setup mInputStream
//Setup mInputStream
self
.
mI
nputStream
=
(
__bridge
NSInputStream
*
)
readStream
;
self
.
i
nputStream
=
(
__bridge
NSInputStream
*
)
readStream
;
[
self
.
mI
nputStream
setDelegate
:
self
];
[
self
.
i
nputStream
setDelegate
:
self
];
[
self
.
mI
nputStream
scheduleInRunLoop
:[
NSRunLoop
currentRunLoop
]
forMode
:
NSDefaultRunLoopMode
];
[
self
.
i
nputStream
scheduleInRunLoop
:[
NSRunLoop
currentRunLoop
]
forMode
:
NSDefaultRunLoopMode
];
[
self
.
mI
nputStream
open
];
[
self
.
i
nputStream
open
];
//Setup outputstream
//Setup outputstream
self
.
mO
utputStream
=
(
__bridge
NSOutputStream
*
)
writeStream
;
self
.
o
utputStream
=
(
__bridge
NSOutputStream
*
)
writeStream
;
[
self
.
mO
utputStream
setDelegate
:
self
];
[
self
.
o
utputStream
setDelegate
:
self
];
[
self
.
mO
utputStream
scheduleInRunLoop
:[
NSRunLoop
currentRunLoop
]
forMode
:
NSDefaultRunLoopMode
];
[
self
.
o
utputStream
scheduleInRunLoop
:[
NSRunLoop
currentRunLoop
]
forMode
:
NSDefaultRunLoopMode
];
[
self
.
mO
utputStream
open
];
[
self
.
o
utputStream
open
];
// NSLog(@"Stream opened %@ %@", @"iPad", self.mPin);
// NSLog(@"Stream opened %@ %@", @"iPad", self.mPin);
NSArray
*
temp
=
[[
NSArray
alloc
]
initWithObjects
:
@"LO_SERVER_CLIENT_PAIR
\n
"
,
self
.
mName
,
@"
\n
"
,
self
.
mP
in
,
@"
\n\n
"
,
nil
];
NSArray
*
temp
=
[[
NSArray
alloc
]
initWithObjects
:
@"LO_SERVER_CLIENT_PAIR
\n
"
,
self
.
name
,
@"
\n
"
,
self
.
p
in
,
@"
\n\n
"
,
nil
];
NSString
*
command
=
[
temp
componentsJoinedByString
:
@""
];
NSString
*
command
=
[
temp
componentsJoinedByString
:
@""
];
...
@@ -115,7 +116,7 @@ NSString * const CHARSET = @"UTF-8";
...
@@ -115,7 +116,7 @@ NSString * const CHARSET = @"UTF-8";
// UTF-8 as speficied in specification
// UTF-8 as speficied in specification
NSData
*
data
=
[
aCommand
dataUsingEncoding
:
NSUTF8StringEncoding
];
NSData
*
data
=
[
aCommand
dataUsingEncoding
:
NSUTF8StringEncoding
];
[
self
.
mO
utputStream
write
:(
uint8_t
*
)[
data
bytes
]
maxLength
:[
data
length
]];
[
self
.
o
utputStream
write
:(
uint8_t
*
)[
data
bytes
]
maxLength
:[
data
length
]];
}
}
-
(
void
)
stream
:
(
NSStream
*
)
stream
handleEvent
:
(
NSStreamEvent
)
eventCode
{
-
(
void
)
stream
:
(
NSStream
*
)
stream
handleEvent
:
(
NSStreamEvent
)
eventCode
{
...
@@ -123,7 +124,7 @@ NSString * const CHARSET = @"UTF-8";
...
@@ -123,7 +124,7 @@ NSString * const CHARSET = @"UTF-8";
switch
(
eventCode
)
{
switch
(
eventCode
)
{
case
NSStreamEventOpenCompleted
:
case
NSStreamEventOpenCompleted
:
NSLog
(
@"Connection established"
);
NSLog
(
@"Connection established"
);
self
.
mR
eady
=
YES
;
self
.
r
eady
=
YES
;
break
;
break
;
case
NSStreamEventErrorOccurred
:
case
NSStreamEventErrorOccurred
:
NSLog
(
@"Connection error occured"
);
NSLog
(
@"Connection error occured"
);
...
@@ -133,25 +134,30 @@ NSString * const CHARSET = @"UTF-8";
...
@@ -133,25 +134,30 @@ NSString * const CHARSET = @"UTF-8";
NSMutableData
*
data
;
NSMutableData
*
data
;
NSLog
(
@"NSStreamEventHasBytesAvailable"
);
NSLog
(
@"NSStreamEventHasBytesAvailable"
);
if
(
!
data
)
{
if
(
!
data
)
{
data
=
[
NSMutableData
data
];
data
=
[
[
NSMutableData
alloc
]
init
];
}
}
uint8_t
buf
[
1024
];
uint8_t
buf
[
1024
];
unsigned
int
len
=
0
;
unsigned
int
len
=
0
;
len
=
[(
NSInputStream
*
)
stream
read
:
buf
maxLength
:
1024
];
NSString
*
str
;
if
(
len
)
{
while
(
true
)
{
len
=
[(
NSInputStream
*
)
stream
read
:
buf
maxLength
:
1024
];
[
data
appendBytes
:(
const
void
*
)
buf
length
:
len
];
[
data
appendBytes
:(
const
void
*
)
buf
length
:
len
];
int
bytesRead
=
0
;
if
(
len
<
1024
)
{
// bytesRead is an instance variable of type NSNumber.
// Potentially the end of a command
bytesRead
+=
len
;
str
=
[[
NSString
alloc
]
initWithData
:
data
encoding
:
NSUTF8StringEncoding
];
}
else
{
if
([
str
hasSuffix
:
@"
\n\n
"
])
{
NSLog
(
@"No data but received event for whatever reasons!"
);
// Finished current command
break
;
}
}
}
}
NSString
*
str
=
[[
NSString
alloc
]
initWithData
:
data
NSArray
*
commands
=
[
str
componentsSeparatedByString
:
@"
\n
"
];
encoding
:
NSUTF8StringEncoding
];
// NSLog(@"Data Received: %@", commands);
NSLog
(
@"Data Received: %@"
,
str
);
[
self
.
receiver
parse
:
commands
];
data
=
nil
;
data
=
nil
;
str
=
nil
;
}
break
;
}
break
;
default
:
default
:
{
{
...
@@ -164,7 +170,7 @@ NSString * const CHARSET = @"UTF-8";
...
@@ -164,7 +170,7 @@ NSString * const CHARSET = @"UTF-8";
-
(
void
)
connect
-
(
void
)
connect
{
{
[
self
streamOpenWithIp
:
self
.
mS
erver
.
serverAddress
withPortNumber
:
self
.
mPort
];
[
self
streamOpenWithIp
:
self
.
s
erver
.
serverAddress
withPortNumber
:
self
.
mPort
];
}
}
...
...
ios/iosremote/iosremote/Communication/CommandInterpreter.h
Dosyayı görüntüle @
28faf7e3
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
@interface
CommandInterpreter
:
NSObject
@interface
CommandInterpreter
:
NSObject
@property
(
nonatomic
,
strong
)
SlideShow
*
mS
lideShow
;
@property
(
nonatomic
,
strong
)
SlideShow
*
s
lideShow
;
-
(
void
)
parse
:(
NSArray
*
)
cmd
;
-
(
void
)
parse
:(
NSArray
*
)
cmd
;
...
...
ios/iosremote/iosremote/Communication/CommandInterpreter.m
Dosyayı görüntüle @
28faf7e3
...
@@ -18,10 +18,16 @@
...
@@ -18,10 +18,16 @@
@implementation
CommandInterpreter
@implementation
CommandInterpreter
@synthesize
mSlideShow
=
_mSlideShow
;
@synthesize
slideShow
=
_slideShow
;
-
(
SlideShow
*
)
slideshow
{
if
(
!
self
.
slideShow
)
self
.
slideShow
=
[[
SlideShow
alloc
]
init
];
return
self
.
slideShow
;
}
-
(
BOOL
)
isSlideRunning
{
-
(
BOOL
)
isSlideRunning
{
return
[
self
.
mS
lideShow
size
]
>
0
;
return
[
self
.
s
lideShow
size
]
>
0
;
}
}
// Received a set of instructions from server.
// Received a set of instructions from server.
...
@@ -32,45 +38,50 @@
...
@@ -32,45 +38,50 @@
NSString
*
instruction
=
[
command
objectAtIndex
:
0
];
NSString
*
instruction
=
[
command
objectAtIndex
:
0
];
if
([
instruction
isEqualToString
:
@"slideshow_started"
]){
if
([
instruction
isEqualToString
:
@"slideshow_started"
]){
unsigned
int
slideLength
=
[[
command
objectAtIndex
:
1
]
unsignedIntValue
];
NSLog
(
@"Interpreter: slideshow_started"
);
unsigned
int
currentSlide
=
[[
command
objectAtIndex
:
2
]
unsignedIntValue
];
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
.
mSlideShow
setLength
:
slideLength
];
[
self
.
slideShow
setSize
:
slideLength
];
[
self
.
mS
lideShow
setCurrentSlide
:
currentSlide
];
[
self
.
s
lideShow
setCurrentSlide
:
currentSlide
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
STATUS_CONNECTED_
NOSLIDESHOW
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
STATUS_CONNECTED_
SLIDESHOW_RUNNING
object
:
nil
];
object
:
nil
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
MSG_SLIDE_CHANGED
object
:
self
.
mSlideShow
.
mCurrentSlide
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
MSG_SLIDE_CHANGED
object
:
[
NSNumber
numberWithUnsignedInt
:
currentSlide
]
];
}
else
if
([
instruction
isEqualToString
:
@"slideshow_finished"
]){
}
else
if
([
instruction
isEqualToString
:
@"slideshow_finished"
]){
self
.
mSlideShow
=
[
SlideShow
init
];
NSLog
(
@"Interpreter: slideshow_started"
);
self
.
slideShow
=
[[
SlideShow
alloc
]
init
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
STATUS_CONNECTED_NOSLIDESHOW
object
:
nil
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
STATUS_CONNECTED_NOSLIDESHOW
object
:
nil
];
}
else
{
}
else
{
if
(
self
.
mS
lideShow
==
nil
)
if
(
self
.
s
lideShow
==
nil
)
return
;
return
;
if
([
instruction
isEqualToString
:
@"slide_updated"
])
{
if
([
instruction
isEqualToString
:
@"slide_updated"
])
{
unsigned
int
newSlideNumber
=
[[
command
objectAtIndex
:
1
]
unsignedIntValue
];
NSLog
(
@"Interpreter: slide_updated"
);
[
self
.
mSlideShow
setCurrentSlide
:
newSlideNumber
];
uint
newSlideNumber
=
[[
command
objectAtIndex
:
1
]
integerValue
];
[
self
.
slideShow
setCurrentSlide
:
newSlideNumber
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
MSG_SLIDE_CHANGED
object
:
nil
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
MSG_SLIDE_CHANGED
object
:
nil
];
}
else
if
([
instruction
isEqualToString
:
@"slide_preview"
]){
}
else
if
([
instruction
isEqualToString
:
@"slide_preview"
]){
unsigned
int
slideNumber
=
[[
command
objectAtIndex
:
1
]
unsignedIntValue
];
NSLog
(
@"Interpreter: slide_preview"
);
uint
slideNumber
=
[[
command
objectAtIndex
:
1
]
integerValue
];
NSString
*
imageData
=
[
command
objectAtIndex
:
2
];
NSString
*
imageData
=
[
command
objectAtIndex
:
2
];
[
Base64
initialize
];
NSData
*
data
=
[
Base64
decode
:
imageData
];
[
self
.
slideShow
putImage
:
imageData
UIImage
*
img
=
[
UIImage
imageWithData
:
data
];
[
self
.
mSlideShow
putImage
:
img
AtIndex
:
slideNumber
];
AtIndex
:
slideNumber
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
MSG_SLIDE_PREVIEW
object
:[
NSNumber
numberWithUnsignedInt
:
slideNumber
]];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
MSG_SLIDE_PREVIEW
object
:[
NSNumber
numberWithUnsignedInt
:
slideNumber
]];
}
else
if
([
instruction
isEqualToString
:
@"slide_notes"
]){
}
else
if
([
instruction
isEqualToString
:
@"slide_notes"
]){
unsigned
int
slideNumber
=
[[
command
objectAtIndex
:
1
]
unsignedIntValue
];
NSLog
(
@"Interpreter: slide_notes"
);
uint
slideNumber
=
[[
command
objectAtIndex
:
1
]
integerValue
];
NSString
*
notes
;
NSString
*
notes
;
for
(
int
i
=
2
;
i
<
command
.
count
;
++
i
)
{
for
(
int
i
=
2
;
i
<
command
.
count
;
++
i
)
{
[
notes
stringByAppendingString
:[
command
objectAtIndex
:
i
]];
[
notes
stringByAppendingString
:[
command
objectAtIndex
:
i
]];
}
}
[
self
.
mS
lideShow
putNotes
:
notes
[
self
.
s
lideShow
putNotes
:
notes
AtIndex
:
slideNumber
];
AtIndex
:
slideNumber
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
MSG_SLIDE_NOTES
object
:
[
NSNumber
numberWithUnsignedInt
:
slideNumber
]];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
MSG_SLIDE_NOTES
object
:
[
NSNumber
numberWithUnsignedInt
:
slideNumber
]];
}
}
...
...
ios/iosremote/iosremote/Communication/SlideShow.h
Dosyayı görüntüle @
28faf7e3
// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
//
// SlideShow.h
// This file is part of the LibreOffice project.
// iosremote
//
// Created by Liu Siqi on 6/7/13.
// Copyright (c) 2013 libreoffice. All rights reserved.
//
//
// 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 <Foundation/Foundation.h>
@interface
SlideShow
:
NSObject
@interface
SlideShow
:
NSObject
@property
(
nonatomic
,
strong
)
NSArray
*
mSlides
;
@property
uint
size
;
@property
(
nonatomic
,
strong
)
NSNumber
*
mC
urrentSlide
;
@property
uint
c
urrentSlide
;
-
(
NSUInteger
)
size
;
-
(
void
)
putImage
:
(
NSString
*
)
img
AtIndex
:
(
uint
)
index
;
-
(
void
)
setCurrentSlide
:(
NSUInteger
)
number
;
-
(
void
)
putNotes
:
(
NSString
*
)
notes
AtIndex
:
(
uint
)
index
;
-
(
void
)
setLength
:(
NSUInteger
)
number
;
@end
@end
ios/iosremote/iosremote/Communication/SlideShow.m
Dosyayı görüntüle @
28faf7e3
// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
//
// SlideShow.m
// This file is part of the LibreOffice project.
// iosremote
//
// Created by Liu Siqi on 6/7/13.
// Copyright (c) 2013 libreoffice. All rights reserved.
//
//
// 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 "SlideShow.h"
#import "SlideShow.h"
#import "Base64.h"
@interface
SlideShow
()
@property
(
nonatomic
,
strong
)
NSMutableArray
*
imagesArray
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
notesArray
;
@end
@implementation
SlideShow
@implementation
SlideShow
@synthesize
mSlides
=
_mSlides
;
@synthesize
size
=
_size
;
@synthesize
mCurrentSlide
=
_mC
urrentSlide
;
@synthesize
currentSlide
=
_c
urrentSlide
;
-
(
NSUInteger
)
size
{
-
(
SlideShow
*
)
init
{
return
self
.
mSlides
.
count
;
self
=
[
super
init
];
_size
=
0
;
_currentSlide
=
0
;
return
self
;
}
}
-
(
void
)
putImage
:
(
NSString
*
)
img
AtIndex
:
(
uint
)
index
{
[
Base64
initialize
];
NSData
*
data
=
[
Base64
decode
:
img
];
UIImage
*
image
=
[
UIImage
imageWithData
:
data
];
[
self
.
imagesArray
insertObject
:
image
atIndex
:
index
];
}
-
(
void
)
putNotes
:
(
NSString
*
)
notes
AtIndex
:
(
uint
)
index
{
[
self
.
notesArray
insertObject
:
notes
atIndex
:
index
];
}
@end
@end
ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard
Dosyayı görüntüle @
28faf7e3
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<rect
key=
"frame"
x=
"0.0"
y=
"64"
width=
"768"
height=
"960"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"64"
width=
"768"
height=
"960"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<subviews>
<subviews>
<textField
opaque=
"NO"
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"left"
contentVerticalAlignment=
"center"
text=
"1
72.25.19.11
"
borderStyle=
"roundedRect"
minimumFontSize=
"17"
id=
"9w1-Ym-HcF"
>
<textField
opaque=
"NO"
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"left"
contentVerticalAlignment=
"center"
text=
"1
92.168.1.97
"
borderStyle=
"roundedRect"
minimumFontSize=
"17"
id=
"9w1-Ym-HcF"
>
<rect
key=
"frame"
x=
"234"
y=
"402"
width=
"301"
height=
"30"
/>
<rect
key=
"frame"
x=
"234"
y=
"402"
width=
"301"
height=
"30"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"14"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"14"
/>
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
<connections>
<connections>
<outlet
property=
"ipAddressTextEdit"
destination=
"9w1-Ym-HcF"
id=
"hab-JH-3Lf"
/>
<outlet
property=
"ipAddressTextEdit"
destination=
"9w1-Ym-HcF"
id=
"hab-JH-3Lf"
/>
<outlet
property=
"pinLabel"
destination=
"Cg3-f5-zuM"
id=
"HaU-jr-8oJ"
/>
<outlet
property=
"pinLabel"
destination=
"Cg3-f5-zuM"
id=
"HaU-jr-8oJ"
/>
<segue
destination=
"zdX-BL-bmY"
kind=
"push"
identifier=
"slidesPreview"
id=
"9Yb-di-Q6v"
/>
</connections>
</connections>
</viewController>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"3"
sceneMemberID=
"firstResponder"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"3"
sceneMemberID=
"firstResponder"
/>
...
@@ -62,6 +63,31 @@
...
@@ -62,6 +63,31 @@
</objects>
</objects>
<point
key=
"canvasLocation"
x=
"721"
y=
"-301"
/>
<point
key=
"canvasLocation"
x=
"721"
y=
"-301"
/>
</scene>
</scene>
<!--Slide Show View Controller-->
<scene
sceneID=
"wDH-NE-E5t"
>
<objects>
<viewController
id=
"zdX-BL-bmY"
customClass=
"slideShowViewController"
sceneMemberID=
"viewController"
>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"Tkv-NW-1bl"
>
<rect
key=
"frame"
x=
"0.0"
y=
"64"
width=
"768"
height=
"960"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<subviews>
<imageView
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
id=
"T6z-xu-j8h"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"768"
height=
"960"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
</imageView>
</subviews>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"calibratedWhite"
/>
</view>
<navigationItem
key=
"navigationItem"
id=
"uc0-p3-wnG"
/>
<connections>
<outlet
property=
"image"
destination=
"T6z-xu-j8h"
id=
"o1L-LM-TbP"
/>
<outlet
property=
"view"
destination=
"T6z-xu-j8h"
id=
"YKN-ib-gU3"
/>
</connections>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"Dqn-Ae-ABD"
userLabel=
"First Responder"
sceneMemberID=
"firstResponder"
/>
</objects>
<point
key=
"canvasLocation"
x=
"2616"
y=
"-293"
/>
</scene>
</scenes>
</scenes>
<simulatedMetricsContainer
key=
"defaultSimulatedMetrics"
>
<simulatedMetricsContainer
key=
"defaultSimulatedMetrics"
>
<simulatedStatusBarMetrics
key=
"statusBar"
statusBarStyle=
"blackTranslucent"
/>
<simulatedStatusBarMetrics
key=
"statusBar"
statusBarStyle=
"blackTranslucent"
/>
...
...
ios/iosremote/iosremote/libreoffice_sdremoteViewController.m
Dosyayı görüntüle @
28faf7e3
...
@@ -16,6 +16,9 @@
...
@@ -16,6 +16,9 @@
// For debug use, will use a manager to manage server and client instead
// For debug use, will use a manager to manage server and client instead
@property
(
nonatomic
,
strong
)
Server
*
server
;
@property
(
nonatomic
,
strong
)
Server
*
server
;
@property
(
nonatomic
,
strong
)
Client
*
client
;
@property
(
nonatomic
,
strong
)
Client
*
client
;
@property
(
nonatomic
,
strong
)
CommandInterpreter
*
interpreter
;
@property
(
nonatomic
,
weak
)
NSNotificationCenter
*
center
;
@property
(
nonatomic
,
strong
)
id
slideShowPreviewStartObserver
;
@end
@end
...
@@ -23,11 +26,22 @@
...
@@ -23,11 +26,22 @@
@synthesize
server
=
_server
;
@synthesize
server
=
_server
;
@synthesize
client
=
_client
;
@synthesize
client
=
_client
;
@synthesize
center
=
_center
;
@synthesize
interpreter
=
_interpreter
;
@synthesize
slideShowPreviewStartObserver
=
_slideShowPreviewStartObserver
;
-
(
void
)
viewDidLoad
-
(
void
)
viewDidLoad
{
{
[
super
viewDidLoad
];
[
super
viewDidLoad
];
// Do any additional setup after loading the view, typically from a nib.
// Do any additional setup after loading the view, typically from a nib.
self
.
center
=
[
NSNotificationCenter
defaultCenter
];
NSOperationQueue
*
mainQueue
=
[
NSOperationQueue
mainQueue
];
self
.
slideShowPreviewStartObserver
=
[
self
.
center
addObserverForName
:
STATUS_CONNECTED_SLIDESHOW_RUNNING
object
:
nil
queue
:
mainQueue
usingBlock
:^
(
NSNotification
*
note
)
{
NSLog
(
@"Received performSegue!"
);
[
self
performSegueWithIdentifier
:
@"slidesPreview"
sender
:
self
];
}];
}
}
-
(
void
)
didReceiveMemoryWarning
-
(
void
)
didReceiveMemoryWarning
...
@@ -39,13 +53,14 @@
...
@@ -39,13 +53,14 @@
-
(
IBAction
)
connectToServer
:
(
id
)
sender
{
-
(
IBAction
)
connectToServer
:
(
id
)
sender
{
NSString
*
address
=
[
self
.
ipAddressTextEdit
text
];
NSString
*
address
=
[
self
.
ipAddressTextEdit
text
];
self
.
interpreter
=
[[
CommandInterpreter
alloc
]
init
];
self
.
server
=
[[
Server
alloc
]
initWithProtocol
:
NETWORK
atAddress
:
address
ofName
:
@"Server"
];
self
.
server
=
[[
Server
alloc
]
initWithProtocol
:
NETWORK
atAddress
:
address
ofName
:
@"Server"
];
self
.
client
=
[[
Client
alloc
]
initWithServer
:
self
.
server
managedBy
:
nil
interpretedBy
:
nil
];
self
.
client
=
[[
Client
alloc
]
initWithServer
:
self
.
server
managedBy
:
nil
interpretedBy
:
self
.
interpreter
];
[
self
.
client
connect
];
[
self
.
client
connect
];
if
([
self
.
client
mR
eady
])
if
([
self
.
client
r
eady
])
{
{
[
self
.
pinLabel
setText
:[
NSString
stringWithFormat
:
@"%@"
,
self
.
client
.
mP
in
]];
[
self
.
pinLabel
setText
:[
NSString
stringWithFormat
:
@"%@"
,
self
.
client
.
p
in
]];
}
}
}
}
...
...
ios/iosremote/iosremote/slideShowViewController.h
0 → 100644
Dosyayı görüntüle @
28faf7e3
//
// slideShowViewController.h
// iosremote
//
// Created by Liu Siqi on 6/9/13.
// Copyright (c) 2013 libreoffice. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface
slideShowViewController
:
UIViewController
@property
(
weak
,
nonatomic
)
IBOutlet
UIImageView
*
image
;
@end
ios/iosremote/iosremote/slideShowViewController.m
0 → 100644
Dosyayı görüntüle @
28faf7e3
//
// slideShowViewController.m
// iosremote
//
// Created by Liu Siqi on 6/9/13.
// Copyright (c) 2013 libreoffice. All rights reserved.
//
#import "slideShowViewController.h"
@interface
slideShowViewController
()
@end
@implementation
slideShowViewController
-
(
id
)
initWithNibName
:(
NSString
*
)
nibNameOrNil
bundle
:(
NSBundle
*
)
nibBundleOrNil
{
self
=
[
super
initWithNibName
:
nibNameOrNil
bundle
:
nibBundleOrNil
];
if
(
self
)
{
// Custom initialization
}
return
self
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
}
-
(
void
)
viewDidUnload
{
[
self
setImage
:
nil
];
[
super
viewDidUnload
];
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment