Topics

#BluetoothMesh self provisioning & configuration for Generic Models for testing #bluetoothmesh


Vikrant More <vikrant8051@...>
 

Hello World !!
-----------------------------------------------------------------------------------------------------------------------------

{
  "$schema":"file:\/\/\/BlueZ\/Mesh\/schema\/mesh.jsonschema",
  "meshName":"BT Mesh",
  "IVindex":5,
  "IVupdate":0,
  "netKeys":[
    {
      "index":0,
      "keyRefresh":0,
      "key":"18eed9c2a56add85049ffc3c59ad0e12"
    }
  ],
  "appKeys":[
    {
      "index":0,
      "boundNetKey":0,
      "key":"4f68ad85d9f48ac8589df665b6b49b8a"
    },
    {
      "index":1,
      "boundNetKey":0,
      "key":"2aa2a6ded5a0798ceab5787ca3ae39fc"
    }
  ],
  "provisioners":[
    {
      "provisionerName":"BT Mesh Provisioner",
      "unicastAddress":"0077",
      "allocatedUnicastRange":[
        {
          "lowAddress":"0100",
          "highAddress":"7fff"
        }
      ]
    }
  ],
}

-----------------------------------------------------------------------------------------------------------------------------

This is my prov_db.json from #meshctl.

By taking reference from, zephyr/samples/bluetooth/mesh_demo/src/main.c I have added following things in my code

1)

static const u8_t net_key[16] = {
    0x18, 0xee, 0xd9, 0xc2, 0xa5, 0x6a, 0xdd, 0x85,
    0x04, 0x9f, 0xfc, 0x3c, 0x59, 0xad, 0x0e, 0x12,
};

static const u8_t app_key[16] = {
    0x2a, 0xa2, 0xa6, 0xde, 0xd5, 0xa0, 0x79, 0x8c,
    0xea, 0xb5, 0x78, 0x7c, 0xa3, 0xae, 0x39, 0xfc,
};

static const u8_t dev_key[16] = {
    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
};

static const u16_t net_idx=0;
static const u16_t app_idx=1;
static const u32_t iv_index=5;
static u8_t flags;
static u16_t addr = 0x0100;    //for NODE on which only Model 1000 is activated
//static u16_t addr = 0x0101;  //for NODE on which only Model 1001 is activated
static u32_t seq;

2)

static void bt_ready(int err)
{
   .
   .
   .
   if (err) {
        printk("Provisioning failed (err %d)\n", err);
        return;
    }

    printk("Provisioning completed\n\r");

    configure();
}

3)
static void configure(void)
{
    printk("Configuring...\n");

    #ifdef Model1000
   
    #endif

    #ifdef Model1001
   
    #endif

    printk("Configuring completed\n");

}

Now how to edit configure( ) function, so that Model 1000 will get activated on one nRF52840_PDK board
& Model 1001 will get on another (along with pub & sub configurations ) ??


My ultimate goal is to understand this process & save variables required for Provisioning & Configuration
into external i2c EEPROM (like AT24C04).