Skip to content

Commit 0ee61c9

Browse files
Merge pull request #203 from TakayukiHoshi1984/feature_midi_plugin
MIDI プラグイン動作確認用の画面を追加
2 parents 3197c69 + 1dd150f commit 0ee61c9

8 files changed

Lines changed: 614 additions & 4 deletions

File tree

dConnectJavascriptApp/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@
6262
<script src="./js/profile/fabo.js" type="text/javascript"></script>
6363
<script src="./js/profile/mouse.js" type="text/javascript"></script>
6464
<script src="./js/profile/keyboard.js" type="text/javascript"></script>
65+
<script src="./js/profile/midi.js" type="text/javascript"></script>
66+
<script src="./js/profile/soundModule.js" type="text/javascript"></script>
67+
<script src="./js/profile/soundController.js" type="text/javascript"></script>
68+
<script src="./js/profile/volumeController.js" type="text/javascript"></script>
6569
<script src="./js/profile/device.js" type="text/javascript"></script>
6670
<script src="./js/sdk/util.js" type="text/javascript"></script>
6771
<script src="./js/demo.js" type="text/javascript"></script>

dConnectJavascriptApp/js/demo.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ const appScoepes = ['servicediscovery', 'serviceinformation', 'system',
1818
'tv', 'powermeter','humidity','illuminance', 'videochat',
1919
'airconditioner','gpio', 'ecg', 'stressEstimation', 'poseEstimation',
2020
'walkState', 'messagehook', 'atmosphericPressure', 'geolocation',
21-
'echonetLite', 'power', 'fabo', 'mouse', 'keyboard', 'device'];
21+
'echonetLite', 'power', 'fabo', 'mouse', 'keyboard',
22+
'midi', 'soundModule', 'soundController', 'volumeController', 'device'];
2223
/** IPアドレスを保持する. */
2324
let ip;
2425
/** 画像読み込み中Flag. */
@@ -387,6 +388,14 @@ function searchProfile(serviceId, profile) {
387388
showMouse(serviceId);
388389
} else if (isEqualToStringIgnoreCase(profile, 'keyboard')) {
389390
showKeyboard(serviceId);
391+
} else if (isEqualToStringIgnoreCase(profile, 'midi')) {
392+
showMidi(serviceId);
393+
} else if (isEqualToStringIgnoreCase(profile, 'soundModule')) {
394+
showSoundModule(serviceId);
395+
} else if (isEqualToStringIgnoreCase(profile, 'soundController')) {
396+
showSoundController(serviceId);
397+
} else if (isEqualToStringIgnoreCase(profile, 'volumeController')) {
398+
showVolumeController(serviceId);
390399
} else if (isEqualToStringIgnoreCase(profile, 'device')) {
391400
showDevice(serviceId);
392401
}

dConnectJavascriptApp/js/profile/keyevent.js

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,24 @@ function showKeyChangeEvent(serviceId) {
108108
str += '<input type="text" id="idD" width="100%">';
109109
str += '<input type="text" id="configD" width="100%">';
110110
str += '</form>';
111+
str += '<hr>';
112+
str += '<div>イベント登録状態: <span id="statusOnKeyChange"></span></div>';
113+
str += '<fieldset class="ui-grid-a">';
114+
str += '<div class="ui-block-a"><button id="btnRegisterOnKeyChange">登録</button></div>';
115+
str += '<div class="ui-block-b"><button id="btnUnegisterOnKeyChange">解除</button></div>';
116+
str += '</fieldset>';
111117
reloadContent(str);
112118

119+
$('#btnRegisterOnKeyChange').on('click', function() {
120+
doKeyChangeRegister(serviceId);
121+
});
122+
$('#btnUnegisterOnKeyChange').on('click', function() {
123+
doKeyChangeUnregister(serviceId);
124+
});
125+
113126
doKeyChangeRegister(serviceId);
114127
}
115128

