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
837a125b
Kaydet (Commit)
837a125b
authored
Agu 13, 2012
tarafından
Andrzej J.R. Hunt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Final fixes for pairing.
Change-Id: Ib66f227062f9c263dbc3dfefaf70525c73bdedc9
üst
4533d34d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
92 additions
and
45 deletions
+92
-45
AndroidManifest.xml
android/sdremote/AndroidManifest.xml
+9
-0
CommunicationService.java
...ice/impressremote/communication/CommunicationService.java
+41
-26
NetworkClient.java
...ibreoffice/impressremote/communication/NetworkClient.java
+10
-1
TestClient.java
...g/libreoffice/impressremote/communication/TestClient.java
+6
-3
RemoteDialog.cxx
sd/source/ui/dlg/RemoteDialog.cxx
+4
-1
RemoteDialogClientBox.cxx
sd/source/ui/dlg/RemoteDialogClientBox.cxx
+3
-1
BufferedStreamSocket.cxx
sd/source/ui/remotecontrol/BufferedStreamSocket.cxx
+17
-13
Server.cxx
sd/source/ui/remotecontrol/Server.cxx
+2
-0
No files found.
android/sdremote/AndroidManifest.xml
Dosyayı görüntüle @
837a125b
...
...
@@ -20,6 +20,15 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".communication.TestClient"
android:label=
"Remote--Direct"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<service
android:name=
".communication.CommunicationService"
>
</service>
...
...
android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
Dosyayı görüntüle @
837a125b
...
...
@@ -33,32 +33,36 @@ public class CommunicationService extends Service implements Runnable {
@Override
public
void
run
()
{
while
(
true
)
{
// Condition
try
{
wait
();
}
catch
(
InterruptedException
e
)
{
// We don't care.
}
// Work
synchronized
(
mConnectionVariableMutex
)
{
if
((
mStateDesired
==
State
.
CONNECTED
&&
mState
==
State
.
CONNECTED
)
||
(
mStateDesired
==
State
.
DISCONNECTED
&&
mState
==
State
.
CONNECTED
))
{
mClient
.
closeConnection
();
mState
=
State
.
DISCONNECTED
;
synchronized
(
this
)
{
while
(
true
)
{
// Condition
try
{
wait
();
}
catch
(
InterruptedException
e
)
{
// We have finished
return
;
}
if
(
mStateDesired
==
State
.
CONNECTED
)
{
switch
(
mServerDesired
.
getProtocol
())
{
case
NETWORK:
mClient
=
new
NetworkClient
(
mServerDesired
.
getAddress
(),
this
);
mTransmitter
=
new
Transmitter
(
mClient
);
mClient
.
setReceiver
(
mReceiver
);
break
;
case
BLUETOOTH:
break
;
// Work
synchronized
(
mConnectionVariableMutex
)
{
if
((
mStateDesired
==
State
.
CONNECTED
&&
mState
==
State
.
CONNECTED
)
||
(
mStateDesired
==
State
.
DISCONNECTED
&&
mState
==
State
.
CONNECTED
))
{
mClient
.
closeConnection
();
mState
=
State
.
DISCONNECTED
;
}
if
(
mStateDesired
==
State
.
CONNECTED
)
{
switch
(
mServerDesired
.
getProtocol
())
{
case
NETWORK:
mClient
=
new
NetworkClient
(
mServerDesired
.
getAddress
(),
this
);
mTransmitter
=
new
Transmitter
(
mClient
);
mClient
.
setReceiver
(
mReceiver
);
break
;
case
BLUETOOTH:
break
;
}
mState
=
State
.
CONNECTED
;
}
mState
=
State
.
CONNECTED
;
}
}
}
...
...
@@ -90,7 +94,10 @@ public class CommunicationService extends Service implements Runnable {
}
mServerDesired
=
aServer
;
mStateDesired
=
State
.
CONNECTED
;
notify
();
synchronized
(
this
)
{
notify
();
}
}
// TODO: connect
}
...
...
@@ -98,7 +105,9 @@ public class CommunicationService extends Service implements Runnable {
public
void
disconnect
()
{
synchronized
(
mConnectionVariableMutex
)
{
mStateDesired
=
State
.
DISCONNECTED
;
notify
();
synchronized
(
this
)
{
notify
();
}
}
}
...
...
@@ -140,14 +149,20 @@ public class CommunicationService extends Service implements Runnable {
return
mBinder
;
}
private
Thread
mThread
=
null
;
@Override
public
void
onCreate
()
{
// TODO Create a notification (if configured).
mThread
=
new
Thread
(
this
);
mThread
.
start
();
}
@Override
public
void
onDestroy
()
{
// TODO Destroy the notification (as necessary).
mThread
.
interrupt
();
mThread
=
null
;
}
public
Transmitter
getTransmitter
()
{
...
...
android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
Dosyayı görüntüle @
837a125b
...
...
@@ -50,8 +50,15 @@ public class NetworkClient extends Client {
CommunicationService
.
MSG_PAIRING_STARTED
);
aIntent
.
putExtra
(
"PIN"
,
aPin
);
LocalBroadcastManager
.
getInstance
(
mContext
).
sendBroadcast
(
aIntent
);
// Send out
String
aName
=
"Bob"
;
// TODO: get the proper name
sendCommand
(
"LO_SERVER_CLIENT_PAIR\n"
+
aName
+
"\n"
+
aPin
+
"\n\n"
);
// Wait until we get the appropriate string back...
System
.
out
.
println
(
"SF:waiting"
);
String
aTemp
=
mReader
.
readLine
();
System
.
out
.
println
(
"SF:waited"
);
if
(!
aTemp
.
equals
(
"LO_SERVER_SERVER_PAIRED"
))
{
return
;
}
else
{
...
...
@@ -60,9 +67,11 @@ public class NetworkClient extends Client {
LocalBroadcastManager
.
getInstance
(
mContext
).
sendBroadcast
(
aIntent
);
}
while
(
(
aTemp
=
mReader
.
readLine
()
).
length
()
!=
0
)
{
while
(
mReader
.
readLine
(
).
length
()
!=
0
)
{
// Get rid of extra lines
System
.
out
.
println
(
"SF: empty line"
);
}
System
.
out
.
println
(
"SD: empty"
);
startListening
();
}
catch
(
UnknownHostException
e
)
{
// TODO Tell the user we have a problem
...
...
android/sdremote/src/org/libreoffice/impressremote/TestClient.java
→
android/sdremote/src/org/libreoffice/impressremote/
communication/
TestClient.java
Dosyayı görüntüle @
837a125b
...
...
@@ -6,9 +6,11 @@
* 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/.
*/
package
org
.
libreoffice
.
impressremote
;
package
org
.
libreoffice
.
impressremote
.
communication
;
import
org.libreoffice.impressremote.communication.CommunicationService
;
import
org.libreoffice.impressremote.PresentationActivity
;
import
org.libreoffice.impressremote.R
;
import
org.libreoffice.impressremote.communication.Server.Protocol
;
import
android.app.Activity
;
import
android.content.ComponentName
;
...
...
@@ -84,7 +86,8 @@ public class TestClient extends Activity {
IBinder
aService
)
{
mCommunicationService
=
((
CommunicationService
.
CBinder
)
aService
)
.
getService
();
// mCommunicationService.connectTo(Protocol.NETWORK, "192.168.0.18");
mCommunicationService
.
connectTo
(
new
Server
(
Protocol
.
NETWORK
,
"10.0.2.2"
,
"TestServer"
,
0
l
));
mCommunicationService
.
setActivityMessenger
(
mMessenger
);
enableButtons
(
true
);
}
...
...
sd/source/ui/dlg/RemoteDialog.cxx
Dosyayı görüntüle @
837a125b
...
...
@@ -50,9 +50,12 @@ IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton)
if
(
aSelected
<
0
)
return
1
;
TClientBoxEntry
aEntry
=
mClientBox
.
GetEntryData
(
aSelected
);
OUString
aPin
=
mClientBox
.
getPin
(
);
OUString
aPin
(
mClientBox
.
getPin
()
);
if
(
RemoteServer
::
connectClient
(
aEntry
->
m_pClientInfo
,
aPin
)
)
{
Close
();
return
0
;
}
else
return
1
;
}
...
...
sd/source/ui/dlg/RemoteDialogClientBox.cxx
Dosyayı görüntüle @
837a125b
...
...
@@ -97,6 +97,8 @@ ClientBox::ClientBox( Dialog* pParent, RemoteServer *pServer,
m_pScrollBar
->
SetScrollHdl
(
LINK
(
this
,
ClientBox
,
ScrollHdl
)
);
m_pScrollBar
->
EnableDrag
();
m_aPinBox
.
SetUseThousandSep
(
false
);
SetPaintTransparent
(
true
);
SetPosPixel
(
Point
(
RSC_SP_DLG_INNERBORDER_LEFT
,
RSC_SP_DLG_INNERBORDER_TOP
)
);
long
nIconHeight
=
2
*
TOP_OFFSET
+
SMALL_ICON_SIZE
;
...
...
@@ -582,7 +584,7 @@ long ClientBox::PointToPos( const Point& rPos )
OUString
ClientBox
::
getPin
()
{
return
m_aPinBox
.
GetText
(
);
return
OUString
::
valueOf
(
m_aPinBox
.
GetValue
()
);
}
//------------------------------------------------------------------------------
...
...
sd/source/ui/remotecontrol/BufferedStreamSocket.cxx
Dosyayı görüntüle @
837a125b
...
...
@@ -27,8 +27,25 @@ sal_Int32 BufferedStreamSocket::readLine( OString& aLine )
{
while
(
true
)
{
// Process buffer first incase data already present.
vector
<
char
>::
iterator
aIt
;
if
(
(
aIt
=
find
(
aBuffer
.
begin
(),
aBuffer
.
end
(),
'\n'
))
!=
aBuffer
.
end
()
)
{
sal_uInt64
aLocation
=
aIt
-
aBuffer
.
begin
();
aLine
=
OString
(
&
(
*
aBuffer
.
begin
()),
aLocation
);
aBuffer
.
erase
(
aBuffer
.
begin
(),
aIt
+
1
);
// Also delete the empty line
aRead
-=
(
aLocation
+
1
);
return
aLine
.
getLength
();
}
// Then try and receive if nothing present
aBuffer
.
resize
(
aRead
+
100
);
aRet
=
recv
(
&
aBuffer
[
aRead
],
100
);
if
(
aRet
==
0
)
{
return
aRet
;
...
...
@@ -40,19 +57,6 @@ sal_Int32 BufferedStreamSocket::readLine( OString& aLine )
return
0
;
}
aRead
+=
aRet
;
vector
<
char
>::
iterator
aIt
;
while
(
(
aIt
=
find
(
aBuffer
.
begin
(),
aBuffer
.
end
(),
'\n'
))
!=
aBuffer
.
end
()
)
{
sal_uInt64
aLocation
=
aIt
-
aBuffer
.
begin
();
aLine
=
OString
(
&
(
*
aBuffer
.
begin
()),
aLocation
);
aBuffer
.
erase
(
aBuffer
.
begin
(),
aIt
+
1
);
// Also delete the empty line
aRead
-=
(
aLocation
+
1
);
return
aLine
.
getLength
();
}
}
...
...
sd/source/ui/remotecontrol/Server.cxx
Dosyayı görüntüle @
837a125b
...
...
@@ -82,6 +82,7 @@ void RemoteServer::execute()
if
(
!
pSocket
->
readLine
(
aLine
)
)
delete
pSocket
;
OString
aPin
(
aLine
);
fprintf
(
stderr
,
"Pin:%s
\n
"
,
aPin
.
getStr
()
);
SocketAddr
aClientAddr
;
pSocket
->
getPeerAddr
(
aClientAddr
);
...
...
@@ -191,6 +192,7 @@ sal_Bool RemoteServer::connectClient( ClientInfo* pClient, rtl::OUString aPin )
break
;
}
}
pCommunicator
->
launch
();
return
true
;
}
else
...
...
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