数据页17是处于连接状态时从ANT+自行车灯广播的数据页之一。所有主灯应根据控制器的要求发送此页面。作为数据页轮发的一部分,可以可选地将此页作为从ANT+自行车灯广播的主要数据页之一包括在内。该消息中的所有字段均应按表7-27所述进行设置。
7.12.1. 软件修订
SW版本由制造商管理,并指定在传输设备上运行的软件的版本。如果字节2和3均有效,则这些字段应解释为主软件版本和补充软件版本。
例如,如果制造商使用软件修订版格式:
软件修订版= 1.380,其中“1.3”是主软件修订版,“80”是补充软件修订版
编码如下:
主软件修订版= 13(因为在此字段中只能发送整数值)
补充软件修订版= 80
如果仅使用“主软件修订”字段,则其值由制造商定义。在这种情况下,补充SW修订字段应设置为0xFF。
/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
#include "ant_BikeLight_page_17.h"
#include "ant_BikeLight_utils.h"
#include "ant_BikeLight_page_logger.h"
#include "SEGGER_RTT.h"
#include "SEGGER_RTT_Conf.h"
#include "main.h"
/**@brief BikeLight 联网灯的产品信息 第17页数据布局结构. */
typedef struct
{
uint8_t Light_Index; //灯光索引 2-63
uint8_t SW_Revision; //软件件修订
uint8_t SW_Revision_Main; //软件件修订
uint8_t Serial_Number_0_7; //序列号(位0 – 7)
uint8_t Serial_Number_8_15; //序列号(位8 – 15)
uint8_t Serial_Number_16_23; //序列号(位16 – 23)
uint8_t Serial_Number_24_31; //序列号(位24 – 31)
} ant_BikeLight_page17_data_layout_t;
static void page17_data_log(ant_BikeLight_page17_data_t const *p_page_data)
{
// SEGGER_RTT_printf(0, "Light_Index: %d\r\n", (uint8_t)p_page_data->Light_Index);
// SEGGER_RTT_printf(0, "AutoIntensityMode: %d\r\n", (uint8_t)p_page_data->Light_Properties_AutoIntensityMode);
// SEGGER_RTT_printf(0, "Beam: %d\r\n", (uint8_t)p_page_data->Light_Properties_Beam);
// SEGGER_RTT_printf(0, "SupportedModes: %d\r\n", (uint8_t)p_page_data->Light_Properties_SupportedModes);
// SEGGER_RTT_printf(0, "Battery_Capacity: %d\r\n", (uint8_t)p_page_data->Battery_Capacity);
}
void ant_BikeLight_page_17_encode(uint8_t *p_page_buffer,
ant_BikeLight_page17_data_t const *p_page_data)
{
ant_BikeLight_page17_data_layout_t *p_outcoming_data = (ant_BikeLight_page17_data_layout_t *)p_page_buffer;
p_outcoming_data->Light_Index = p_page_data->Light_Index;
p_outcoming_data->SW_Revision = p_page_data->SW_Revision;
p_outcoming_data->SW_Revision_Main = p_page_data->SW_Revision_Main;
p_outcoming_data->Serial_Number_0_7 = p_page_data->Serial_Number_0_7;
p_outcoming_data->Serial_Number_8_15 = p_page_data->Serial_Number_8_15;
p_outcoming_data->Serial_Number_16_23 = p_page_data->Serial_Number_16_23;
p_outcoming_data->Serial_Number_24_31 = p_page_data->Serial_Number_24_31;
ANT_PAGE_NEW = 0;
page17_data_log(p_page_data);
}
void ant_BikeLight_page_17_decode(uint8_t const *p_page_buffer,
ant_BikeLight_page17_data_t *p_page_data)
{
ant_BikeLight_page17_data_layout_t const *p_incoming_data =
(ant_BikeLight_page17_data_layout_t *)p_page_buffer;
p_page_data->Light_Index = p_incoming_data->Light_Index;
p_page_data->SW_Revision = p_incoming_data->SW_Revision;
p_page_data->SW_Revision_Main = p_incoming_data->SW_Revision_Main;
p_page_data->Serial_Number_0_7 = p_incoming_data->Serial_Number_0_7;
p_page_data->Serial_Number_8_15 = p_incoming_data->Serial_Number_8_15;
p_page_data->Serial_Number_16_23 = p_incoming_data->Serial_Number_16_23;
p_page_data->Serial_Number_24_31 = p_incoming_data->Serial_Number_24_31;
/*处理信息*/
page17_data_log(p_page_data);
}
/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
#ifndef ANT_BIKELIGHT_PAGE_17_H__
#define ANT_BIKELIGHT_PAGE_17_H__
#include <stdint.h>
typedef struct
{
uint8_t Light_Index; //灯光索引 2-63
uint8_t SW_Revision; //软件件修订
uint8_t SW_Revision_Main; //软件件修订
uint8_t Serial_Number_0_7; //序列号(位0 – 7)
uint8_t Serial_Number_8_15; //序列号(位8 – 15)
uint8_t Serial_Number_16_23; //序列号(位16 – 23)
uint8_t Serial_Number_24_31; //序列号(位24 – 31)
} ant_BikeLight_page17_data_t;
#define DEFAULT_ANT_BikeLight_PAGE17() \
(ant_BikeLight_page17_data_t) \
{ \
.Light_Index = 2, \
.SW_Revision = 81, \
.SW_Revision_Main = 95, \
.Serial_Number_0_7 = 95, \
.Serial_Number_8_15 = 8, \
.Serial_Number_16_23 = 1, \
.Serial_Number_24_31 = 0, \
}
void ant_BikeLight_page_17_encode(uint8_t *p_page_buffer,
ant_BikeLight_page17_data_t const *p_page_data);
void ant_BikeLight_page_17_decode(uint8_t const *p_page_buffer,
ant_BikeLight_page17_data_t *p_page_data);
#endif // ANT_BIKELIGHT_PAGE_17_H__
/** @} */