#ifndef BSP_NUMBER_H_
#define BSP_NUMBER_H_

#ifdef __cplusplus
extern "C" {
#endif 

#include "kit_macro.h"

typedef enum
{
    kDevType_Bsu,
    kDevType_Bcu,
    kDevType_Bmu,
    kDevType_End,
}DevType;


#define NUMBER_TYPE_LEN         (4u)
#define NUMBER_APPL_LEN         (4u)
#define NUMBER_VER_LEN          (5)
#define NUMBER_DETAIL_LEN       (3u)

#define NUMBER_JSON_VERSION(major_ver, minor_ver)       ((uint8_t)(major_ver) << 5 | ((minor_ver) & 0x1F))
#define NUMBER_ASSEMBLE(type, appl, ver, detail)        (((uint16_t)type) | ((uint16_t)appl << NUMBER_TYPE_LEN) | \
                                                        ((uint16_t)ver << (NUMBER_TYPE_LEN + NUMBER_APPL_LEN)) | \
                                                        ((uint16_t)detail << (NUMBER_TYPE_LEN + NUMBER_APPL_LEN + NUMBER_VER_LEN)))
/***************************类型编号**********************************/
#define NUMBER_TYPE_BSU         (0u) 
#define NUMBER_TYPE_BCU         (1u)
#define NUMBER_TYPE_BMU         (2u)

#define NUMBER_TYPE_EMS         (12u)
#define NUMBER_TYPE_SERVER		  (13u) //远程服务器
#define NUMBER_TYPE_UPPER		    (14u) //上位机

/*************************应用领域编号********************************/
#define NUMBER_APPL_E           (0u)
#define NUMBER_APPL_V           (1u)
#define NUMBER_APPL_M           (2u)
#define NUMBER_APPL_S           (3u)
#define NUMBER_APPL_C           (4u)
#define NUMBER_APPL_P           (5u)

/***************************版本编号**********************************/
#define NUMBER_VER_A            (0u)
#define NUMBER_VER_B            (1u)
#define NUMBER_VER_C            (2u)
#define NUMBER_VER_D            (3u)
#define NUMBER_VER_E            (4u)
#define NUMBER_VER_F            (5u)

/**************************BCU细分*********************************/
#define NUMBER_BCU_1B            (0u)
#define NUMBER_BCU_2B            (1u)
#define NUMBER_BCU_CR            (2u)
#define NUMBER_BCU_CR_SD         (3u)
/**************************BMU细分*********************************/
#define NUMBER_BMU_16            (0u)
#define NUMBER_BMU_32            (1u)
#define NUMBER_BMU_48            (2u)
#define NUMBER_BMU_64            (3u)
#define NUMBER_BMU_22            (4u)
#define NUMBER_BMU_CMS16S		 (5u)
#define NUMBER_BMU_CMS18S		 (6u)


uint16_t bsp_num_get_product_num(DevType type, uint16_t num);

#ifdef __cplusplus
}
#endif

#endif