-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathohmdAPI.h
72 lines (59 loc) · 2.48 KB
/
ohmdAPI.h
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
/**********************************************************\
Auto-generated ohmdAPI.h
\**********************************************************/
#include <string>
#include <sstream>
#include <boost/weak_ptr.hpp>
#include "JSAPIAuto.h"
#include "BrowserHost.h"
#include "ohmd.h"
#ifndef H_ohmdAPI
#define H_ohmdAPI
class ohmdAPI : public FB::JSAPIAuto
{
public:
////////////////////////////////////////////////////////////////////////////
/// @fn ohmdAPI::ohmdAPI(const ohmdPtr& plugin, const FB::BrowserHostPtr host)
///
/// @brief Constructor for your JSAPI object.
/// You should register your methods, properties, and events
/// that should be accessible to Javascript from here.
///
/// @see FB::JSAPIAuto::registerMethod
/// @see FB::JSAPIAuto::registerProperty
/// @see FB::JSAPIAuto::registerEvent
////////////////////////////////////////////////////////////////////////////
ohmdAPI(const ohmdPtr& plugin, const FB::BrowserHostPtr& host) :
m_plugin(plugin), m_host(host)
{
//registerMethod("echo", make_method(this, &ohmdAPI::echo));
registerProperty("version", make_property(this, &ohmdAPI::get_version));
registerProperty("deviceInfo", make_property(this, &ohmdAPI::get_deviceInfo));
registerProperty("orientation", make_property(this, &ohmdAPI::get_orientation));
registerProperty("acceleration", make_property(this, &ohmdAPI::get_acceleration));
registerProperty("angularVelocity", make_property(this, &ohmdAPI::get_angularVelocity));
}
///////////////////////////////////////////////////////////////////////////////
/// @fn ohmdAPI::~ohmdAPI()
///
/// @brief Destructor. Remember that this object will not be released until
/// the browser is done with it; this will almost definitely be after
/// the plugin is released.
///////////////////////////////////////////////////////////////////////////////
virtual ~ohmdAPI() {};
ohmdPtr getPlugin();
// exported API
std::string get_version();
FB::VariantMap get_deviceInfo();
FB::VariantMap get_orientation();
FB::VariantMap get_acceleration();
FB::VariantMap get_angularVelocity();
//FB::variant echo(const FB::variant& msg);
// Event helpers
//FB_JSAPI_EVENT(test, 0, ());
//FB_JSAPI_EVENT(echo, 2, (const FB::variant&, const int));
private:
ohmdWeakPtr m_plugin;
FB::BrowserHostPtr m_host;
};
#endif // H_ohmdAPI