質問編集履歴
2
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
```
|
16
16
|
|
17
|
-
error
|
17
|
+
**error**
|
18
18
|
|
19
19
|
Execute : requestDevice
|
20
20
|
|
@@ -30,37 +30,7 @@
|
|
30
30
|
|
31
31
|
```
|
32
32
|
|
33
|
-
/*
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
**bluejelly.js**
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
Web Bluetooth API Wrapper Library
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
Copyright 2017 JellyWare Inc.
|
46
|
-
|
47
|
-
http://jellyware.jp/
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
GitHub
|
52
|
-
|
53
|
-
https://github.com/electricbaka/bluejelly
|
54
|
-
|
55
|
-
This software is released under the MIT License.
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
Web Bluetooth API
|
60
|
-
|
61
|
-
https://webbluetoothcg.github.io/web-bluetooth/
|
62
|
-
|
63
|
-
*/
|
64
34
|
|
65
35
|
|
66
36
|
|
@@ -504,6 +474,8 @@
|
|
504
474
|
|
505
475
|
```
|
506
476
|
|
477
|
+
**scan.html**
|
478
|
+
|
507
479
|
<!doctype html>
|
508
480
|
|
509
481
|
|
@@ -642,6 +614,6 @@
|
|
642
614
|
|
643
615
|
|
644
616
|
|
645
|
-
html
|
617
|
+
参考サイト([bluejelly](http://jellyware.jp/kurage/bluejelly/scan.html))にある、「serviceのUUIDとCharacteristicのUUID」の意味も教えていただきたいです。
|
646
618
|
|
647
619
|
ご教示お願いします。
|
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,11 +32,11 @@
|
|
32
32
|
|
33
33
|
/*
|
34
34
|
|
35
|
-
|
35
|
+
|
36
36
|
|
37
37
|
BlueJelly.js
|
38
38
|
|
39
|
-
|
39
|
+
|
40
40
|
|
41
41
|
Web Bluetooth API Wrapper Library
|
42
42
|
|
@@ -64,11 +64,7 @@
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
-
|
67
|
+
|
68
|
-
|
69
|
-
//BlueJelly constructor
|
70
|
-
|
71
|
-
//--------------------------------------------------
|
72
68
|
|
73
69
|
var BlueJelly = function(){
|
74
70
|
|
@@ -132,11 +128,7 @@
|
|
132
128
|
|
133
129
|
|
134
130
|
|
135
|
-
|
131
|
+
|
136
|
-
|
137
|
-
//scan
|
138
|
-
|
139
|
-
//--------------------------------------------------
|
140
132
|
|
141
133
|
BlueJelly.prototype.scan = function(uuid){
|
142
134
|
|
@@ -156,12 +148,6 @@
|
|
156
148
|
|
157
149
|
|
158
150
|
|
159
|
-
//--------------------------------------------------
|
160
|
-
|
161
|
-
//requestDevice
|
162
|
-
|
163
|
-
//--------------------------------------------------
|
164
|
-
|
165
151
|
BlueJelly.prototype.requestDevice = function(uuid) {
|
166
152
|
|
167
153
|
console.log('Execute : requestDevice');
|
@@ -188,11 +174,7 @@
|
|
188
174
|
|
189
175
|
|
190
176
|
|
191
|
-
|
177
|
+
|
192
|
-
|
193
|
-
//connectGATT
|
194
|
-
|
195
|
-
//--------------------------------------------------
|
196
178
|
|
197
179
|
BlueJelly.prototype.connectGATT = function(uuid) {
|
198
180
|
|
@@ -266,11 +248,7 @@
|
|
266
248
|
|
267
249
|
|
268
250
|
|
269
|
-
|
251
|
+
|
270
|
-
|
271
|
-
//dataChanged
|
272
|
-
|
273
|
-
//--------------------------------------------------
|
274
252
|
|
275
253
|
BlueJelly.prototype.dataChanged = function(self, uuid) {
|
276
254
|
|
@@ -324,11 +302,7 @@
|
|
324
302
|
|
325
303
|
|
326
304
|
|
327
|
-
|
305
|
+
|
328
|
-
|
329
|
-
//write
|
330
|
-
|
331
|
-
//--------------------------------------------------
|
332
306
|
|
333
307
|
BlueJelly.prototype.write = function(uuid, array_value) {
|
334
308
|
|
@@ -370,11 +344,7 @@
|
|
370
344
|
|
371
345
|
|
372
346
|
|
373
|
-
|
347
|
+
|
374
|
-
|
375
|
-
//startNotify
|
376
|
-
|
377
|
-
//--------------------------------------------------
|
378
348
|
|
379
349
|
BlueJelly.prototype.startNotify = function(uuid) {
|
380
350
|
|
@@ -414,11 +384,7 @@
|
|
414
384
|
|
415
385
|
|
416
386
|
|
417
|
-
|
387
|
+
|
418
|
-
|
419
|
-
//stopNotify
|
420
|
-
|
421
|
-
//--------------------------------------------------
|
422
388
|
|
423
389
|
BlueJelly.prototype.stopNotify = function(uuid){
|
424
390
|
|
@@ -458,11 +424,7 @@
|
|
458
424
|
|
459
425
|
|
460
426
|
|
461
|
-
|
427
|
+
|
462
|
-
|
463
|
-
//disconnect
|
464
|
-
|
465
|
-
//--------------------------------------------------
|
466
428
|
|
467
429
|
BlueJelly.prototype.disconnect= function() {
|
468
430
|
|
@@ -504,11 +466,7 @@
|
|
504
466
|
|
505
467
|
|
506
468
|
|
507
|
-
|
469
|
+
|
508
|
-
|
509
|
-
//clear
|
510
|
-
|
511
|
-
//--------------------------------------------------
|
512
470
|
|
513
471
|
BlueJelly.prototype.clear= function() {
|
514
472
|
|
@@ -526,12 +484,6 @@
|
|
526
484
|
|
527
485
|
|
528
486
|
|
529
|
-
//--------------------------------------------------
|
530
|
-
|
531
|
-
//reset(disconnect & clear)
|
532
|
-
|
533
|
-
//--------------------------------------------------
|
534
|
-
|
535
487
|
BlueJelly.prototype.reset= function() {
|
536
488
|
|
537
489
|
console.log('Excute : reset');
|
@@ -552,4 +504,144 @@
|
|
552
504
|
|
553
505
|
```
|
554
506
|
|
507
|
+
<!doctype html>
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
<html>
|
512
|
+
|
513
|
+
<head>
|
514
|
+
|
515
|
+
<meta charset="utf-8">
|
516
|
+
|
517
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
518
|
+
|
519
|
+
<meta name="description" content="BlueJelly">
|
520
|
+
|
521
|
+
<meta name="viewport" content="width=640, maximum-scale=1.0, user-scalable=yes">
|
522
|
+
|
523
|
+
<title>BlueJelly</title>
|
524
|
+
|
525
|
+
<link href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900" rel="stylesheet" type="text/css">
|
526
|
+
|
527
|
+
<link rel="stylesheet" href="style.css">
|
528
|
+
|
529
|
+
<script type="text/javascript" src="bluejelly.js"></script>
|
530
|
+
|
531
|
+
</head>
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
<body>
|
536
|
+
|
537
|
+
<h1></h1>
|
538
|
+
|
539
|
+
<div class="container">
|
540
|
+
|
541
|
+
<div class="title margin">
|
542
|
+
|
543
|
+
<p id="title">BlueJelly Sample</p>
|
544
|
+
|
545
|
+
<p id="subtitle">Hello, BLE</p>
|
546
|
+
|
547
|
+
</div>
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
<div class="contents margin">
|
552
|
+
|
553
|
+
<button id="scan" class="button">Scan</button>
|
554
|
+
|
555
|
+
<hr>
|
556
|
+
|
557
|
+
<div id="device_name"> </div>
|
558
|
+
|
559
|
+
</div>
|
560
|
+
|
561
|
+
<div class="footer margin">
|
562
|
+
|
563
|
+
For more information, see <a href="http://jellyware.jp/kurage" target="_blank">jellyware.jp</a> and <a href="https://github.com/electricbaka/bluejelly" target="_blank">GitHub</a> !
|
564
|
+
|
565
|
+
</div>
|
566
|
+
|
567
|
+
</div>
|
568
|
+
|
569
|
+
<script>
|
570
|
+
|
571
|
+
//--------------------------------------------------
|
572
|
+
|
573
|
+
//Global変数
|
574
|
+
|
575
|
+
//--------------------------------------------------
|
576
|
+
|
577
|
+
//BlueJellyのインスタンス生成
|
578
|
+
|
579
|
+
var ble = new BlueJelly();
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
//--------------------------------------------------
|
586
|
+
|
587
|
+
//ロード時の処理
|
588
|
+
|
589
|
+
//--------------------------------------------------
|
590
|
+
|
591
|
+
window.onload = function () {
|
592
|
+
|
593
|
+
//UUIDの設定
|
594
|
+
|
595
|
+
ble.setUUID("UUID1", "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000");
|
596
|
+
|
597
|
+
}
|
598
|
+
|
599
|
+
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
//--------------------------------------------------
|
604
|
+
|
605
|
+
//Scan後の処理
|
606
|
+
|
607
|
+
//--------------------------------------------------
|
608
|
+
|
609
|
+
ble.onScan = function (deviceName) {
|
610
|
+
|
611
|
+
document.getElementById('device_name').innerHTML = deviceName;
|
612
|
+
|
613
|
+
}
|
614
|
+
|
615
|
+
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
//-------------------------------------------------
|
620
|
+
|
621
|
+
//ボタンが押された時のイベント登録
|
622
|
+
|
623
|
+
//--------------------------------------------------
|
624
|
+
|
625
|
+
document.getElementById('scan').addEventListener('click', function() {
|
626
|
+
|
627
|
+
ble.scan('UUID1');
|
628
|
+
|
629
|
+
});
|
630
|
+
|
631
|
+
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
</script>
|
636
|
+
|
637
|
+
</body>
|
638
|
+
|
639
|
+
</html>
|
640
|
+
|
555
641
|
```
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
html中のUUIDは変更しています。
|
646
|
+
|
647
|
+
ご教示お願いします。
|