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
894d19ab
Kaydet (Commit)
894d19ab
authored
Haz 15, 2013
tarafından
siqi
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
seems somthing get blocked...
üst
d1bb1270
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
96 additions
and
80 deletions
+96
-80
Client.h
ios/iosremote/iosremote/Communication/Client.h
+5
-4
Client.m
ios/iosremote/iosremote/Communication/Client.m
+11
-22
CommandInterpreter.h
ios/iosremote/iosremote/Communication/CommandInterpreter.h
+2
-1
CommandTransmitter.h
ios/iosremote/iosremote/Communication/CommandTransmitter.h
+3
-1
CommandTransmitter.m
ios/iosremote/iosremote/Communication/CommandTransmitter.m
+5
-0
CommunicationManager.h
ios/iosremote/iosremote/Communication/CommunicationManager.h
+7
-5
CommunicationManager.m
ios/iosremote/iosremote/Communication/CommunicationManager.m
+44
-23
SlideShow.h
ios/iosremote/iosremote/Communication/SlideShow.h
+2
-1
MainStoryboard_iPad.storyboard
...sremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard
+4
-4
libreoffice_sdremoteViewController.h
ios/iosremote/iosremote/libreoffice_sdremoteViewController.h
+1
-1
libreoffice_sdremoteViewController.m
ios/iosremote/iosremote/libreoffice_sdremoteViewController.m
+11
-17
slideShowViewController.h
ios/iosremote/iosremote/slideShowViewController.h
+1
-1
No files found.
ios/iosremote/iosremote/Communication/Client.h
Dosyayı görüntüle @
894d19ab
...
...
@@ -7,9 +7,10 @@
*/
#import <Foundation/Foundation.h>
#import "Server.h"
#import "CommunicationManager.h"
#import "CommandInterpreter.h"
@class
Server
;
@class
CommunicationManager
;
@class
CommandInterpreter
;
@interface
Client
:
NSObject
...
...
@@ -18,7 +19,7 @@
@property
(
nonatomic
,
strong
)
NSString
*
name
;
@property
(
nonatomic
,
weak
)
Server
*
server
;
-
(
BOOL
)
connect
;
-
(
void
)
connect
;
-
(
void
)
disconnect
;
-
(
id
)
initWithServer
:(
Server
*
)
server
...
...
ios/iosremote/iosremote/Communication/Client.m
Dosyayı görüntüle @
894d19ab
...
...
@@ -20,14 +20,11 @@
@property
(
nonatomic
,
strong
)
NSOutputStream
*
outputStream
;
@property
uint
mPort
;
@property
(
nonatomic
,
weak
)
CommandInterpreter
*
receiver
;
@property
(
nonatomic
,
weak
)
CommunicationManager
*
comManager
;
@end
NSCondition
*
connected
;
@implementation
Client
@synthesize
inputStream
=
_mInputStream
;
...
...
@@ -39,6 +36,7 @@ NSCondition *connected;
@synthesize
connected
=
_mReady
;
@synthesize
receiver
=
_receiver
;
-
(
id
)
initWithServer
:(
Server
*
)
server
managedBy
:(
CommunicationManager
*
)
manager
interpretedBy
:(
CommandInterpreter
*
)
receiver
...
...
@@ -46,7 +44,6 @@ NSCondition *connected;
self
=
[
self
init
];
if
(
self
)
{
connected
=
[
NSCondition
new
];
self
.
connected
=
NO
;
self
.
name
=
[[
UIDevice
currentDevice
]
name
];
self
.
pin
=
[
NSNumber
numberWithInteger
:[
self
getPin
]];
...
...
@@ -111,24 +108,25 @@ NSCondition *connected;
[
self
.
outputStream
write
:(
uint8_t
*
)[
data
bytes
]
maxLength
:[
data
length
]];
}
int
count
=
0
;
-
(
void
)
stream
:(
NSStream
*
)
stream
handleEvent
:(
NSStreamEvent
)
eventCode
{
switch
(
eventCode
)
{
case
NSStreamEventOpenCompleted
:{
NSLog
(
@"Connection established"
);
[
connected
lock
];
NSArray
*
temp
=
[[
NSArray
alloc
]
initWithObjects
:
@"LO_SERVER_CLIENT_PAIR
\n
"
,
self
.
name
,
@"
\n
"
,
self
.
pin
,
@"
\n\n
"
,
nil
];
NSString
*
command
=
[
temp
componentsJoinedByString
:
@""
];
[
self
sendCommand
:
command
];
self
.
connected
=
YES
;
[
connected
signal
];
[
connected
unlock
];
if
(
count
==
1
)
{
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"connection.status.connected"
object
:
nil
];
}
else
{
count
++
;
}
}
break
;
case
NSStreamEventErrorOccurred
:{
NSLog
(
@"Connection error occured"
);
[
self
disconnect
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"connection.status.disconnected"
object
:
nil
];
}
break
;
case
NSStreamEventHasBytesAvailable
:
...
...
@@ -179,18 +177,9 @@ NSCondition *connected;
self
.
connected
=
NO
;
}
-
(
BOOL
)
connect
-
(
void
)
connect
{
[
self
streamOpenWithIp
:
self
.
server
.
serverAddress
withPortNumber
:
self
.
mPort
];
[
connected
lock
];
if
([
connected
waitUntilDate
:[
NSDate
dateWithTimeIntervalSinceNow
:
5
]]){
[
connected
unlock
];
return
YES
;
}
else
{
[
self
disconnect
];
[
connected
unlock
];
return
NO
;
}
}
...
...
ios/iosremote/iosremote/Communication/CommandInterpreter.h
Dosyayı görüntüle @
894d19ab
...
...
@@ -8,7 +8,8 @@
#import <Foundation/Foundation.h>
#import "SlideShow.h"
@class
SlideShow
;
@interface
CommandInterpreter
:
NSObject
...
...
ios/iosremote/iosremote/Communication/CommandTransmitter.h
Dosyayı görüntüle @
894d19ab
...
...
@@ -7,7 +7,9 @@
//
#import <Foundation/Foundation.h>
#import "Client.h"
@class
Client
;
@interface
CommandTransmitter
:
NSObject
...
...
ios/iosremote/iosremote/Communication/CommandTransmitter.m
Dosyayı görüntüle @
894d19ab
...
...
@@ -24,6 +24,11 @@
{
self
=
[
self
init
];
self
.
client
=
client
;
NSArray
*
temp
=
[[
NSArray
alloc
]
initWithObjects
:
@"LO_SERVER_CLIENT_PAIR
\n
"
,
self
.
client
.
name
,
@"
\n
"
,
self
.
client
.
pin
,
@"
\n\n
"
,
nil
];
NSString
*
command
=
[
temp
componentsJoinedByString
:
@""
];
[
self
.
client
sendCommand
:
command
];
return
self
;
}
...
...
ios/iosremote/iosremote/Communication/CommunicationManager.h
Dosyayı görüntüle @
894d19ab
...
...
@@ -8,9 +8,10 @@
#import <Foundation/Foundation.h>
#import "Client.h"
#import "Server.h"
#import "CommandInterpreter.h"
@class
Client
;
@class
Server
;
@class
CommandInterpreter
;
#define MSG_SLIDESHOW_STARTED @"SLIDESHOW_STARTED"
#define MSG_SLIDE_CHANGED @"SLIDE_CHANGED"
...
...
@@ -48,10 +49,11 @@ enum ConnectionState : NSInteger {
CONNECTED
};
dispatch_queue_t
backgroundQueue
;
@interface
CommunicationManager
:
NSObject
-
(
void
)
connectToServer
:(
Server
*
)
server
;
@property
ConnectionState
state
;
@property
(
nonatomic
,
strong
)
id
delegate
;
@end
ios/iosremote/iosremote/Communication/CommunicationManager.m
Dosyayı görüntüle @
894d19ab
...
...
@@ -12,6 +12,7 @@
#import "Server.h"
#import "CommandTransmitter.h"
#import "CommandInterpreter.h"
#import "libreoffice_sdremoteViewController.h"
#import <dispatch/dispatch.h>
@interface
CommunicationManager
()
...
...
@@ -19,7 +20,9 @@
@property
(
nonatomic
,
strong
)
Client
*
client
;
@property
(
nonatomic
,
strong
)
CommandInterpreter
*
interpreter
;
@property
(
nonatomic
,
strong
)
CommandTransmitter
*
transmitter
;
@property
(
atomic
,
strong
)
NSMutableArray
*
servers
;
@property
(
atomic
,
strong
)
NSMutableSet
*
servers
;
@property
(
nonatomic
,
strong
)
id
connectionConnectedObserver
;
@property
(
nonatomic
,
strong
)
id
connectionDisconnectedObserver
;
@end
...
...
@@ -31,8 +34,9 @@
@synthesize
interpreter
=
_interpreter
;
@synthesize
transmitter
=
_transmitter
;
@synthesize
servers
=
_servers
;
NSLock
*
connectionLock
;
@synthesize
delegate
=
_delegate
;
@synthesize
connectionConnectedObserver
=
_connectionConnectedObserver
;
@synthesize
connectionDisconnectedObserver
=
_connectionDisconnectedObserver
;
+
(
CommunicationManager
*
)
sharedComManager
{
...
...
@@ -47,15 +51,40 @@ NSLock *connectionLock;
return
sharedComManager
;
}
-
(
void
)
connectionStatusHandler
:
(
NSNotification
*
)
note
{
if
([[
note
name
]
isEqualToString
:
@"connection.status.connected"
]){
NSLog
(
@"Connected"
);
self
.
transmitter
=
[[
CommandTransmitter
alloc
]
initWithClient
:
self
.
client
];
self
.
state
=
CONNECTED
;
[
self
.
delegate
setPinLabelText
:[
NSString
stringWithFormat
:
@"%@"
,
[
self
getPairingPin
]]];
}
else
if
([[
note
name
]
isEqualToString
:
@"connection.status.disconnected"
]){
NSLog
(
@"Connection Failed"
);
self
.
state
=
DISCONNECTED
;
[
self
.
client
disconnect
];
}
}
-
(
id
)
init
{
self
=
[
super
init
];
self
.
state
=
DISCONNECTED
;
connectionLock
=
[
NSLock
new
];
backgroundQueue
=
dispatch_queue_create
(
"org.libreoffice.iosremote"
,
NULL
);
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
connectionStatusHandler
:
)
name
:
@"connection.status.connected"
object
:
nil
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
connectionStatusHandler
:
)
name
:
@"connection.status.disconnected"
object
:
nil
];
return
self
;
}
-
(
id
)
initWithExistingServers
{
self
=
[
self
init
];
...
...
@@ -70,36 +99,28 @@ NSLock *connectionLock;
{
NSArray
*
oldSavedArray
=
[
NSKeyedUnarchiver
unarchiveObjectWithData
:
dataRepresentingExistingServers
];
if
(
oldSavedArray
!=
nil
)
self
.
servers
=
[[
NSMutable
Array
alloc
]
initWithArray
:
oldSavedArray
];
self
.
servers
=
[[
NSMutable
Set
alloc
]
initWithArray
:
oldSavedArray
];
else
self
.
servers
=
[[
NSMutable
Array
alloc
]
init
];
self
.
servers
=
[[
NSMutable
Set
alloc
]
init
];
}
return
self
;
}
-
(
void
)
connectToServer
:
(
Server
*
)
server
{
dispatch_async
(
backgroundQueue
,
^
(
void
)
{
if
([
connectionLock
tryLock
])
{
[
self
.
servers
addObject
:
server
];
if
(
self
.
state
==
CONNECTING
||
self
.
state
==
CONNECTED
)
{
return
;
}
else
{
self
.
state
=
CONNECTING
;
[
self
.
client
disconnect
];
// initialise it with a given server
self
.
client
=
[[
Client
alloc
]
initWithServer
:
server
managedBy
:
self
interpretedBy
:
self
.
interpreter
];
if
([
self
.
client
connect
]){
self
.
state
=
CONNECTED
;
self
.
transmitter
=
[[
CommandTransmitter
alloc
]
initWithClient
:
self
.
client
];
}
else
{
// streams closing is handled by client itself in case of connection failure
self
.
state
=
DISCONNECTED
;
}
[
connectionLock
unlock
];
}
else
// Already a threading working on that ... and that thread will unlock in 5 seconds anyway, so just return for now.
return
;
});
[
self
.
client
connect
];
}
}
-
(
NSNumber
*
)
getPairingPin
{
return
[
self
.
client
pin
];
}
...
...
ios/iosremote/iosremote/Communication/SlideShow.h
Dosyayı görüntüle @
894d19ab
...
...
@@ -8,7 +8,8 @@
#import <Foundation/Foundation.h>
#import "slideShowViewController.h"
@class
slideShowViewController
;
@interface
SlideShow
:
NSObject
...
...
ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard
Dosyayı görüntüle @
894d19ab
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"2.0"
toolsVersion=
"3084"
systemVersion=
"12
D78
"
targetRuntime=
"iOS.CocoaTouch.iPad"
propertyAccessControl=
"none"
initialViewController=
"KFV-Ae-zm8"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"2.0"
toolsVersion=
"3084"
systemVersion=
"12
E55
"
targetRuntime=
"iOS.CocoaTouch.iPad"
propertyAccessControl=
"none"
initialViewController=
"KFV-Ae-zm8"
>
<dependencies>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"2083"
/>
</dependencies>
...
...
@@ -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=
"1
72.25.19.1
1"
borderStyle=
"roundedRect"
minimumFontSize=
"17"
id=
"9w1-Ym-HcF"
>
<textField
opaque=
"NO"
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"left"
contentVerticalAlignment=
"center"
text=
"1
92.168.40.10
1"
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"
/>
...
...
@@ -130,11 +130,11 @@
<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=
"458
"
/>
<rect
key=
"frame"
x=
"
14"
y=
"20"
width=
"741"
height=
"442
"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
</imageView>
<webView
contentMode=
"scaleToFill"
id=
"y0E-Wp-yUc"
>
<rect
key=
"frame"
x=
"20"
y=
"
492
"
width=
"728"
height=
"378"
/>
<rect
key=
"frame"
x=
"20"
y=
"
513
"
width=
"728"
height=
"378"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
flexibleMinY=
"YES"
heightSizable=
"YES"
/>
<color
key=
"backgroundColor"
red=
"1"
green=
"1"
blue=
"1"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
</webView>
...
...
ios/iosremote/iosremote/libreoffice_sdremoteViewController.h
Dosyayı görüntüle @
894d19ab
...
...
@@ -11,9 +11,9 @@
@interface
libreoffice_sdremoteViewController
:
UIViewController
-
(
IBAction
)
connectToServer
:(
id
)
sender
;
-
(
void
)
setPinLabelText
:(
NSString
*
)
text
;
@property
(
weak
,
nonatomic
)
IBOutlet
UILabel
*
pinLabel
;
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
ipAddressTextEdit
;
@end
ios/iosremote/iosremote/libreoffice_sdremoteViewController.m
Dosyayı görüntüle @
894d19ab
...
...
@@ -9,15 +9,14 @@
#import "libreoffice_sdremoteViewController.h"
#import "Server.h"
#import "Client.h"
#import "slideShowViewController.h"
#import "CommunicationManager.h"
@interface
libreoffice_sdremoteViewController
()
// For debug use, will use a manager to manage server and client instead
@property
(
nonatomic
,
strong
)
Server
*
server
;
@property
(
nonatomic
,
strong
)
Client
*
client
;
@property
(
nonatomic
,
strong
)
CommandInterpreter
*
interpreter
;
@property
(
nonatomic
,
strong
)
CommunicationManager
*
comManager
;
@property
(
nonatomic
,
weak
)
NSNotificationCenter
*
center
;
@property
(
nonatomic
,
strong
)
id
slideShowPreviewStartObserver
;
...
...
@@ -26,9 +25,8 @@
@implementation
libreoffice_sdremoteViewController
@synthesize
server
=
_server
;
@synthesize
client
=
_client
;
@synthesize
center
=
_center
;
@synthesize
interpreter
=
_interpret
er
;
@synthesize
comManager
=
_comManag
er
;
@synthesize
slideShowPreviewStartObserver
=
_slideShowPreviewStartObserver
;
-
(
void
)
viewDidLoad
...
...
@@ -48,7 +46,6 @@
-
(
void
)
prepareForSegue
:
(
UIStoryboardSegue
*
)
segue
sender
:
(
id
)
sender
{
if
([
segue
.
identifier
isEqualToString
:
@"slidesPreviewSegue"
])
{
slideShowViewController
*
destViewController
=
segue
.
destinationViewController
;
destViewController
.
slideshow
=
[
self
.
interpreter
slideShow
];
[
destViewController
.
slideshow
setDelegate
:
destViewController
];
}
}
...
...
@@ -62,22 +59,19 @@
-
(
IBAction
)
connectToServer
:
(
id
)
sender
{
NSString
*
address
=
[
self
.
ipAddressTextEdit
text
];
self
.
interpreter
=
[[
CommandInterpreter
alloc
]
init
];
self
.
server
=
[[
Server
alloc
]
initWithProtocol
:
NETWORK
atAddress
:
address
ofName
:
@"Server"
];
self
.
client
=
[[
Client
alloc
]
initWithServer
:
self
.
server
managedBy
:
nil
interpretedBy
:
self
.
interpreter
];
[
self
.
client
connect
];
if
([
self
.
client
connected
])
{
[
self
.
pinLabel
setText
:[
NSString
stringWithFormat
:
@"%@"
,
self
.
client
.
pin
]];
}
self
.
comManager
=
[[
CommunicationManager
alloc
]
init
];
self
.
server
=
[[
Server
alloc
]
initWithProtocol
:
NETWORK
atAddress
:
address
ofName
:
@"Macbook Pro Retina"
];
[
self
.
comManager
setDelegate
:
self
];
[
self
.
comManager
connectToServer
:
self
.
server
];
}
-
(
void
)
viewDidUnload
{
[
self
setIpAddressTextEdit
:
nil
];
[
self
setPinLabel
:
nil
];
[
self
setPinLabel
:
nil
];
[
super
viewDidUnload
];
}
-
(
void
)
setPinLabelText
:
(
NSString
*
)
text
{
[
self
.
pinLabel
setText
:
text
];
}
@end
ios/iosremote/iosremote/slideShowViewController.h
Dosyayı görüntüle @
894d19ab
...
...
@@ -14,7 +14,7 @@
@property
(
weak
,
nonatomic
)
IBOutlet
UIImageView
*
image
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIWebView
*
lecturer_notes
;
@property
(
nonatomic
,
strong
)
SlideShow
*
slideshow
;
@property
(
nonatomic
,
strong
)
SlideShow
*
slideshow
;
@property
(
nonatomic
,
strong
)
id
slideShowImageReadyObserver
;
@property
(
nonatomic
,
strong
)
id
slideShowNoteReadyObserver
;
...
...
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