116-
117-
118-
119129
/**
120130
* Show OnDown
121131
*
@@ -188,8 +198,21 @@ function showDownEvent(serviceId) {
188198
str += '<input type="text" id="idD" width="100%">';
189199
str += '<input type="text" id="configD" width="100%">';
190200
str += '</form>';
201+
str += '<hr>';
202+
str += '<div>イベント登録状態: <span id="statusOnDown"></span></div>';
203+
str += '<fieldset class="ui-grid-a">';
204+
str += '<div class="ui-block-a"><button id="btnRegisterOnDown">登録</button></div>';
205+
str += '<div class="ui-block-b"><button id="btnUnegisterOnDown">解除</button></div>';
206+
str += '</fieldset>';
191207
reloadContent(str);
192208

209+
$('#btnRegisterOnDown').on('click', function() {
210+
doDownRegister(serviceId);
211+
});
212+
$('#btnUnegisterOnDown').on('click', function() {
213+
doDownUnregister(serviceId);
214+
});
215+
193216
doDownRegister(serviceId);
194217
}
195218

@@ -266,8 +289,21 @@ function showUpEvent(serviceId) {
266289
str += '<input type="text" id="idU" width="100%">';
267290
str += '<input type="text" id="configU" width="100%">';
268291
str += '</form>';
292+
str += '<hr>';
293+
str += '<div>イベント登録状態: <span id="statusOnUp"></span></div>';
294+
str += '<fieldset class="ui-grid-a">';
295+
str += '<div class="ui-block-a"><button id="btnRegisterOnUp">登録</button></div>';
296+
str += '<div class="ui-block-b"><button id="btnUnegisterOnUp">解除</button></div>';
297+
str += '</fieldset>';
269298
reloadContent(str);
270299

300+
$('#btnRegisterOnUp').on('click', function() {
301+
doUpRegister(serviceId);
302+
});
303+
$('#btnUnegisterOnUp').on('click', function() {
304+
doUpUnregister(serviceId);
305+
});
306+
271307
doUpRegister(serviceId);
272308
}
273309

@@ -313,6 +349,7 @@ function doKeyChangeEventBack(serviceId) {
313349
* Key Change Event Register.
314350
*/
315351
function doKeyChangeRegister(serviceId) {
352+
$('#statusOnKeyChange').text('登録処理中...');
316353
sdk.addEventListener({
317354
profile: 'keyevent',
318355
attribute: 'onkeychange',
@@ -331,14 +368,18 @@ function doKeyChangeRegister(serviceId) {
331368
$('#idD').val('KeyID: ' + json.keyevent.id);
332369
$('#configD').val('config: ' + json.keyevent.config);
333370
}
371+
}).then(json => {
372+
$('#statusOnKeyChange').text('登録済み');
334373
}).catch(e => {
374+
$('#statusOnKeyChange').text('登録失敗');
335375
alert(e.errorMessage);
336376
});
337377
}
338378
/**
339379
* Down Event Register.
340380
*/
341381
function doDownRegister(serviceId) {
382+
$('#statusOnDown').text('登録処理中...');
342383
sdk.addEventListener({
343384
profile: 'keyevent',
344385
attribute: 'ondown',
@@ -356,7 +397,10 @@ function doDownRegister(serviceId) {
356397
$('#idD').val('KeyID: ' + json.keyevent.id);
357398
$('#configD').val('config: ' + json.keyevent.config);
358399
}
400+
}).then(json => {
401+
$('#statusOnDown').text('登録済み');
359402
}).catch(e => {
403+
$('#statusOnDown').text('登録失敗');
360404
alert(e.errorMessage);
361405
});
362406
}
@@ -365,6 +409,7 @@ function doDownRegister(serviceId) {
365409
* Up Event Register.
366410
*/
367411
function doUpRegister(serviceId) {
412+
$('#statusOnUp').text('登録処理中...');
368413
sdk.addEventListener({
369414
profile: 'keyevent',
370415
attribute: 'onup',
@@ -382,7 +427,10 @@ function doUpRegister(serviceId) {
382427
$('#idU').val('KeyID: ' + json.keyevent.id);
383428
$('#configU').val('config: ' + json.keyevent.config);
384429
}
430+
}).then(json => {
431+
$('#statusOnUp').text('登録済み');
385432
}).catch(e => {
433+
$('#statusOnUp').text('登録失敗');
386434
alert(e.errorMessage);
387435
});
388436
}
@@ -391,27 +439,36 @@ function doUpRegister(serviceId) {
391439
* Key Change Event Unregist
392440
*/
393441
function doKeyChangeUnregister(serviceId) {
442+
$('#statusOnKeyChange').text('解除処理中...');
394443
sdk.removeEventListener({
395444
profile: 'keyevent',
396445
attribute: 'onkeychange',
397446
params: {
398447
serviceId: serviceId
399448
}
449+
}).then(json => {
450+
$('#statusOnKeyChange').text('解除済み');
400451
}).catch(e => {
452+
$('#statusOnKeyChange').text('解除失敗');
401453
alert(e.errorMessage);
402454
});
403455
}
456+
404457
/**
405458
* Down Event Unregist
406459
*/
407460
function doDownUnregister(serviceId) {
461+
$('#statusOnDown').text('解除処理中...');
408462
sdk.removeEventListener({
409463
profile: 'keyevent',
410464
attribute: 'ondown',
411465
params: {
412466
serviceId: serviceId
413467
}
468+
}).then(json => {
469+
$('#statusOnDown').text('解除済み');
414470
}).catch(e => {
471+
$('#statusOnDown').text('解除失敗');
415472
alert(e.errorMessage);
416473
});
417474
}
@@ -420,13 +477,17 @@ function doDownUnregister(serviceId) {
420477
* Up Event Unregist
421478
*/
422479
function doUpUnregister(serviceId) {
480+
$('#statusOnUp').text('解除処理中...');
423481
sdk.removeEventListener({
424482
profile: 'keyevent',
425483
attribute: 'onup',
426484
params: {
427485
serviceId: serviceId
428486
}
487+
}).then(json => {
488+
$('#statusOnUp').text('解除済み');
429489
}).catch(e => {
490+
$('#statusOnUp').text('解除失敗');
430491
alert(e.errorMessage);
431492
});
432493
}

0 commit comments

Comments
 (0)