Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
k-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈伟灿
k-sdk
Commits
2eb0208b
Commit
2eb0208b
authored
Nov 11, 2021
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】1,修改语音面板版本号获取
【提交人】陈伟灿
parent
d70cf063
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
173 additions
and
188 deletions
+173
-188
application/kcloud/kcloud_config.h
application/kcloud/kcloud_config.h
+3
-2
application/kcloud/kk_register.c
application/kcloud/kk_register.c
+1
-1
application/klansdk/kk_data_handle.c
application/klansdk/kk_data_handle.c
+0
-16
application/klansdk/kk_lan_voice_panel.c
application/klansdk/kk_lan_voice_panel.c
+20
-20
application/klansdk/kk_voice_panel_handle.c
application/klansdk/kk_voice_panel_handle.c
+149
-149
No files found.
application/kcloud/kcloud_config.h
View file @
2eb0208b
...
@@ -13,13 +13,14 @@
...
@@ -13,13 +13,14 @@
#define AUTO_CONN 1
#define AUTO_CONN 1
#define CONNECT_TIMEOUT 3
#define CONNECT_TIMEOUT 3
#define IPSTR "172.25.240.194"
#define IPSTR "172.25.240.194"
#define PORT 8092
#define PORT 8092
//10040//8092
typedef
enum
{
typedef
enum
{
RETURN_FAIL
=
-
1
,
RETURN_FAIL
=
-
1
,
RETURN_SUCCESS
=
0
,
RETURN_SUCCESS
=
0
,
}
kk_kcloud_error_code_t
;
}
kk_kcloud_error_code_t
;
#define HOST_NAME "dev.nj-ikonke.site"
#define MQTT_AUTH_HOST_NAME "test.dev.nj-ikonke.site"
int
KK_Get_ccuid
(
char
*
device_code
);
int
KK_Get_ccuid
(
char
*
device_code
);
#endif
#endif
application/kcloud/kk_register.c
View file @
2eb0208b
...
@@ -339,7 +339,7 @@ int kk_start_ccu_register(void)
...
@@ -339,7 +339,7 @@ int kk_start_ccu_register(void)
bzero
(
&
servaddr
,
sizeof
(
servaddr
));
bzero
(
&
servaddr
,
sizeof
(
servaddr
));
servaddr
.
sin_family
=
AF_INET
;
servaddr
.
sin_family
=
AF_INET
;
servaddr
.
sin_port
=
htons
(
PORT
);
servaddr
.
sin_port
=
htons
(
PORT
);
struct
hostent
*
host
=
gethostbyname
(
HOST_NAME
);
struct
hostent
*
host
=
gethostbyname
(
MQTT_AUTH_
HOST_NAME
);
if
(
NULL
==
host
)
if
(
NULL
==
host
)
{
{
INFO_PRINT
(
"gethostbyname h_errno
\n
"
);
INFO_PRINT
(
"gethostbyname h_errno
\n
"
);
...
...
application/klansdk/kk_data_handle.c
View file @
2eb0208b
...
@@ -374,22 +374,6 @@ int kk_data_handle(cJSON *json,int sockfd)
...
@@ -374,22 +374,6 @@ int kk_data_handle(cJSON *json,int sockfd)
kk_zb_devs_hw_ack
(
sockfd
,
conditions
);
kk_zb_devs_hw_ack
(
sockfd
,
conditions
);
}
else
if
(
strcmp
(
opcode
->
valuestring
,
GET_HISTORY_ALARM_LOG
)
==
0
){
}
else
if
(
strcmp
(
opcode
->
valuestring
,
GET_HISTORY_ALARM_LOG
)
==
0
){
kk_handle_get_history_info
();
kk_handle_get_history_info
();
}
else
if
(
strcmp
(
opcode
->
valuestring
,
"SOUND_VAL"
)
==
0
){
arg
=
cJSON_GetObjectItem
(
json
,
ARG_STRING
);
int
val
=
atoi
(
arg
->
valuestring
);
if
(
val
>
100
){
val
=
100
;
}
else
if
(
val
<
0
){
val
=
0
;
}
}
else
if
(
strcmp
(
opcode
->
valuestring
,
"SOUND_SWITCH"
)
==
0
){
arg
=
cJSON_GetObjectItem
(
json
,
ARG_STRING
);
if
(
strcmp
(
arg
->
valuestring
,
"on"
)){
}
else
if
(
strcmp
(
arg
->
valuestring
,
"off"
)){
}
}
else
if
(
strcmp
(
opcode
->
valuestring
,
DEL_HISTORY_ALARM_LOG
)
==
0
){
}
else
if
(
strcmp
(
opcode
->
valuestring
,
DEL_HISTORY_ALARM_LOG
)
==
0
){
cJSON
*
key
=
cJSON_GetObjectItem
(
json
,
"arg"
);
cJSON
*
key
=
cJSON_GetObjectItem
(
json
,
"arg"
);
if
(
key
!=
NULL
){
if
(
key
!=
NULL
){
...
...
application/klansdk/kk_lan_voice_panel.c
View file @
2eb0208b
...
@@ -246,7 +246,7 @@ void kk_vp_update_result_check(uint8_t status,uint32_t f_ver)
...
@@ -246,7 +246,7 @@ void kk_vp_update_result_check(uint8_t status,uint32_t f_ver)
printf
(
"[cfg ver]File Version=%08x
\n
"
,
vp_mag
.
cfg_info
.
f_ver
);
printf
(
"[cfg ver]File Version=%08x
\n
"
,
vp_mag
.
cfg_info
.
f_ver
);
}
else
{
}
else
{
debug_log
(
LOG_EMERG_LEVEL
,
"-------------------->start update config file again<------------------
\n
"
);
debug_log
(
LOG_EMERG_LEVEL
,
"-------------------->start update config file again<------------------
\n
"
);
kk_voice_update_config_file
();
//
kk_voice_update_config_file();
}
}
}
}
...
@@ -286,22 +286,22 @@ int kk_vp_config_file_info_check(int f_ver,int f_size,int crc32)
...
@@ -286,22 +286,22 @@ int kk_vp_config_file_info_check(int f_ver,int f_size,int crc32)
}
}
return
0
;
return
0
;
}
}
int
kk_voice_exit_factory_mode
(
void
)
int
kk_voice_exit_factory_mode
(
void
)
{
{
uint8_t
data
[
1
]
=
{
1
};
uint8_t
data
[
1
]
=
{
1
};
vp_send_data_build
(
OPCODE_COMPLETED_TEST_OP
,
sizeof
(
data
),
data
);
vp_send_data_build
(
OPCODE_COMPLETED_TEST_OP
,
sizeof
(
data
),
data
);
return
1
;
return
1
;
}
}
void
kk_voice_ota_mtu_set
(
uint16_t
mtu
)
void
kk_voice_ota_mtu_set
(
uint16_t
mtu
)
{
{
uint8_t
res
[
3
]
=
{
0
};
uint8_t
res
[
3
]
=
{
0
};
res
[
0
]
=
0xff
;
res
[
0
]
=
0xff
;
res
[
1
]
=
(
mtu
>>
8
)
&
0xff
;
res
[
1
]
=
(
mtu
>>
8
)
&
0xff
;
res
[
2
]
=
mtu
&
0xff
;
res
[
2
]
=
mtu
&
0xff
;
INFO_PRINT
(
"[set] MTU OTA SIZE = %d
\n
"
,
mtu
);
INFO_PRINT
(
"[set] MTU OTA SIZE = %d
\n
"
,
mtu
);
vp_send_data_build
(
OPCODE_VOICE_SWITCH
,
sizeof
(
res
),
res
);
vp_send_data_build
(
OPCODE_VOICE_SWITCH
,
sizeof
(
res
),
res
);
}
}
void
kk_vp_manage_init
(
void
)
void
kk_vp_manage_init
(
void
)
{
{
...
@@ -316,7 +316,7 @@ void kk_vp_manage_init(void)
...
@@ -316,7 +316,7 @@ void kk_vp_manage_init(void)
void
*
kk_vp_manage_thread
(
void
*
arg
)
void
*
kk_vp_manage_thread
(
void
*
arg
)
{
{
INFO_PRINT
(
"[%s] start...
\n
"
,
__FUNCTION__
);
INFO_PRINT
(
"[%s] start...
\n
"
,
__FUNCTION__
);
usleep
(
100
*
1000
);
kk_vp_manage_init
();
kk_vp_manage_init
();
while
(
1
)
while
(
1
)
...
@@ -337,7 +337,7 @@ static void *kk_voice_ctrl_status_thread(void *arg)
...
@@ -337,7 +337,7 @@ static void *kk_voice_ctrl_status_thread(void *arg)
{
{
debug_log
(
LOG_INFO_LEVEL
,
"[%s] start...
\n
"
,
__FUNCTION__
);
debug_log
(
LOG_INFO_LEVEL
,
"[%s] start...
\n
"
,
__FUNCTION__
);
usleep
(
100
*
1000
);
#define SET_8009_TIME (60*60)
#define SET_8009_TIME (60*60)
...
@@ -461,7 +461,7 @@ void kk_voice_ota_start(char *in)
...
@@ -461,7 +461,7 @@ void kk_voice_ota_start(char *in)
int
kk_voice_panel_init
(
int
argc
,
char
*
argv
[])
int
kk_voice_panel_init
(
int
argc
,
char
*
argv
[])
{
{
size_t
s
=
1500
;
size_t
s
=
1500
;
pthread_t
uart_tid
=
0
;
pthread_t
uart_tid
=
0
;
pthread_t
mag_tid
=
0
;
pthread_t
mag_tid
=
0
;
...
...
application/klansdk/kk_voice_panel_handle.c
View file @
2eb0208b
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#include "kk_lan_vp_ctrl.h"
#include "kk_lan_vp_ctrl.h"
#include "Serial.h"
#include "Serial.h"
#include "kk_oldccu_msg.h"
#include "kk_oldccu_msg.h"
#include <ctype.h>
#include <ctype.h>
#define MK_VERSION(x) ((*x<<24) | (*(x+1)<<16) | (*(x+2)<<8) | *(x+3))
#define MK_VERSION(x) ((*x<<24) | (*(x+1)<<16) | (*(x+2)<<8) | *(x+3))
#define MK_UINT32(x) ((*x<<24) | (*(x+1)<<16) | (*(x+2)<<8) | *(x+3))
#define MK_UINT32(x) ((*x<<24) | (*(x+1)<<16) | (*(x+2)<<8) | *(x+3))
...
@@ -51,8 +51,8 @@ static void kk_vp_ota_file_update_start_handle(pro_data_t *pro_data);
...
@@ -51,8 +51,8 @@ static void kk_vp_ota_file_update_start_handle(pro_data_t *pro_data);
static
void
kk_vp_ota_file_update_stop_handle
(
pro_data_t
*
pro_data
);
static
void
kk_vp_ota_file_update_stop_handle
(
pro_data_t
*
pro_data
);
static
void
kk_vp_ota_info_query_handle
(
pro_data_t
*
pro_data
);
static
void
kk_vp_ota_info_query_handle
(
pro_data_t
*
pro_data
);
static
void
kk_vp_ota_file_update_status_handle
(
pro_data_t
*
pro_data
);
static
void
kk_vp_ota_file_update_status_handle
(
pro_data_t
*
pro_data
);
static
void
kk_voice_switch_handle
(
pro_data_t
*
pro_data
);
static
void
kk_voice_switch_handle
(
pro_data_t
*
pro_data
);
static
void
kk_voice_volume_handle
(
pro_data_t
*
pro_data
);
static
void
kk_voice_volume_handle
(
pro_data_t
*
pro_data
);
static
VP_OPCODE_HANDLE
vp_opcode_table
[]
=
{
static
VP_OPCODE_HANDLE
vp_opcode_table
[]
=
{
...
@@ -73,8 +73,8 @@ static VP_OPCODE_HANDLE vp_opcode_table[] = {
...
@@ -73,8 +73,8 @@ static VP_OPCODE_HANDLE vp_opcode_table[] = {
{
OPCODE_VOICE_OTA_REQUEST
,
kk_vp_ota_file_update_data_req_handle
},
{
OPCODE_VOICE_OTA_REQUEST
,
kk_vp_ota_file_update_data_req_handle
},
{
OPCODE_VOICE_OTA_UPGRADE_STOP
,
kk_vp_ota_file_update_stop_handle
},
{
OPCODE_VOICE_OTA_UPGRADE_STOP
,
kk_vp_ota_file_update_stop_handle
},
{
OPCODE_VOICE_OTA_STATUS_NOTIFY
,
kk_vp_ota_file_update_status_handle
},
{
OPCODE_VOICE_OTA_STATUS_NOTIFY
,
kk_vp_ota_file_update_status_handle
},
{
OPCODE_VOICE_SWITCH
,
kk_voice_switch_handle
},
{
OPCODE_VOICE_SWITCH
,
kk_voice_switch_handle
},
{
OPCODE_VOICE_CONTROL
,
kk_voice_volume_handle
}
{
OPCODE_VOICE_CONTROL
,
kk_voice_volume_handle
}
};
};
...
@@ -708,11 +708,12 @@ static void kk_vp_get_8009_snapshoot_handle(pro_data_t *pro_data)
...
@@ -708,11 +708,12 @@ static void kk_vp_get_8009_snapshoot_handle(pro_data_t *pro_data)
volume
=
pro_data
->
arg
[
14
];
volume
=
pro_data
->
arg
[
14
];
f_ver
=
MK_UINT32
(
&
pro_data
->
arg
[
15
]);
f_ver
=
MK_UINT32
(
&
pro_data
->
arg
[
15
]);
kk_get_voice_version
();
kk_vp_set_config_file_version
(
f_ver
);
kk_vp_set_config_file_version
(
f_ver
);
memset
(
s_voice_sw
,
0x0
,
sizeof
(
s_voice_sw
));
memset
(
s_voice_sw
,
0x0
,
sizeof
(
s_voice_sw
));
//string version=std::to_string(pro_data->arg[1])+"."+std::to_string(pro_data->arg[2])+"."+std::to_string(pro_data->arg[3]);
//string version=std::to_string(pro_data->arg[1])+"."+std::to_string(pro_data->arg[2])+"."+std::to_string(pro_data->arg[3]);
sprintf
(
s_voice_sw
,
"%d.%d.%d"
,
pro_data
->
arg
[
1
],
pro_data
->
arg
[
2
],
pro_data
->
arg
[
3
]);
sprintf
(
s_voice_sw
,
"%d.%d.%d"
,
pro_data
->
arg
[
1
],
pro_data
->
arg
[
2
],
pro_data
->
arg
[
3
]);
debug_log
(
LOG_INFO_LEVEL
,
"
\n
sv=%06X,hv=%06X,%d-%d-%d %d:%d:%d,volume=%d,f_ver=%08X
\n
"
,
debug_log
(
LOG_INFO_LEVEL
,
"
\n
sv=%06X,hv=%06X,%d-%d-%d %d:%d:%d,volume=%d,f_ver=%08X
\n
"
,
sv
,
hv
,
year
,
month
,
day
,
hour
,
minute
,
second
,
volume
,
f_ver
);
sv
,
hv
,
year
,
month
,
day
,
hour
,
minute
,
second
,
volume
,
f_ver
);
}
}
...
@@ -1305,8 +1306,7 @@ void kk_vp_get_8009_snapshoot(void)
...
@@ -1305,8 +1306,7 @@ void kk_vp_get_8009_snapshoot(void)
debug_log
(
LOG_DEBUG_LEVEL
,
"get snapshoot
\n
"
);
debug_log
(
LOG_DEBUG_LEVEL
,
"get snapshoot
\n
"
);
kk_get_voice_version
();
vp_send_data_build
(
OPCODE_8009_SNAPSHOOT
,
sizeof
(
res
),
res
);
vp_send_data_build
(
OPCODE_8009_SNAPSHOOT
,
sizeof
(
res
),
res
);
}
}
...
@@ -1420,11 +1420,11 @@ static int _vp_get_ota_file_crc32(char *file)
...
@@ -1420,11 +1420,11 @@ static int _vp_get_ota_file_crc32(char *file)
uint32_t
crc32
=
0
;
uint32_t
crc32
=
0
;
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
int
size
=
0
;
int
size
=
0
;
char
filePath
[
218
]
=
{
0
};
char
filePath
[
218
]
=
{
0
};
sprintf
(
filePath
,
"/data/OTA/%s"
,
file
);
sprintf
(
filePath
,
"/data/OTA/%s"
,
file
);
fp
=
fopen
(
filePath
,
"r"
);
fp
=
fopen
(
filePath
,
"r"
);
if
(
fp
==
NULL
){
if
(
fp
==
NULL
){
debug_log
(
LOG_WARNING_LEVEL
,
"[%s]fopen err!
\n
"
,
filePath
);
debug_log
(
LOG_WARNING_LEVEL
,
"[%s]fopen err!
\n
"
,
filePath
);
printf
(
"open err.
\n
"
);
printf
(
"open err.
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1443,7 +1443,7 @@ static int _vp_get_ota_file_crc32(char *file)
...
@@ -1443,7 +1443,7 @@ static int _vp_get_ota_file_crc32(char *file)
while
(
remain
>
0
){
while
(
remain
>
0
){
r_len
=
fread
(
pRead
,
1
,
size
,
fp
);
r_len
=
fread
(
pRead
,
1
,
size
,
fp
);
if
(
remain
>=
r_len
){
if
(
remain
>=
r_len
){
remain
-=
r_len
;
remain
-=
r_len
;
pRead
+=
r_len
;
pRead
+=
r_len
;
printf
(
"[remain]r_len=%d,remain=%d
\n
"
,
r_len
,
remain
);
printf
(
"[remain]r_len=%d,remain=%d
\n
"
,
r_len
,
remain
);
...
@@ -1462,87 +1462,87 @@ static int _vp_get_ota_file_crc32(char *file)
...
@@ -1462,87 +1462,87 @@ static int _vp_get_ota_file_crc32(char *file)
return
crc32
;
return
crc32
;
}
}
static
int
get_ota_file_version
(
char
*
file
)
static
int
get_ota_file_version
(
char
*
file
)
{
{
char
s
[
128
];
char
s
[
128
];
char
*
ota_file
=
NULL
;
char
*
ota_file
=
NULL
;
char
*
pstart
=
NULL
;
char
*
pstart
=
NULL
;
if
(
file
==
NULL
){
if
(
file
==
NULL
){
return
-
1
;
return
-
1
;
}
}
pstart
=
strstr
(
file
,
"_"
);
pstart
=
strstr
(
file
,
"_"
);
if
(
pstart
!=
NULL
){
if
(
pstart
!=
NULL
){
ota_file
=
pstart
+
1
;
ota_file
=
pstart
+
1
;
}
else
{
}
else
{
ota_file
=
file
;
ota_file
=
file
;
}
}
snprintf
(
s
,
sizeof
(
s
),
"%s"
,
ota_file
);
snprintf
(
s
,
sizeof
(
s
),
"%s"
,
ota_file
);
debug_log
(
LOG_NOTICE_LEVEL
,
"ota file ver=%s
\n
"
,
s
);
debug_log
(
LOG_NOTICE_LEVEL
,
"ota file ver=%s
\n
"
,
s
);
char
*
d
=
"."
;
char
*
d
=
"."
;
char
*
p
;
char
*
p
;
p
=
strtok
(
s
,
d
);
p
=
strtok
(
s
,
d
);
int
vBuff
[
3
]
=
{
0
};
int
vBuff
[
3
]
=
{
0
};
int
off
=
0
;
int
off
=
0
;
while
(
p
)
while
(
p
)
{
{
if
(
isdigit
(
*
p
))
{
if
(
isdigit
(
*
p
))
{
vBuff
[
off
++
]
=
atoi
(
p
);
vBuff
[
off
++
]
=
atoi
(
p
);
if
(
off
==
3
){
if
(
off
==
3
){
break
;
break
;
}
}
}
}
p
=
strtok
(
NULL
,
d
);
p
=
strtok
(
NULL
,
d
);
}
}
return
((
vBuff
[
0
]
&
0xff
)
<<
16
)
|
((
vBuff
[
1
]
&
0xff
)
<<
8
)
|
(
vBuff
[
2
]
&
0xff
);
return
((
vBuff
[
0
]
&
0xff
)
<<
16
)
|
((
vBuff
[
1
]
&
0xff
)
<<
8
)
|
(
vBuff
[
2
]
&
0xff
);
}
}
static
int
_vp_get_ota_file_size
(
char
*
file
)
static
int
_vp_get_ota_file_size
(
char
*
file
)
{
{
int
size
=
0
;
int
size
=
0
;
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
char
filePath
[
218
]
=
{
0
};
char
filePath
[
218
]
=
{
0
};
sprintf
(
filePath
,
"/data/OTA/%s"
,
file
);
sprintf
(
filePath
,
"/data/OTA/%s"
,
file
);
fp
=
fopen
(
filePath
,
"r"
);
fp
=
fopen
(
filePath
,
"r"
);
if
(
fp
==
NULL
){
if
(
fp
==
NULL
){
debug_log
(
LOG_WARNING_LEVEL
,
"[%s]fopen err!
\n
"
,
filePath
);
debug_log
(
LOG_WARNING_LEVEL
,
"[%s]fopen err!
\n
"
,
filePath
);
return
0
;
return
0
;
}
}
fseek
(
fp
,
0
,
SEEK_END
);
fseek
(
fp
,
0
,
SEEK_END
);
size
=
ftell
(
fp
);
size
=
ftell
(
fp
);
fclose
(
fp
);
fclose
(
fp
);
return
size
;
return
size
;
}
}
static
void
open_ota_fd
(
char
*
file
)
static
void
open_ota_fd
(
char
*
file
)
{
char
filePath
[
218
]
=
{
0
};
sprintf
(
filePath
,
"/data/OTA/%s"
,
file
);
if
(
ota_fp
!=
NULL
){
fclose
(
ota_fp
);
}
ota_fp
=
fopen
(
filePath
,
"rb"
);
if
(
ota_fp
==
NULL
){
debug_log
(
LOG_WARNING_LEVEL
,
"[%s]fopen err!
\n
"
,
filePath
);
}
debug_log
(
LOG_WARNING_LEVEL
,
"open %s
\n
"
,
filePath
);
}
void
kk_vp_ota_file_update_start
(
char
*
file
)
{
{
if
(
file
==
NULL
){
char
filePath
[
218
]
=
{
0
};
return
;
}
sprintf
(
filePath
,
"/data/OTA/%s"
,
file
);
debug_log
(
LOG_WARNING_LEVEL
,
"file=%s
\n
"
,
file
);
if
(
ota_fp
!=
NULL
){
fclose
(
ota_fp
);
}
ota_fp
=
fopen
(
filePath
,
"rb"
);
if
(
ota_fp
==
NULL
){
debug_log
(
LOG_WARNING_LEVEL
,
"[%s]fopen err!
\n
"
,
filePath
);
}
debug_log
(
LOG_WARNING_LEVEL
,
"open %s
\n
"
,
filePath
);
}
void
kk_vp_ota_file_update_start
(
char
*
file
)
{
if
(
file
==
NULL
){
return
;
}
debug_log
(
LOG_WARNING_LEVEL
,
"file=%s
\n
"
,
file
);
uint8_t
data
[
11
]
=
{
0
};
uint8_t
data
[
11
]
=
{
0
};
uint32_t
f_ver
,
f_size
,
crc32
;
uint32_t
f_ver
,
f_size
,
crc32
;
f_ver
=
get_ota_file_version
(
file
);
f_ver
=
get_ota_file_version
(
file
);
f_size
=
_vp_get_ota_file_size
(
file
);
f_size
=
_vp_get_ota_file_size
(
file
);
crc32
=
_vp_get_ota_file_crc32
(
file
);
crc32
=
_vp_get_ota_file_crc32
(
file
);
data
[
0
]
=
(
f_ver
>>
16
)
&
0xff
;
data
[
0
]
=
(
f_ver
>>
16
)
&
0xff
;
data
[
1
]
=
(
f_ver
>>
8
)
&
0xff
;
data
[
1
]
=
(
f_ver
>>
8
)
&
0xff
;
...
@@ -1567,7 +1567,7 @@ void kk_vp_ota_file_update_start(char* file)
...
@@ -1567,7 +1567,7 @@ void kk_vp_ota_file_update_start(char* file)
vp_send_data_build
(
OPCODE_VOICE_OTA_UPGRADE_STATR
,
sizeof
(
data
),
data
);
vp_send_data_build
(
OPCODE_VOICE_OTA_UPGRADE_STATR
,
sizeof
(
data
),
data
);
open_ota_fd
(
file
);
open_ota_fd
(
file
);
}
}
void
kk_vp_ota_file_update_stop
(
uint32_t
ver
)
void
kk_vp_ota_file_update_stop
(
uint32_t
ver
)
{
{
...
@@ -1801,7 +1801,7 @@ static void kk_vp_ota_file_update_data_req_handle(pro_data_t *pro_data)
...
@@ -1801,7 +1801,7 @@ static void kk_vp_ota_file_update_data_req_handle(pro_data_t *pro_data)
if
(
err
==
0
){
if
(
err
==
0
){
while
(
req_size
>
t_len
){
while
(
req_size
>
t_len
){
r_len
=
fread
(
&
data
[
len
],
1
,
req_size
,
ota_fp
);
r_len
=
fread
(
&
data
[
len
],
1
,
req_size
,
ota_fp
);
if
(
r_len
>
0
){
if
(
r_len
>
0
){
t_len
+=
r_len
;
t_len
+=
r_len
;
len
+=
r_len
;
len
+=
r_len
;
}
else
{
}
else
{
...
@@ -1841,24 +1841,24 @@ static void kk_vp_ota_file_update_stop_handle(pro_data_t *pro_data)
...
@@ -1841,24 +1841,24 @@ static void kk_vp_ota_file_update_stop_handle(pro_data_t *pro_data)
debug_log
(
LOG_DEBUG_LEVEL
,
"[VP OTA STOP] ver=%d.%d.%d
\n
"
,
pro_data
->
arg
[
1
],
pro_data
->
arg
[
2
],
pro_data
->
arg
[
3
]);
debug_log
(
LOG_DEBUG_LEVEL
,
"[VP OTA STOP] ver=%d.%d.%d
\n
"
,
pro_data
->
arg
[
1
],
pro_data
->
arg
[
2
],
pro_data
->
arg
[
3
]);
}
}
}
}
static
int
kk_voice_ota_finish_notify
(
char
*
ver
)
static
int
kk_voice_ota_finish_notify
(
char
*
ver
)
{
{
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
root
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
root
,
"nodeid"
,
"*"
);
cJSON_AddStringToObject
(
root
,
"nodeid"
,
"*"
);
cJSON_AddStringToObject
(
root
,
"opcode"
,
VOICE_OTA_FINISH
);
cJSON_AddStringToObject
(
root
,
"opcode"
,
VOICE_OTA_FINISH
);
cJSON_AddStringToObject
(
root
,
"status"
,
"success"
);
cJSON_AddStringToObject
(
root
,
"status"
,
"success"
);
cJSON_AddStringToObject
(
root
,
"arg"
,
ver
);
cJSON_AddStringToObject
(
root
,
"arg"
,
ver
);
send_msg_to_module
(
root
);
send_msg_to_module
(
root
);
cJSON_Delete
(
root
);
cJSON_Delete
(
root
);
return
0
;
return
0
;
}
}
static
void
kk_vp_ota_file_update_status_handle
(
pro_data_t
*
pro_data
)
static
void
kk_vp_ota_file_update_status_handle
(
pro_data_t
*
pro_data
)
{
{
int
err
=
0
;
int
err
=
0
;
int
ver
;
int
ver
;
char
verBuf
[
16
]
=
{
0
};
char
verBuf
[
16
]
=
{
0
};
unsigned
char
status
;
unsigned
char
status
;
if
(
pro_data
->
args_len
!=
4
){
if
(
pro_data
->
args_len
!=
4
){
return
;
return
;
}
}
...
@@ -1866,15 +1866,15 @@ static void kk_vp_ota_file_update_status_handle(pro_data_t *pro_data)
...
@@ -1866,15 +1866,15 @@ static void kk_vp_ota_file_update_status_handle(pro_data_t *pro_data)
ver
=
MK_UINT24
(
&
pro_data
->
arg
[
0
]);
ver
=
MK_UINT24
(
&
pro_data
->
arg
[
0
]);
status
=
pro_data
->
arg
[
3
];
status
=
pro_data
->
arg
[
3
];
if
(
status
==
0x00
){
if
(
status
==
0x00
){
sprintf
(
verBuf
,
"%d.%d.%d"
,
pro_data
->
arg
[
0
],
pro_data
->
arg
[
1
],
pro_data
->
arg
[
2
]);
sprintf
(
verBuf
,
"%d.%d.%d"
,
pro_data
->
arg
[
0
],
pro_data
->
arg
[
1
],
pro_data
->
arg
[
2
]);
kk_vp_voice_version_set
(
verBuf
,
strlen
(
verBuf
));
kk_vp_voice_version_set
(
verBuf
,
strlen
(
verBuf
));
kk_voice_ota_finish_notify
(
verBuf
);
kk_voice_ota_finish_notify
(
verBuf
);
debug_log
(
LOG_NOTICE_LEVEL
,
"
\n
*********************OTA SUCCESS******************
\n
"
);
debug_log
(
LOG_NOTICE_LEVEL
,
"
\n
*********************OTA SUCCESS******************
\n
"
);
kk_voice_reset_ver_flag
();
kk_voice_reset_ver_flag
();
}
}
debug_log
(
LOG_DEBUG_LEVEL
,
"
\n
ver=%d.%d.%d,status=%d
\n
"
,
pro_data
->
arg
[
0
],
pro_data
->
arg
[
1
],
pro_data
->
arg
[
2
],
status
);
debug_log
(
LOG_DEBUG_LEVEL
,
"
\n
ver=%d.%d.%d,status=%d
\n
"
,
pro_data
->
arg
[
0
],
pro_data
->
arg
[
1
],
pro_data
->
arg
[
2
],
status
);
...
@@ -1912,37 +1912,37 @@ static void kk_vp_ota_info_query_handle(pro_data_t *pro_data)
...
@@ -1912,37 +1912,37 @@ static void kk_vp_ota_info_query_handle(pro_data_t *pro_data)
}
}
static
void
kk_voice_switch_handle
(
pro_data_t
*
pro_data
)
static
void
kk_voice_switch_handle
(
pro_data_t
*
pro_data
)
{
{
int
err
=
0
;
int
err
=
0
;
int
ver
;
int
ver
;
unsigned
char
status
;
unsigned
char
status
;
if
((
err
=
pro_data
->
arg
[
0
])
==
0
)
{
if
((
err
=
pro_data
->
arg
[
0
])
==
0
)
{
debug_log
(
LOG_DEBUG_LEVEL
,
"switch=%d
\n
"
,
pro_data
->
arg
[
1
]);
debug_log
(
LOG_DEBUG_LEVEL
,
"switch=%d
\n
"
,
pro_data
->
arg
[
1
]);
}
}
}
}
static
void
kk_voice_volume_handle
(
pro_data_t
*
pro_data
)
static
void
kk_voice_volume_handle
(
pro_data_t
*
pro_data
)
{
{
int
err
=
0
;
int
err
=
0
;
int
ver
;
int
ver
;
unsigned
char
status
;
unsigned
char
status
;
char
vol
[
8
]
=
{
0
};
char
vol
[
8
]
=
{
0
};
if
((
err
=
pro_data
->
arg
[
0
])
==
0
)
{
if
((
err
=
pro_data
->
arg
[
0
])
==
0
)
{
debug_log
(
LOG_DEBUG_LEVEL
,
"volume=%d
\n
"
,
pro_data
->
arg
[
1
]);
debug_log
(
LOG_DEBUG_LEVEL
,
"volume=%d
\n
"
,
pro_data
->
arg
[
1
]);
sprintf
(
vol
,
"%d"
,
pro_data
->
arg
[
1
]);
sprintf
(
vol
,
"%d"
,
pro_data
->
arg
[
1
]);
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
root
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
root
,
"node"
,
"*"
);
cJSON_AddStringToObject
(
root
,
"node"
,
"*"
);
cJSON_AddStringToObject
(
root
,
"opcode"
,
"VOLUME_CTRL"
);
cJSON_AddStringToObject
(
root
,
"opcode"
,
"VOLUME_CTRL"
);
cJSON_AddStringToObject
(
root
,
"arg"
,
vol
);
cJSON_AddStringToObject
(
root
,
"arg"
,
vol
);
cJSON_AddStringToObject
(
root
,
"status"
,
"success"
);
cJSON_AddStringToObject
(
root
,
"status"
,
"success"
);
send_msg_to_module
(
root
);
send_msg_to_module
(
root
);
cJSON_Delete
(
root
);
cJSON_Delete
(
root
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment