File tree Expand file tree Collapse file tree 2 files changed +404
-0
lines changed Expand file tree Collapse file tree 2 files changed +404
-0
lines changed Original file line number Diff line number Diff line change
1
+ /// <reference path="meshblu.d.ts" />
2
+
3
+ import Meshblu = require( 'meshblu' ) ;
4
+
5
+ var UUID = "26de691f-8068-4cdc-907a-4cb5961a1aba" ;
6
+ var TOKEN = "4cb5961a1aba26de691f80684cdc907a" ;
7
+
8
+ var meshblu = Meshblu . createConnection ( {
9
+ uuid : UUID ,
10
+ token : TOKEN
11
+ } ) ;
12
+
13
+ meshblu . data ( {
14
+ uuid : UUID ,
15
+ online : true ,
16
+ x : - 53 ,
17
+ y : 234
18
+ } , function ( result ) {
19
+ console . log ( result ) ;
20
+ } ) ;
21
+
22
+ meshblu . device ( {
23
+ uuid : UUID
24
+ } , function ( result ) {
25
+ console . log ( result ) ;
26
+ } ) ;
27
+
28
+ meshblu . devices ( {
29
+ color : "green"
30
+ } , function ( result ) {
31
+ console . log ( result ) ;
32
+ } ) ;
33
+
34
+ meshblu . generateAndStoreToken ( {
35
+ uuid : UUID
36
+ } , function ( result ) {
37
+ console . log ( result ) ;
38
+ } ) ;
39
+
40
+ meshblu . getdata ( {
41
+ uuid : UUID ,
42
+ start : "2015-04-23T18:25:43.511Z" ,
43
+ finish : "2015-04-24T18:25:43.511Z" ,
44
+ limit : 10
45
+ } , function ( result ) {
46
+ console . log ( result ) ;
47
+ } ) ;
48
+
49
+ meshblu . identify ( ) ;
50
+
51
+ meshblu . message ( {
52
+ devices : [ UUID ] ,
53
+ topic : "status" ,
54
+ payload : {
55
+ online : true
56
+ }
57
+ } , function ( result ) {
58
+ console . log ( result ) ;
59
+ } ) ;
60
+
61
+ meshblu . register ( {
62
+ type : "drone"
63
+ } , function ( result ) {
64
+ console . log ( result ) ;
65
+ } ) ;
66
+
67
+ meshblu . revokeToken ( {
68
+ uuid : UUID ,
69
+ token : TOKEN
70
+ } , function ( result ) {
71
+ console . log ( result ) ;
72
+ } ) ;
73
+
74
+ meshblu . subscribe ( {
75
+ uuid : UUID
76
+ } , function ( result ) {
77
+ console . log ( result ) ;
78
+ } ) ;
79
+
80
+ meshblu . subscribe ( {
81
+ uuid : UUID ,
82
+ types : [ "sent" , "received" ]
83
+ } , function ( result ) {
84
+ console . log ( result ) ;
85
+ } ) ;
86
+
87
+ meshblu . subscribe ( {
88
+ uuid : UUID ,
89
+ types : [ "sent" , "received" ] ,
90
+ topics : [ "device*" , "-*status" ]
91
+ } , function ( result ) {
92
+ console . log ( result ) ;
93
+ } ) ;
94
+
95
+ meshblu . unsubscribe ( {
96
+ uuid : UUID
97
+ } , function ( result ) {
98
+ console . log ( result ) ;
99
+ } ) ;
100
+
101
+ meshblu . unsubscribe ( {
102
+ uuid : UUID ,
103
+ types : [ "sent" , "broadcast" ]
104
+ } , function ( result ) {
105
+ console . log ( result ) ;
106
+ } ) ;
107
+
108
+ meshblu . update ( {
109
+ uuid : UUID ,
110
+ color : "blue"
111
+ } , function ( result ) {
112
+ console . log ( result ) ;
113
+ } ) ;
114
+
115
+ meshblu . whoami ( { } , function ( result ) {
116
+ console . log ( result ) ;
117
+ } ) ;
118
+
119
+ meshblu . unregister ( {
120
+ uuid : UUID
121
+ } , function ( result ) {
122
+ console . log ( result ) ;
123
+ } ) ;
You can’t perform that action at this time.
0 commit comments