杰里之弹窗 发数据函数实体【篇】

static void reflash_adv_tag_data(const u8 *tag_data, u8 len, u8 spec_val)
{
u8 tmp_tag_data[32];
u8 tmp8;

memcpy(tmp_tag_data, tag_data, len);
memcpy(&tmp_tag_data[14], dev_battery_level, 3);

u8 cur_ear_pos = 'L';

#if TCFG_CHARGESTORE_ENABLE
log_info(“get pos form chargesstore\n”);
cur_ear_pos = chargestore_get_earphone_pos();
#else
#if TCFG_USER_TWS_ENABLE
cur_ear_pos = bt_tws_get_local_channel();
#endif
#endif

//位置14,15,16 对应 R,L,BOX
if (cur_ear_pos != 'R') {
    //switch position
    ble_puts("is L pos\n");
    tmp8 = tmp_tag_data[14];
    tmp_tag_data[14] = tmp_tag_data[15];
    tmp_tag_data[15] = tmp8;
} else {
    ble_puts("is R pos\n");
}

if (spec_val != 0xff) {
    tmp_tag_data[17] = spec_val;
    if (spec_val != 9) {

#if TCFG_USER_TWS_ENABLE
/* memset(&tmp_tag_data[14],0xff,3); */
#endif
} else {
memset(&tmp_tag_data[14], 0xFF, 3);//关闭广播的时候不显示电量
}
}

//---

#if (!REFLASH_ICON_STATE) //
if (len == 29) {
#if TCFG_USER_TWS_ENABLE
//fixed do,start,固定分开显示电量,如不分开,可以屏蔽这段代码
ble_puts(“fixed two do\n”);
/* ble_put_buf(&tmp_tag_data[14],3); */
if ((tmp_tag_data[14] != 0xff)
&& (tmp_tag_data[15] != 0xff)) {
if ((tmp_tag_data[14]&BIT(7))
&& (tmp_tag_data[15]&BIT(7))) {
tmp_tag_data[15] &= 0x7f;
ble_puts(“fixed c1\n”);
} else {
if (((tmp_tag_data[14]&BIT(7)) == 0)
&& ((tmp_tag_data[15]&BIT(7)) == 0)) {
tmp_tag_data[14] |= BIT(7);
ble_puts(“fixed c2\n”);
}

        }

    }
    //fixed do,end

#endif
}
#endif
//—

bt_ble_adv_enable(0);

if (send_sync_pos_flag) {
    u8 pos_state[2];
    //L
    if (tmp_tag_data[15] == 0xff) {
        pos_state[0] = PBG_POS_NOT_EXIST;
    } else if (tmp_tag_data[15] & BIT(7)) {
        pos_state[0] = PBG_POS_IN_BOX;
    } else {
        pos_state[0] = PBG_POS_OUT_BOX;
    }

    //R
    if (tmp_tag_data[14] == 0xff) {
        pos_state[1] = PBG_POS_NOT_EXIST;
    } else if (tmp_tag_data[14] & BIT(7)) {
        pos_state[1] = PBG_POS_IN_BOX;
    } else {
        pos_state[1] = PBG_POS_OUT_BOX;
    }
    send_sync_pos_flag  = 0;
    pbg_user_battery_level_sync(&tmp_tag_data[14]);
    pbg_user_ear_pos_sync(pos_state[0], pos_state[1]);
}

make_set_adv_data(tmp_tag_data, len);
bt_ble_adv_enable(1);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Rambo-Lamborghini

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值