beacon diss set dev name

21 posts / 0 new
Last post
anthony42
离线
Last seen:5 years 6 months ago
Joined:2015-07-17 08:21
beacon diss set dev name

你好,

  • how to add Write Dev Name and Read Ori Dev Name Characteristic
  • 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(dist_pnp_id_char),(uint8_t *)和diss_pnp_id_char},
    // PNP ID特征值
    [DIS_IDX_PNP_ID_VAL] = {ATT_CHAR_PNP_ID, PERM(RD, ENABLE), DIS_PNP_ID_LEN, 0, NULL},

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

    //读取ori dev name特征声明
    [DIS_IDX_PNP_ID_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(diss_pnp_id_char),
    sizeof(dist_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},

    • 另一个问题:我可以在普通中添加128位特征吗?

    为什么?the smart phone app need to read write dev name from a 128bit uuid.
    我可以在原始代码上更改基础,还是我必须重写spotar_create_db_req_handler()等代码?
    谢谢!

    设备:
    MT_dialog
    离线
    Last seen:2个月1周前
    Staff
    Joined:2015-06-08 11:34
    嗨Antony42,

    嗨Antony42,

    我想你想从智能手机改变设备的名字是正确的吗?您必须将Permmisions更改为适当的特征,并将写命令处理到DA对于特定IDX,使用Sample128作为引用(Gattc_Write_cmd_ind_handler)。我想你可以,但你要改变一个由sig定义的配置文件。

    Thanks MT_dialog

    anthony42
    离线
    Last seen:5 years 6 months ago
    Joined:2015-07-17 08:21
    你好,MT_dialog,

    你好,MT_dialog,
    absolutely right !

  • in fact I need to configure several parameters from smartphone, include :Dev Name, Beacon UUID, Major ID, Minor ID, Measured Power, Adv interval , User Defined
  • and I need to save these info to flash.
    can you give me some suggestions?
    Thanks a lot !

    MT_dialog
    离线
    Last seen:2个月1周前
    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

    anthony42
    离线
    Last seen:5 years 6 months ago
    Joined:2015-07-17 08:21
    嗨mt_dialog,

    嗨mt_dialog,
    I tried but I can't get the right handle index when initialize the data.
    另一个问题:
    why the product header in the following structure is different from AN-B-010 page10 ?
    from beacon ref project:
    #define product_header_position 0x1f000.
    //Product header for SUOTA
    struct product_header.
    {
    UINT8_T签名[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;

    我打印数据,看起来像:
    0x70 0x52 0x0 0x1 0x0 0x80 0x0 0x0 0x0 0x30 0x1 0x0 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
    same with AN-B-010 (signature 7052, version 0100, offset 1, offset 2)
    but p_header.config_offset = ?
    struct config_header is also different from AN-B-010

    谢谢!

    MT_dialog
    离线
    Last seen:2个月1周前
    Staff
    Joined:2015-06-08 11:34
    Hi antony42

    Hi antony42

    你是什​​么意思是不同的,你无法看到偏移量下的其他字段#2字段?这是因为其他字段没有从信标应用程序中使用。您无法读取CONFIG_OFFSET,因为您必须在SPI中加载标题才能读取它,您可以使用SMART SCIPPETS专有头程序员来设置CONFIG_OFFSET和BEACON配置。

    谢谢mt_dialog。

    anthony42
    离线
    Last seen:5 years 6 months ago
    Joined:2015-07-17 08:21
    嗨mt_dialog,

    嗨mt_dialog,

    在UM-B-019(信标参考)中9.7.1内存映射:
    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
    [6]的第6.1节,用于定义配置区域的内存地址。地址必须点
    the start of an SPI Flash sector and no other information must be stored in the same sector.
    [6]的第6.1节在哪里
    the UM says use first four bytes of the ‘Reserved’ field to store Configuration address,

  • what product_header.config_offset for?
  • 我需要添加到以下标题TXT文件中的哪个字段?
  • struct product_header.
    {
    UINT8_T签名[2];
    uint8_t版本[2];
    uint32_t reserved[4];
    uint32_t config_offset;
    };
    现在我的标题文件(.txt文件)是:
    2 signature Product header signature. Must contain 0x7052
    2版本产品标题版本
    4 offset1 Memory offset of image header #1 in LE format
    4 offset2在Le格式中图像标题#2的内存偏移量
    用专有标题编程器打开,并设置右侧值7052,0001,00800000,00300100。

    谢谢!

    MT_dialog
    离线
    Last seen:2个月1周前
    Staff
    Joined:2015-06-08 11:34
    嗨Antony42,

    嗨Antony42,

    产品标题应在se的形式condary bootloader header. You can use the 12byte offset (BDaddress) or place some padding and use the 17byte (Reserved) offset in order to put the address of the Configuration header format. The product_header.config_offset will contain the offset of the product header that resides the address of the configuration header. You should add an extra field in the product_header.txt in order to place the address of the configuration header file. That configuration offset will point to the configuration header. The configuration data are placed below the configuration header in byte offset 64.

    Thanks MT_dialog

    anthony42
    离线
    Last seen:5 years 6 months ago
    Joined:2015-07-17 08:21
    Hi MT_Dialog,

    Hi MT_Dialog,
    我不完全明白。

    1. the header in second bootloader is :
    2. //product header structure
      typedef struct __productheader {
      uint8 signature[2];
      uint8 version[2];
      UINT32_T OFFSET1;
      uint32_t offset2;
      }s_productHeader;

    3. 在Beacon Ref中是:
    4. //Product header for SUOTA
      struct product_header.
      {
      UINT8_T签名[2];
      uint8_t版本[2];
      uint32_t reserved[4];
      uint32_t config_offset;//why this is different from above one?
      };

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

  • 当我尝试在Product_header.txt中添加一个字段时,它会提醒错误,“最多只支持4个参数!”,所以怎么做?
  • can I just use a fixed address in the program, so always read config data from 0x1f000 + sizeof(struct product_header) ?
  • 谢谢!

    MT_dialog
    离线
    Last seen:2个月1周前
    Staff
    Joined:2015-06-08 11:34
    Hi antony42

    Hi antony42

    The above 2 structs are different because in beacon we don't specify the image offsets and we just add some
    padding uint32_t reserved[4].

    1-uint32_t用于图像offset1,2-uint32_t的图像offset2,3-4 uint32_t为dbaddress和一些额外的
    保留数据。

    在信标应用程序中,如果配置已启用,则必须在产品中添加额外的字段
    header....configOffset for instance. Then after you make the product_header.txt you can go from the smart
    snippets tool and add the values to the corresponding fields. The app_read_config_header will find the
    product_header and read the config_offset of the configuration header......from then the app_read_config
    data will populate the corresponding struct with the configuration data. You can make the product header to
    对应于如此:

    Create a product_header.txt file and add the following fields

    2 String Signature Product Header Signature(7052)
    2 String Version Product Header Version
    16整数保留保留填充
    4 Integer ConfigOffset配置

    是的,我想你可以使用硬编码地址并从那里读取配置数据。

    Thanks MT_dialog

    anthony42
    离线
    Last seen:5 years 6 months ago
    Joined:2015-07-17 08:21
    Hi MT_Dialog,

    Hi MT_Dialog,

    1. I want to add a led to a beacon, when a device connected then turn the led on.
      I called led_on() in app_connection_func, set pin low,
      但是LED只有闪烁一次,我找不到IO输出设置得高?
    2. 在app_button_press_callback()

      app_adv_stop();
      switch(app_advertise_mode)
      {
      案例GAPM_ADV_NON_CONN:

      app_advertise_mode = gapm_adv_undirect;
      休息;

      case GAPM_ADV_UNDIRECT:
      app_advertise_mode = GAPM_ADV_NON_CONN;
      休息;
      }
      this will change the advertise mode, but it doesn't call app_adv_start(), so when the advertise mode will change?

    3. 我什么时候需要定义cfg_connectable_adv_mode?
      can you explain more about app_asynch_trm()

      this func also has the code:
      switch(app_advertise_mode)
      {
      案例GAPM_ADV_NON_CONN:

      app_advertise_mode = gapm_adv_undirect;
      休息;

      case GAPM_ADV_UNDIRECT:
      app_advertise_mode = GAPM_ADV_NON_CONN;
      休息;
      }
      I need to add to button to change the advertise mode.

    4. when I set a timer(500ms) in app_button_press_callback,
      定时器立即触发,然后我设置了一个标志,
      in the following, works fine,为什么?
      app_adv_undirect_complete
      {
      if (flag) {
      set_timer();
      国旗= false;
      }
      在计时器处理程序中,我清除了另一个计时器,不行,
      set another flag like above, I cleared the timer successfully,为什么?

    谢谢,
    Anthony

    MT_dialog
    离线
    Last seen:2个月1周前
    Staff
    Joined:2015-06-08 11:34
    嗨Antony,

    嗨Antony,

    您可以定义您的设备将在DA14580_Config中的可连接工作中工作.H检查您正在使用的Dev套件并定义CFG_CONNECTABLE_ADV_MODEin 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作为我在非可连接模式之间提到的设备周期。由于App_adv_stop()发出的app_adk.c案Gapm_adv_undirect,该设备再次启动广告案例Gapm_adv_non_conn。如果您尝试从外部中断设置计时器,请在App_button_press_cb()函数中建议SmartTag参考设计,并检查此外常见问题解答http://support.dialog-semiconductor.com/faq-page#n1508

    Thanks MT_dialog

    anthony42
    离线
    Last seen:5 years 6 months ago
    Joined:2015-07-17 08:21
    Hi MT_dialog

    Hi MT_dialog

    1. 在app_adv_undirect_complete()中:
      call app_timer_set(APP_RESTART_ADV_TIMER, TASK_APP, timer_ticks) to restart adv,
      is this the method to advertise periodically?
      I set a breakpoint in this func, seems this function was not called, but app_adv_stop() will do.
    2. As you mentioned "The device starts advertising again because of the app_adv_undirect_complete()
      which is issued from the app_adv_stop() ",
      now I need to store 10 different adv data in an array, and advertise array[0], then array[1] ...
      each one is 32 bytes.
      I think add code to app_adv_undirect_complete() is a good choice,
      我可以单独设置adv间隔,并在app_restart_adv_timer处理程序中更改adv数据。
      所以如何在每次广告后调用app_adv_undirect_complete()?
      is this possible or any other better solution?

    谢谢,
    Anthony

    MT_dialog
    离线
    Last seen:2个月1周前
    Staff
    Joined:2015-06-08 11:34
    嗨Antony,

    嗨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

    anthony42
    离线
    Last seen:5 years 6 months ago
    Joined:2015-07-17 08:21
    Hi MT_dialog

    Hi MT_dialog

    In the app_restart_adv_timer_handler:
    app_adv_start();
    app_adv_stop();//can I add this here to call app_adv_undirect_complete?
    return (KE_MSG_CONSUMED);

    • 我需要在X MS之后宣传Adv_Data_Array1,宣传Adv_Data_Array2一次,。。。
    • how can I know one advertising has finished?
      when should I call app_adv_stop()?

    谢谢,
    Anthony

    MT_dialog
    离线
    Last seen:2个月1周前
    Staff
    Joined:2015-06-08 11:34
    嗨Antony42,

    嗨Antony42,

    When the da boots you can start advertise and start a timer, when the timer elapses you can call app_adv_stop(), when the advertising stops, the app_adv_undirect_complete will execute (this functions executes right after you invoke app_adv_stop whether is undirect advertising or non-connectable) and then you can call the app_adv_start(); You can change your advertising string in the app_adv_func() if you like where the advertising string is populated.

    Thanks MT_dialog

    anthony42
    离线
    Last seen:5 years 6 months ago
    Joined:2015-07-17 08:21
    嗨mt_dialog,

    嗨mt_dialog,
    Thank you for your reply, I will try it.
    when I call app_adv_start(), the advertise start, not once, it is continuously,

    1. 内核中有一个计时器重启广告,对吗?
    2. 如何保证广告Data1只有一次,那么广告Data2,Data3 ...

    谢谢,
    Anthony

    MT_dialog
    离线
    Last seen:2个月1周前
    Staff
    Joined:2015-06-08 11:34
    嗨Antony,

    嗨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,invoke app_adv_stopand restart advertising when you get the indication that the advertising has been stopped.

    Thanks MT_dialog

    anthony42
    离线
    Last seen:5 years 6 months ago
    Joined:2015-07-17 08:21
    嗨mt_dialog,

    嗨mt_dialog,

    非常感谢你!
    它现在正在运作。

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

    in timer handler()
    {
    app_adv_stop();
    }

    我将定时器与副房(100ms)设置相同的值,
    and from the sniffer I can see that each adv data only advertising once!

    谢谢,
    Anthony

    anthony42
    离线
    Last seen:5 years 6 months ago
    Joined:2015-07-17 08:21
    嗨mt_dialog,

    嗨mt_dialog,

    谢谢你的回复。
    now it works fine, I set flags in button_press_callback() and set/clear timer in app_adv_undirect_complete().
    I also found two old but useful topics:
    http://support.dialog-semiconductor.com/ketimerset-not-executewhy
    http://support.dialog-semicondiondiond.com/problem-about-wakeup-timer-inter ...

    顺便说一下,如果我使用ext睡眠,则无需使用__attribute __((部分(“保留_mem_area0”),zero_init)
    is this correct?

    谢谢,
    Anthony

    MHv_Dialog
    离线
    Last seen:2 months 2 days ago
    Staff
    Joined:2013-12-06 15:10
    你好,

    你好,

    That is correct. In extended sleep, all data in RAM, including global variables, is retained.

    Topic locked