beacon diss set dev name

21 posts / 0 new
Last post
安东尼42.
Offline
Last seen:5年6个月前
Joined:2015-07-17 08:21
beacon diss set dev name

Hi,

  • 如何添加写开发名称和读取ori dev name特征
  • why Write Dev Name and Read Ori Dev Name use same index ?

    DIS_IDX_IEEE_CHAR,
    DIS_IDX_IEEE_VAL,
    dis_idx_pnp_id_char,
    DIS_IDX_PNP_ID_VAL,
    DIS_IDX_NB,

    // PnP ID Characteristic Declaration
    [DIS_IDX_PNP_ID_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(diss_pnp_id_char),
    sizeof(diss_pnp_id_char), (uint8_t *)&diss_pnp_id_char},
    // PnP ID Characteristic Value
    [DIS_IDX_PNP_ID_VAL] = {ATT_CHAR_PNP_ID, PERM(RD, ENABLE), DIS_PNP_ID_LEN, 0, NULL},

    //读写dev name特征声明
    [DIS_IDX_PNP_ID_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(diss_pnp_id_char),
    sizeof(diss_pnp_id_char), (uint8_t *)&diss_pnp_id_char},
    //读写dev name特征值
    [DIS_IDX_PNP_ID_VAL] = {ATT_CHAR_PNP_ID, PERM(RD, ENABLE), DIS_PNP_ID_LEN, 0, NULL},

    // Read Ori Dev Name Characteristic Declaration
    [DIS_IDX_PNP_ID_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(diss_pnp_id_char),
    sizeof(diss_pnp_id_char), (uint8_t *)&diss_pnp_id_char},
    // Read Ori Dev Name Characteristic Value
    [DIS_IDX_PNP_ID_VAL] = {ATT_CHAR_PNP_ID, PERM(RD, ENABLE), DIS_PNP_ID_LEN, 0, NULL},

    • another question: can I add a 128bit characteristic in diss, and how?

    为什么?智能手机应用程序需要从128bit uuid中读取写开发名称。
    can I change base on the original code, or do I have to rewrite the code like spotar_create_db_req_handler() ?
    Thank you!

    Device:
    MT_dialog
    Offline
    Last seen:2 months 3 weeks ago
    Staff
    Joined:2015-06-08 11:34
    嗨Antony42.,

    嗨Antony42.,

    I guess that you want to change the device's name from smartphone is that correct? You have to change the permmisions to the appropriate characteristics and handle the write commands to the da for the specific IDX, use SAMPLE128 as a reference (gattc_write_cmd_ind_handler). I suppose you can but you are going to change a profile that is defined by the SIG.

    Thanks MT_dialog

    安东尼42.
    Offline
    Last seen:5年6个月前
    Joined:2015-07-17 08:21
    嗨,mt_dialog,

    嗨,mt_dialog,
    absolutely right !

  • 实际上我需要从智能手机配置多个参数,包括:dev名称,信标uuid,主要ID,次要ID,测量功率,adv间隔,用户定义
  • and I need to save these info to flash.
    你能给我一些建议吗?
    Thanks a lot !

    MT_dialog
    Offline
    Last seen:2 months 3 weeks ago
    Staff
    Joined:2015-06-08 11:34
    嗨Antony42.,

    嗨Antony42.,

    I would advise you not to change the DISS profile (you may have compatibility problems with other devices), instead you can include it to your services and create a new custom profile (SAMPLE128 tutorial) with the extra informations you need. As i ve mentioned before the DISS is a service defined from the bluetooth SIG. You can use the Beacon project to handle the advertising of your message.

    Thanks MT_dialog

    安东尼42.
    Offline
    Last seen:5年6个月前
    Joined:2015-07-17 08:21
    嗨mt_dialog.,

    嗨mt_dialog.,
    我尝试了,但在初始化数据时,我无法获得正确的句柄索引。
    another question:
    为什么产品标题以下结构中的不同与AN-B-010 Page10不同?
    from beacon ref project:
    #define PRODUCT_HEADER_POSITION 0x1F000
    // Suota的产品标题
    struct product_header
    {
    uint8_t signature[2];
    uint8_t版本[2];
    uint32_t reserved[4];
    uint32_t config_offset;
    };
    struct product_header p_header;
    spi_flash_read_data((uint8_t*)&p_header, (unsigned long)PRODUCT_HEADER_POSITION, (unsigned long)sizeof(struct product_header));

    app_config_header_offset = p_header.config_offset;

    I printf the data, looks like:
    0x70 0x52 0x0 0x1 0x0 0x80 0x0 0x0 0x0 0x30 0x1 0x0 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
    与AN-B-010相同(签名7052,版本0100,偏移1,偏移2)
    but p_header.config_offset = ?
    struct config_header is also different from AN-B-010

    Thank you!

    MT_dialog
    Offline
    Last seen:2 months 3 weeks ago
    Staff
    Joined:2015-06-08 11:34
    嗨Antony42.

    嗨Antony42.

    你什么意思是不同的,你不能看到不her fields under the Offset #2 field? Thats because the other fields aren't being used from the Beacon application. You cant read the config_offset because you have to load the header in the SPI in order to read it, you can use the Smart Snippets Proprietary header programmer in order to set the config_offset and the beacon configurations.

    Thanks MT_dialog.

    安东尼42.
    Offline
    Last seen:5年6个月前
    Joined:2015-07-17 08:21
    嗨mt_dialog.,

    嗨mt_dialog.,

    In UM-B-019 (beacon reference) 9.7.1 Memory map:
    Configuration storage uses the memory map of the dual image boot loader. More specifically, it uses
    the first four bytes of the ‘Reserved’ field (byte offset 12) in the Product Header, as described in
    section 6.1 of [6], to define the memory address of the configuration area. The address must point at
    the start of an SPI Flash sector and no other information must be stored in the same sector.
    where is section 6.1 of [6]
    UM表示使用“保留”字段的前四个字节来存储配置地址,

  • what product_header.config_offset for?
  • what field do I need to add to the following header txt file ?
  • struct product_header
    {
    uint8_t signature[2];
    uint8_t版本[2];
    uint32_t reserved[4];
    uint32_t config_offset;
    };
    now my header file(.txt file) is:
    2 signature Product header signature. Must contain 0x7052
    2 version Product header version
    4 offset1 Memory offset of image header #1 in LE format
    4 offset2 Memory offset of image header #2 in LE format
    opened with proprietary header programmer and set the right value 7052,0001,00800000,00300100.

    Thank you!

    MT_dialog
    Offline
    Last seen:2 months 3 weeks ago
    Staff
    Joined:2015-06-08 11:34
    嗨Antony42.,

    嗨Antony42.,

    产品标题应为辅助引导程序标题的形式。您可以使用12byte offset(bdaddress)或放置一些填充,并使用17byte(保留)偏移量以放置配置标题格式的地址。product_header.config_offset将包含驻留的偏移量,它位于配置标题的地址。您应该在product_header.txt中添加额外的字段,以便放置配置头文件的地址。配置偏移将指向配置标题。配置数据位于字节偏移64中的配置标题下方。

    Thanks MT_dialog

    安东尼42.
    Offline
    Last seen:5年6个月前
    Joined:2015-07-17 08:21
    嗨mt_dialog,

    嗨mt_dialog,
    I don't fully understand.

    1. 第二个引导加载程序中的标题是:
    2. //产品标题结构
      typedef struct __productHeader {
      uint8 signature[2];
      UINT8版本[2];
      uint32_t offset1;
      uint32_t offset2;
      }s_productHeader;

    3. in beacon ref is:
    4. // Suota的产品标题
      struct product_header
      {
      uint8_t signature[2];
      uint8_t版本[2];
      uint32_t reserved[4];
      uint32_t config_offset; //为什么这与上面不同?
      };

    5. in AN-B-010 page 10:
    6. seems a fully version.
      在这个文件中12 -31 reserved
      32-37 BD地址......

  • when I tried to add a field in the product_header.txt, it alerts error, "only support 4 parameters at most!" , so how to do it?
  • can I just use a fixed address in the program, so always read config data from 0x1f000 + sizeof(struct product_header) ?
  • Thank you!

    MT_dialog
    Offline
    Last seen:2 months 3 weeks ago
    Staff
    Joined:2015-06-08 11:34
    嗨Antony42.

    嗨Antony42.

    以上2个结构是不同的,因为在信标中,我们没有指定图像偏移,我们只添加一些
    填充UINT32_T保留[4]。

    1-uint32_t for image offset1, 2-uint32_t for image offset2, 3-4 uint32_t for the dbaddress and some additional
    reserved data.

    In the beacon application if the CONFIGURATION is enabled you must add an extra field in the product
    header....configOffset for instance. Then after you make the product_header.txt you can go from the smart
    片段工具并将值添加到相应的字段。app_read_config_header会找到
    Product_Header并读取配置标题的Config_offset ......从App_Read_Config
    data will populate the corresponding struct with the configuration data. You can make the product header to
    correspond to the stuct like this:

    Create a product_header.txt file and add the following fields

    2字符串签名产品标题签名(7052)
    2 String Version Product Header Version
    16 Integer Reserved Reserved Padding
    4 Integer ConfigOffset Config

    Yes i suppose you can use a hardcoded address and read the configuration data from there.

    Thanks MT_dialog

    安东尼42.
    Offline
    Last seen:5年6个月前
    Joined:2015-07-17 08:21
    嗨mt_dialog,

    嗨mt_dialog,

    1. 我想将LED添加到信标,当连接的设备然后打开LED时。
      我在app_connection_func中调用LED_ON(),设置PIN低,
      but the led only flash one time, I can not find where the io output was set high?
    2. in app_button_press_callback()

      app_adv_stop();
      switch(app_advertise_mode)
      {
      case GAPM_ADV_NON_CONN:

      app_advertise_mode = GAPM_ADV_UNDIRECT;
      break;

      案例GAPM_ADV_UNDIRECT:
      app_advertise_mode = gapm_adv_non_conn;
      break;
      }
      这将改变广告模式,但它不会调用app_adv_start(),因此当广告模式将改变?

    3. when do I need to define CFG_CONNECTABLE_ADV_MODE ?
      can you explain more about app_asynch_trm()

      此Func还有代码:
      switch(app_advertise_mode)
      {
      case GAPM_ADV_NON_CONN:

      app_advertise_mode = GAPM_ADV_UNDIRECT;
      break;

      案例GAPM_ADV_UNDIRECT:
      app_advertise_mode = gapm_adv_non_conn;
      break;
      }
      I need to add to button to change the advertise mode.

    4. when I set a timer(500ms) in app_button_press_callback,
      the timer was triggered immediately, then I set a flag,
      在下文中,工作正常,为什么?
      app_adv_undirect_complete
      {
      if(标志){
      set_timer();
      国旗= false;
      }
      and in the timer handler, I clear another timer, not ok,
      设置上面的另一个标志,我成功清除了计时器,为什么?

    Thanks,
    安东尼

    MT_dialog
    Offline
    Last seen:2 months 3 weeks ago
    Staff
    Joined:2015-06-08 11:34
    Hi antony,

    Hi antony,

    You can define that your device will work in connectable in da14580_config.h check the dev kit you are using and define thecfg_connectable_adv_mode.in there. You dont need a button to change to connectable mode the device will rotate between connectable and non-connectable mode if the CFG_CONNECTABLE_ADV_MODE is defined. If its not defined then you have to use a button in order to change the adv mode (there is one defined). I suppose that you are using sleep, when your device wakes up the pins return to the state the periph_init() function commands....if you want to keep the button lit you must place a variable that will remember the previous state of your LED and set the coresponding value everytime your da wakes up. In app_asynch_trm if you defined thecfg_connectable_adv_mode.as i 've mentioned the device cycles between the non and connectable mode. The device starts advertising again because of the app_adv_undirect_complete() which is issued from the app_adv_stop() check the app_task.c case GAPM_ADV_UNDIRECT; case GAPM_ADV_NON_CONN. If you are trying to set a timer from an external interrupt please advice the SmartTag Reference design at the app_button_press_cb() function and check this also FAQhttp://support.dialog-semicondiondiondum/faq-page#n1508..

    Thanks MT_dialog

    安东尼42.
    Offline
    Last seen:5年6个月前
    Joined:2015-07-17 08:21
    嗨mt_dialog.

    嗨mt_dialog.

    1. In the app_adv_undirect_complete():
      调用app_timer_set(app_restart_adv_timer,task_app,timer_ticks)重新启动adv,
      这是定期宣传的方法吗?
      I set a breakpoint in this func, seems this function was not called, but app_adv_stop() will do.
    2. 如您所提到的,“由于APP_ADV_UNDIRECT_COMPLETE(),该设备再次启动广告
      从App_adv_stop()发出,
      现在我需要在数组中存储10个不同的adv数据,并宣传阵列[0],然后阵列[1] ...
      每个都是32字节。
      我认为将代码添加到app_adv_undirect_complete()是一个不错的选择,
      I can set the adv interval individually and change adv data in APP_RESTART_ADV_TIMER handler.
      so how to let app_adv_undirect_complete() be called after each advertising?
      这是可能还是其他更好的解决方案?

    Thanks,
    安东尼

    MT_dialog
    Offline
    Last seen:2 months 3 weeks ago
    Staff
    Joined:2015-06-08 11:34
    Hi antony,

    Hi antony,

    The app_adv_undirect() is executed right after adv_stop() is finished and sets the timer in order to start advertising again, just tested, please set your breakpoint on the if statement. Yes you can change the advertise data when the advertising stops. The app_adv_undirect_complete is called every time you stop the advertise.

    Thanks MT_dialog

    安东尼42.
    Offline
    Last seen:5年6个月前
    Joined:2015-07-17 08:21
    嗨mt_dialog.

    嗨mt_dialog.

    In the app_restart_adv_timer_handler:
    app_adv_start();
    app_adv_stop();//我可以在这里添加它来调用app_adv_undirect_complete吗?
    return (KE_MSG_CONSUMED);

    • I need to advertise adv_data_array1 once, after x ms, advertise adv_data_array2 once, . . .
    • 我如何知道一个广告已经完成了?
      when should I call app_adv_stop()?

    Thanks,
    安东尼

    MT_dialog
    Offline
    Last seen:2 months 3 weeks ago
    Staff
    Joined:2015-06-08 11:34
    嗨Antony42.,

    嗨Antony42.,

    当DA靴子您可以启动并启动计时器时,当定时器过去时,您可以调用app_adv_stop(),当广告停止时,app_adv_undirect_complete将执行(此函数在调用app_adv_stop之后执行opp_adv_stop是未连接的广告或不可连接之后)然后你可以调用app_adv_start();如果您喜欢填充广告字符串的位置,您可以在App_adv_Func()中更改广告字符串。

    Thanks MT_dialog

    安东尼42.
    Offline
    Last seen:5年6个月前
    Joined:2015-07-17 08:21
    嗨mt_dialog.,

    嗨mt_dialog.,
    谢谢你的回复,我会尝试一下。
    when I call app_adv_start(), the advertise start, not once, it is continuously,

    1. there is a timer in the kernel to restart advertising, right?
    2. how to guarantee advertising data1 only once, then advertising data2, data3 ...

    Thanks,
    安东尼

    MT_dialog
    Offline
    Last seen:2 months 3 weeks ago
    Staff
    Joined:2015-06-08 11:34
    Hi Antony,

    Hi Antony,

    The advertising procedure is continious, meaning, if you dont send a cancelling command the advertising will continue. If you want to rotate between the 3 advertising strings you can make a switch case in the advertsing function check the current advertising mode and switch to next mode (each mode loads a different advertising string). When the advertsing string is set, a timer that specifies how long the device will advertise in specific mode will be set also. When the timer elapses, change the mode of advertising,调用app_adv_stop.and restart advertising when you get the indication that the advertising has been stopped.

    Thanks MT_dialog

    安东尼42.
    Offline
    Last seen:5年6个月前
    Joined:2015-07-17 08:21
    嗨mt_dialog.,

    嗨mt_dialog.,

    Thank you very much!
    it is working now.

    在app_adv_undirect_complete()
    {
    app_set_timer(x,y);
    app_adv_start();
    }

    在Timer Handler()
    {
    app_adv_stop();
    }

    I set the timer the same value with adversitng interval (100ms),
    and from the sniffer I can see that each adv data only advertising once!

    Thanks,
    安东尼

    安东尼42.
    Offline
    Last seen:5年6个月前
    Joined:2015-07-17 08:21
    嗨mt_dialog.,

    嗨mt_dialog.,

    Thank you for yor reply.
    现在它可以正常工作,我在button_press_callback()中设置标志,并在app_adv_undirect_complete()中设置/清除计时器。
    我也发现了两个旧但有用的主题:
    http://support.dialog-semicondiondiondum/ketcerset-not-execute why.
    http://support.dialog-semiconductor.com/problem-about-wakeup-timer-inter...

    by the way, if I use ext sleep there is no need to use __attribute__((section("retention_mem_area0"),zero_init)
    is this correct?

    Thanks,
    安东尼

    mhv_dialog.
    Offline
    Last seen:2 months 2 weeks ago
    Staff
    Joined:2013-12-06 15:10
    Hi,

    Hi,

    那是正确的。在延长睡眠中,保留包含全局变量的RAM中的所有数据。

    Topic locked