Created
January 10, 2023 17:11
-
-
Save meganetaaan/40a7c31d9b372f2c7d962a078121cab8 to your computer and use it in GitHub Desktop.
BLEのアドバタイジングパケットのユーザ定義領域の値を動的に変えるテスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BLEServer from "bleserver"; | |
import Timer from "timer"; | |
let count = 0; | |
class Advertiser extends BLEServer { | |
onReady() { | |
} | |
onConnected(connection) { | |
this.stopAdvertising(); | |
} | |
onDisconnected(connection) { | |
} | |
} | |
let advertiser = new Advertiser(); | |
Timer.repeat(() => { | |
count++; | |
advertiser.startAdvertising({ | |
advertisingData: { | |
flags: 6, | |
completeName: "M5Stack", | |
manufacturerSpecific: { | |
identifier: 0x39, | |
data: [ count ], | |
}, | |
}, | |
}); | |
}, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"include": [ | |
"$(MODDABLE)/examples/manifest_base.json", | |
"$(MODDABLE)/modules/network/ble/manifest_server.json" | |
], | |
"modules": { | |
"*": [ | |
"./main" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment