Navigation

    obniz Developer's Community Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. GDAS
    G
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    GDAS

    @GDAS

    0
    Reputation
    2
    Posts
    1
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    GDAS Follow

    Best posts made by GDAS

    This user hasn't posted anything yet.

    Latest posts made by GDAS

    • RE: BLEデバイスに接続した場合に20秒ほど接続に時間がかかる

      これよりも接続にかかる時間を短くできる方法があればご教示いただければ幸いです。

      posted in Question and Troubles
      G
      GDAS
    • BLEデバイスに接続した場合に20秒ほど接続に時間がかかる

      https://obniz.com/ja/doc/reference/common/ble/central-read-write

      上記のソースコードを利用して、omron環境センサー(2JCIE-BL01)に接続したところ、
      接続処理に毎度20秒ほどかかってしまうようなのですが
      これはこのようなものなのでしょうか。

      ■使用したソースコード

      // Javascript Full Example
      
      var obniz = new Obniz("OBNIZ_ID_HERE");
      obniz.onconnect = async function () {
        await obniz.ble.initWait();
        var peripheral = await obniz.ble.scan.startOneWait({ localName: "Env" });
        if(peripheral) {
          console.log("found");
          try{
            await peripheral.connectWait();
            console.log("connected");
            var service = peripheral.getService("0C4C3000-7700-46F4-AA96D5E974E32A54");
            var char = service.getCharacteristic("0C4C3001-7700-46F4-AA96D5E974E32A54");
            var data = await char.readWait();
            console.log(data); // => ex [0x02, 0xFF]; 
          }catch(e){
            console.log("connection failed");
          }
        }
      }
      

      ■ログ
      68af01d8-f100-4792-9912-42f88ddaf59f-image.png

      posted in Question and Troubles
      G
      GDAS