FirewareOriginMAT.c
3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "JZsdkLib.h"
#include "BaseConfig.h"
#include "DeviceInfo/SerialNumberProc/SerialProc.h"
#include "JZsdk_Base/JZsdk_Code/JZsdk_SMT_Code.h"
#include "./FirewareOriginMAT.h"
static int g_OriginRegionNum = ORIGIN_DEFAULT;
/*****************
*
* 属地初始化
*
*
* *******************/
T_JZsdkReturnCode FOMAT_FirewareOriginRegion_Init(int SerialType, unsigned char *SerialNumber, unsigned int SerialNumberLen)
{
//没有定义过的序列号,或是没有序列号
if (SerialType == UNDEFINED_SNM || SerialType == STANDARD_DJI_SNM)
{
if (FIRMWARE_ORIGIN == DOMESTIC_VERSION)
{
g_OriginRegionNum = ORIGIN_CN;
}
else if (FIRMWARE_ORIGIN == OVERSEAS_VERSION)
{
g_OriginRegionNum = ORIGIN_EN;
}
else
{
g_OriginRegionNum = ORIGIN_CN;
}
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
//旧类型的
if (SerialType == STANDARD_JZ_1_SNM)
{
if (FIRMWARE_ORIGIN == DOMESTIC_VERSION)
{
g_OriginRegionNum = ORIGIN_CN;
}
else if (FIRMWARE_ORIGIN == OVERSEAS_VERSION)
{
g_OriginRegionNum = ORIGIN_EN;
}
else
{
g_OriginRegionNum = ORIGIN_CN;
}
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
//新序列号类型
if (SerialType == STANDARD_JZ_2_SNM)
{
//检测是否是国内的
if ((SerialNumber[4] == 'C' || SerialNumber[4] == 'c')
&& (SerialNumber[5] == 'N' || SerialNumber[5] == 'n'))
{
g_OriginRegionNum = ORIGIN_CN;
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
//检测是否是en通用区的
if ((SerialNumber[4] == 'E' || SerialNumber[4] == 'e')
&& (SerialNumber[5] == 'N' || SerialNumber[5] == 'n'))
{
g_OriginRegionNum = ORIGIN_EN;
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
//检测是否是na定制区域固件
if ((SerialNumber[4] == 'N' || SerialNumber[4] == 'n')
&& (SerialNumber[5] == 'A' || SerialNumber[5] == 'a'))
{
g_OriginRegionNum = ORIGIN_EN;
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
//检测是否是欧洲定制区域固件
if ((SerialNumber[4] == 'E' || SerialNumber[4] == 'e')
&& (SerialNumber[5] == 'U' || SerialNumber[5] == 'u'))
{
g_OriginRegionNum = ORIGIN_EU;
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
//无匹配序列号
if (FIRMWARE_ORIGIN == DOMESTIC_VERSION)
{
g_OriginRegionNum = ORIGIN_CN;
}
else if (FIRMWARE_ORIGIN == OVERSEAS_VERSION)
{
g_OriginRegionNum = ORIGIN_EN;
}
else
{
g_OriginRegionNum = ORIGIN_CN;
}
}
}
/*******************
*
* 属地获取
*
* *****************/
T_JZsdkReturnCode FOMAT_Get_FirewareOriginRegion()
{
return g_OriginRegionNum;
}