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
03b7dde2
Kaydet (Commit)
03b7dde2
authored
Agu 13, 2013
tarafından
Siqi LIU
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
seperate state handling for connection and searching
Change-Id: I1bbffb94127905f48672ce8e7baf28fa2a07189d
üst
9a1483c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
13 deletions
+19
-13
CommunicationManager.h
ios/iosremote/iosremote/Communication/CommunicationManager.h
+7
-1
CommunicationManager.m
ios/iosremote/iosremote/Communication/CommunicationManager.m
+1
-0
serverList_vc.m
ios/iosremote/iosremote/serverList_vc.m
+11
-12
No files found.
ios/iosremote/iosremote/Communication/CommunicationManager.h
Dosyayı görüntüle @
03b7dde2
...
...
@@ -54,11 +54,16 @@
typedef
enum
ConnectionState
:
NSInteger
ConnectionState
;
typedef
enum
SearchState
:
NSInteger
SearchState
;
enum
ConnectionState
:
NSInteger
{
DISCONNECTED
,
CONNECTING
,
CONNECTED
,
CONNECTED
};
enum
SearchState
:
NSInteger
{
WAITING
,
SEARCHING
};
...
...
@@ -72,6 +77,7 @@ enum ConnectionState : NSInteger {
-
(
void
)
removeServerAtIndex
:(
NSUInteger
)
index
;
@property
ConnectionState
state
;
@property
SearchState
searchState
;
@property
(
nonatomic
,
strong
)
id
delegate
;
@property
(
atomic
,
strong
)
NSMutableArray
*
servers
;
@property
(
atomic
,
strong
)
NSMutableArray
*
autoDiscoveryServers
;
...
...
ios/iosremote/iosremote/Communication/CommunicationManager.m
Dosyayı görüntüle @
03b7dde2
...
...
@@ -107,6 +107,7 @@
{
self
=
[
super
init
];
self
.
state
=
DISCONNECTED
;
self
.
searchState
=
WAITING
;
self
.
interpreter
=
[[
CommandInterpreter
alloc
]
init
];
self
.
servers
=
[[
NSMutableArray
alloc
]
init
];
...
...
ios/iosremote/iosremote/serverList_vc.m
Dosyayı görüntüle @
03b7dde2
...
...
@@ -107,7 +107,7 @@
-
(
void
)
netServiceBrowserWillSearch
:
(
NSNetServiceBrowser
*
)
aNetServiceBrowser
{
NSLog
(
@"Will search"
);
self
.
comManager
.
state
=
SEARCHING
;
self
.
comManager
.
s
earchS
tate
=
SEARCHING
;
self
.
searchStateText
=
NSLocalizedString
(
@"Searching"
,
nil
);
[
self
.
searchLabelTimer
invalidate
];
[
self
.
searchTimeoutTimer
invalidate
];
...
...
@@ -130,8 +130,7 @@
-
(
void
)
netServiceBrowserDidStopSearch
:
(
NSNetServiceBrowser
*
)
aNetServiceBrowser
{
NSLog
(
@"End search"
);
if
(
self
.
comManager
.
state
==
SEARCHING
)
self
.
comManager
.
state
=
DISCONNECTED
;
self
.
comManager
.
searchState
=
WAITING
;
[
self
.
searchLabelTimer
invalidate
];
[
self
.
searchTimeoutTimer
invalidate
];
self
.
searchStateText
=
NSLocalizedString
(
@"Click to refresh"
,
nil
);
...
...
@@ -141,7 +140,7 @@
-
(
void
)
netServiceBrowser
:
(
NSNetServiceBrowser
*
)
aNetServiceBrowser
didNotSearch
:
(
NSDictionary
*
)
errorDict
{
NSLog
(
@"search error"
);
[
self
.
serviceBrowser
searchForServicesOfType
:
@"_impressRemote._tcp"
inDomain
:
@"local"
];
//
[self.serviceBrowser searchForServicesOfType:@"_impressRemote._tcp" inDomain:@"local"];
}
-
(
void
)
netServiceBrowser
:
(
NSNetServiceBrowser
*
)
aNetServiceBrowser
...
...
@@ -297,9 +296,15 @@
{
[
tableView
deselectRowAtIndexPath
:
indexPath
animated
:
YES
];
// Return when browser is still searching...
if
([
self
.
comManager
.
autoDiscoveryServers
count
]
==
0
&&
indexPath
.
section
==
0
&&
self
.
comManager
.
state
==
SEARCHING
)
if
([
self
.
comManager
.
autoDiscoveryServers
count
]
==
0
&&
indexPath
.
section
==
0
){
// No discovered server and not searching => in a "click to refresh" state, so we restart searching process
if
(
self
.
comManager
.
searchState
==
WAITING
){
[
self
.
serviceBrowser
searchForServicesOfType
:
@"_impressremote._tcp"
inDomain
:
@"local"
];
[
self
.
serviceBrowser
scheduleInRunLoop
:[
NSRunLoop
currentRunLoop
]
forMode
:
NSDefaultRunLoopMode
];
}
// Return when browser is still searching...
return
;
}
// Return when nothing should be done
if
(
self
.
comManager
.
state
==
CONNECTING
)
...
...
@@ -317,12 +322,6 @@
NSLog
(
@"Connecting to %@:%@"
,
[[
self
.
comManager
.
servers
objectAtIndex
:
indexPath
.
row
]
serverName
],
[[
self
.
comManager
.
servers
objectAtIndex
:
indexPath
.
row
]
serverAddress
]);
[
self
.
comManager
connectToServer
:[
self
.
comManager
.
servers
objectAtIndex
:
indexPath
.
row
]];
}
else
if
(
indexPath
.
section
==
0
){
// No discovered server and not searching => in a click to refresh state, so we restart searching process
if
([
self
.
comManager
.
autoDiscoveryServers
count
]
==
0
)
{
[
self
.
serviceBrowser
searchForServicesOfType
:
@"_impressremote._tcp"
inDomain
:
@"local"
];
[
self
.
serviceBrowser
scheduleInRunLoop
:[
NSRunLoop
currentRunLoop
]
forMode
:
NSDefaultRunLoopMode
];
return
;
}
NSLog
(
@"Connecting to %@"
,
[[
self
.
comManager
.
autoDiscoveryServers
objectAtIndex
:
indexPath
.
row
]
name
]);
[[
self
.
comManager
.
autoDiscoveryServers
objectAtIndex
:
indexPath
.
row
]
resolveWithTimeout
:
0
.
0
];
}
...
...
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