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
78d15f21
Kaydet (Commit)
78d15f21
authored
Agu 21, 2012
tarafından
Andrzej J.R. Hunt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Emulator detection. Fix crash on bluetoothless devices.
Change-Id: Ia4845940a83361cad1e824832dcad05019192705
üst
4cc09d0e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
11 deletions
+49
-11
.project
android/sdremote/.project
+1
-1
BluetoothFinder.java
...reoffice/impressremote/communication/BluetoothFinder.java
+6
-0
Server.java
...c/org/libreoffice/impressremote/communication/Server.java
+5
-0
ServerFinder.java
...libreoffice/impressremote/communication/ServerFinder.java
+37
-10
No files found.
android/sdremote/.project
Dosyayı görüntüle @
78d15f21
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
Impress
Remote
</name>
<name>
SD
Remote
</name>
<comment></comment>
<projects>
</projects>
...
...
android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
Dosyayı görüntüle @
78d15f21
...
...
@@ -28,6 +28,9 @@ public class BluetoothFinder {
}
public
void
startFinding
()
{
if
(
mAdapter
==
null
)
{
return
;
// No bluetooth adapter found (emulator, special devices)
}
System
.
out
.
println
(
"BT:Discovery starting"
);
IntentFilter
aFilter
=
new
IntentFilter
(
BluetoothAdapter
.
ACTION_DISCOVERY_FINISHED
);
...
...
@@ -39,6 +42,9 @@ public class BluetoothFinder {
}
public
void
stopFinding
()
{
if
(
mAdapter
==
null
)
{
return
;
// No bluetooth adapter found (emulator, special devices)
}
mAdapter
.
cancelDiscovery
();
try
{
mContext
.
unregisterReceiver
(
mReceiver
);
...
...
android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
Dosyayı görüntüle @
78d15f21
...
...
@@ -10,6 +10,11 @@ public class Server {
private
String
mAddress
;
private
String
mName
;
private
long
mTimeDiscovered
;
/**
* Signifies a Server that shouldn't be automatically removed from the list.
* Used e.g. for the emulator.
*/
protected
boolean
mNoTimeout
=
false
;
protected
Server
(
Protocol
aProtocol
,
String
aAddress
,
String
aName
,
long
aTimeDiscovered
)
{
...
...
android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
Dosyayı görüntüle @
78d15f21
...
...
@@ -9,6 +9,8 @@ import java.net.SocketException;
import
java.util.Collection
;
import
java.util.HashMap
;
import
org.libreoffice.impressremote.communication.Server.Protocol
;
import
android.content.Context
;
import
android.content.Intent
;
...
...
@@ -69,15 +71,11 @@ public class ServerFinder {
mServerList
.
put
(
aServer
.
getAddress
(),
aServer
);
System
.
out
.
println
(
"Contains:<<"
+
aName
+
">>"
);
Intent
aIntent
=
new
Intent
(
CommunicationService
.
MSG_SERVERLIST_CHANGED
);
mContext
.
sendBroadcast
(
aIntent
);
notifyActivity
();
}
catch
(
java
.
net
.
SocketTimeoutException
e
)
{
// Ignore -- we want to timeout to enable checking whether we
// should stop listening periodically
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
...
...
@@ -92,6 +90,7 @@ public class ServerFinder {
mListenerThread
=
new
Thread
()
{
@Override
public
void
run
()
{
checkAndAddEmulator
();
long
aTime
=
0
;
try
{
mSocket
=
new
DatagramSocket
();
...
...
@@ -106,13 +105,13 @@ public class ServerFinder {
PORT
);
mSocket
.
send
(
aPacket
);
aTime
=
System
.
currentTimeMillis
();
// Remove stale servers
for
(
Server
aServer
:
mServerList
.
values
())
{
if
(
System
.
currentTimeMillis
()
-
aServer
.
getTimeDiscovered
()
>
60
*
1000
)
{
if
(!
aServer
.
mNoTimeout
&&
System
.
currentTimeMillis
()
-
aServer
.
getTimeDiscovered
()
>
60
*
1000
)
{
mServerList
.
remove
(
aServer
.
getAddress
());
Intent
aIntent
=
new
Intent
(
CommunicationService
.
MSG_SERVERLIST_CHANGED
);
mContext
.
sendBroadcast
(
aIntent
);
notifyActivity
();
}
}
...
...
@@ -145,6 +144,34 @@ public class ServerFinder {
}
}
/**
* Check whether we are on an emulator and add it's host to the list of
* servers if so (although we do not know whether libo is running on
* the host).
*/
private
void
checkAndAddEmulator
()
{
try
{
if
(
InetAddress
.
getByName
(
"10.0.2.2"
).
isReachable
(
100
))
{
System
.
out
.
println
(
"NulledNot"
);
Server
aServer
=
new
Server
(
Protocol
.
NETWORK
,
"10.0.2.2"
,
"Android Emulator Host"
,
0
);
aServer
.
mNoTimeout
=
true
;
mServerList
.
put
(
aServer
.
getAddress
(),
aServer
);
notifyActivity
();
}
}
catch
(
IOException
e
)
{
// Probably means we can't connect -- i.e. no emulator host
}
}
/**
* Notify the activity that the server list has changed.
*/
private
void
notifyActivity
()
{
Intent
aIntent
=
new
Intent
(
CommunicationService
.
MSG_SERVERLIST_CHANGED
);
mContext
.
sendBroadcast
(
aIntent
);
}
public
Collection
<
Server
>
getServerList
()
{
return
mServerList
.
values
();
}
...
...
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