blob: cb43902f177948cff85ad90b987e910b750642e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// **********************************************************************
//
// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef ICE_BT_PLUGIN_H
#define ICE_BT_PLUGIN_H
#include <Ice/Plugin.h>
#ifndef ICEBT_API
# if defined(ICE_STATIC_LIBS)
# define ICEBT_API /**/
# elif defined(ICEBT_API_EXPORTS)
# define ICEBT_API ICE_DECLSPEC_EXPORT
# else
# define ICEBT_API ICE_DECLSPEC_IMPORT
# endif
#endif
namespace IceBT
{
typedef std::map<std::string, std::string> PropertyMap;
typedef std::map<std::string, PropertyMap> DeviceMap;
#ifndef ICE_CPP11_MAPPING
//
// An application can receive discovery notifications
// by implementing the DiscoveryCallback interface.
//
class ICEBT_API DiscoveryCallback : public IceUtil::Shared
{
public:
//
// Called for each discovered device. The same device may be reported multiple times.
// The device's Bluetooth address is provided, along with a map of properties
// supplied by the system's Bluetooth stack.
//
virtual void discovered(const std::string& addr, const PropertyMap& props) = 0;
};
typedef IceUtil::Handle<DiscoveryCallback> DiscoveryCallbackPtr;
#endif
class ICEBT_API Plugin : public Ice::Plugin
{
public:
//
// Start Bluetooth device discovery on the adapter with the specified address.
// The given callback will be invoked for each discovered device. The same
// device may be reported more than once. Discovery remains active until
// explicitly stopped by a call to stopDiscovery(), or via other administrative means.
//
#ifdef ICE_CPP11_MAPPING
virtual void startDiscovery(const std::string& address,
std::function<void(const std::string& addr, const PropertyMap& props)>) = 0;
#else
virtual void startDiscovery(const std::string& address, const DiscoveryCallbackPtr& cb) = 0;
#endif
//
// Stops Bluetooth device discovery on the adapter with the specified address.
// All discovery callbacks are removed when discovery stops.
//
virtual void stopDiscovery(const std::string& address) = 0;
//
// Retrieve a snapshot of all known remote devices. The plug-in obtains a snapshot of the remote devices at
// startup and then dynamically updates its map as the host adds and removes devices.
//
virtual DeviceMap getDevices() const = 0;
};
ICE_DEFINE_PTR(PluginPtr, Plugin);
}
#endif
|