|
@ -0,0 +1,40 @@ |
|
|
|
|
|
#include "sn.h" |
|
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h> |
|
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
#include <string.h> |
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************* |
|
|
|
|
|
* EXTERN * |
|
|
|
|
|
*******************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
static sn_t m_sn; |
|
|
|
|
|
|
|
|
|
|
|
sn_t* xs_device_info_get() { // |
|
|
|
|
|
sn_t* info = (sn_t*)DEVICE_INFO_START_ADD; |
|
|
|
|
|
m_sn = *info; |
|
|
|
|
|
|
|
|
|
|
|
if (m_sn.year < 0) { |
|
|
|
|
|
m_sn.year = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (m_sn.weak < 0) { |
|
|
|
|
|
m_sn.weak = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (m_sn.index < 0) { |
|
|
|
|
|
m_sn.index = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return &m_sn; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const char* sn_get_str() { |
|
|
|
|
|
sn_t* info = xs_device_info_get(); |
|
|
|
|
|
static char sn_str[32]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sprintf(sn_str, "%s%02ld%02ld%04ld", "SN", info->year, info->weak, info->index); |
|
|
|
|
|
return sn_str; |
|
|
|
|
|
} |