summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorSiqi LIU <me@siqi.fr>2013-07-19 18:58:42 +0200
committerSiqi LIU <me@siqi.fr>2013-07-19 18:59:03 +0200
commit793f19d17111af6b79713f98a1e841d6e132248f (patch)
treec0776ff986e7b28aea318423baac8244e38d45ec /sd
parentb5e915acd523fa0d2ebbd6629e96b61975de59c0 (diff)
bonjour autodiscovery for mac osx, let me know if it crashes on other build
Change-Id: Ibbaa7b583aaf48b28a913dfd8c12742b76c31d82
Diffstat (limited to 'sd')
-rw-r--r--sd/Library_sd.mk6
-rw-r--r--sd/source/ui/remotecontrol/BluetoothServer.mm2
-rw-r--r--sd/source/ui/remotecontrol/DiscoveryService.cxx86
-rw-r--r--sd/source/ui/remotecontrol/DiscoveryService.hxx2
4 files changed, 58 insertions, 38 deletions
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 6c57b4b76157..1586ba081ebd 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -523,7 +523,6 @@ ifeq ($(ENABLE_SDREMOTE),YES)
$(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/remotecontrol/BufferedStreamSocket \
sd/source/ui/remotecontrol/Communicator \
- sd/source/ui/remotecontrol/DiscoveryService \
sd/source/ui/remotecontrol/ImagePreparer \
sd/source/ui/remotecontrol/Server \
sd/source/ui/remotecontrol/Receiver \
@@ -541,13 +540,16 @@ ifeq (,$(filter IOS MACOSX,$(OS)))
$(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/remotecontrol/BluetoothServer \
+ sd/source/ui/remotecontrol/DiscoveryService \
))
else
$(eval $(call gb_Library_add_objcxxobjects,sd,\
sd/source/ui/remotecontrol/BluetoothServer \
- sd/source/ui/remotecontrol/OSXBluetooth,\
+ sd/source/ui/remotecontrol/OSXBluetooth\
+ sd/source/ui/remotecontrol/DiscoveryService \
+ sd/source/ui/remotecontrol/OSXNetworkService, \
-Wno-error \
))
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.mm b/sd/source/ui/remotecontrol/BluetoothServer.mm
index eabecac4e7e8..28288ff6fa6d 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.mm
+++ b/sd/source/ui/remotecontrol/BluetoothServer.mm
@@ -1 +1 @@
-#include "BluetoothServer.cxx"
+#include "BluetoothServer.cxx" \ No newline at end of file
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx
index e18b89f94a29..b5d4544f46ee 100644
--- a/sd/source/ui/remotecontrol/DiscoveryService.cxx
+++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx
@@ -33,13 +33,30 @@
#include <arpa/inet.h>
#endif
+#ifdef MACOSX
+ #include <osl/conditn.hxx> // Include this early to avoid error as check() gets defined by some SDK header to empty
+ #include <premac.h>
+ #import <CoreFoundation/CoreFoundation.h>
+ #include <postmac.h>
+ #import "OSXNetworkService.h"
+#endif
+
using namespace osl;
using namespace rtl;
using namespace sd;
-DiscoveryService::DiscoveryService() :
- mSocket(0)
+void SAL_CALL DiscoveryService::run()
+{
+
+}
+
+DiscoveryService::DiscoveryService()
{
+ #ifdef MACOSX
+ OSXNetworkService * service = [[OSXNetworkService alloc] init];
+ [service publishImpressRemoteServiceOnLocalNetworkWithName: @""];
+ #endif
+ /*
mSocket = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
sockaddr_in aAddr;
@@ -72,42 +89,43 @@ DiscoveryService::DiscoveryService() :
SAL_WARN("sd", "DiscoveryService: setsockopt failed: " << errno);
return; // would be better to throw, but unsure if caller handles that
}
+ */
}
DiscoveryService::~DiscoveryService()
{
-#ifdef WNT
- closesocket( mSocket );
-#else
- close( mSocket );
-#endif
-}
-
-void SAL_CALL DiscoveryService::run()
-{
- char aBuffer[BUFFER_SIZE];
- while ( true )
- {
- memset( aBuffer, 0, sizeof(char) * BUFFER_SIZE );
- sockaddr_in aAddr;
- socklen_t aLen = sizeof( aAddr );
- recvfrom( mSocket, aBuffer, BUFFER_SIZE, 0, (sockaddr*) &aAddr, &aLen );
- OString aString( aBuffer, strlen( "LOREMOTE_SEARCH" ) );
- if ( aString == "LOREMOTE_SEARCH" )
- {
- OStringBuffer aStringBuffer("LOREMOTE_ADVERTISE\n");
- aStringBuffer.append( OUStringToOString(
- osl::SocketAddr::getLocalHostname(), RTL_TEXTENCODING_UTF8 ) )
- .append( "\n\n" );
- if ( sendto( mSocket, aStringBuffer.getStr(),
- aStringBuffer.getLength(), 0, (sockaddr*) &aAddr,
- sizeof(aAddr) ) <= 0 )
- {
- // Read error or closed socket -- we are done.
- return;
- }
- }
- }
+// #ifdef WNT
+// closesocket( mSocket );
+// #else
+// close( mSocket );
+// #endif
+// }
+
+// void SAL_CALL DiscoveryService::run()
+// {
+// char aBuffer[BUFFER_SIZE];
+// while ( true )
+// {
+// memset( aBuffer, 0, sizeof(char) * BUFFER_SIZE );
+// sockaddr_in aAddr;
+// socklen_t aLen = sizeof( aAddr );
+// recvfrom( mSocket, aBuffer, BUFFER_SIZE, 0, (sockaddr*) &aAddr, &aLen );
+// OString aString( aBuffer, strlen( "LOREMOTE_SEARCH" ) );
+// if ( aString == "LOREMOTE_SEARCH" )
+// {
+// OStringBuffer aStringBuffer("LOREMOTE_ADVERTISE\n");
+// aStringBuffer.append( OUStringToOString(
+// osl::SocketAddr::getLocalHostname(), RTL_TEXTENCODING_UTF8 ) )
+// .append( "\n\n" );
+// if ( sendto( mSocket, aStringBuffer.getStr(),
+// aStringBuffer.getLength(), 0, (sockaddr*) &aAddr,
+// sizeof(aAddr) ) <= 0 )
+// {
+// // Read error or closed socket -- we are done.
+// return;
+// }
+// }
+// }
}
DiscoveryService *sd::DiscoveryService::spService = NULL;
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.hxx b/sd/source/ui/remotecontrol/DiscoveryService.hxx
index b47f04904df4..a50454b6d545 100644
--- a/sd/source/ui/remotecontrol/DiscoveryService.hxx
+++ b/sd/source/ui/remotecontrol/DiscoveryService.hxx
@@ -48,7 +48,7 @@ namespace sd
virtual void SAL_CALL run();
// osl::DatagramSocket mSocket;
- int mSocket;
+ // int mSocket;
};
}