add interface
This commit is contained in:
@@ -904,6 +904,19 @@ void process_received_message(string mac, string id,const char* data, size_t len
|
||||
// 处理完成后重置状态
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else if (udata[8] == static_cast<unsigned char>(MsgResponseType::Response_NewNACK)) {
|
||||
// 文件目录为空
|
||||
std::cout << "*** empty ***! " << mac << std::endl;
|
||||
|
||||
//传入空的list表示目录为空
|
||||
std::vector<tag_dir_info> FileList;
|
||||
|
||||
filemenu_cache_put(id,FileList);
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::OK), id, 0, static_cast<int>(DeviceState::READING_FILEMENU));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else {
|
||||
std::cout << "reason code: " << static_cast<int>(udata[8]) << "-" << static_cast<int>(udata[9]) << "-" << static_cast<int>(udata[10]) << "-" << static_cast<int>(udata[11]) << std::endl;
|
||||
// 装置答非所问异常
|
||||
@@ -918,6 +931,9 @@ void process_received_message(string mac, string id,const char* data, size_t len
|
||||
if(udata[8] == static_cast<unsigned char>(MsgResponseType::Response_File_Send)){
|
||||
//文件应答最后一帧后,再回复的结束帧
|
||||
std::cout << "*** send file success ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::OK), id, 0, static_cast<int>(DeviceState::SEND_FILE));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else if (udata[8] == static_cast<unsigned char>(MsgResponseType::Response_NewACK)) {
|
||||
@@ -937,6 +953,9 @@ void process_received_message(string mac, string id,const char* data, size_t len
|
||||
if (!ok) {
|
||||
// 组装后续文件上送报文失败
|
||||
std::cout << "*** send file get next packet fail ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::BAD_REQUEST), id, 0, static_cast<int>(DeviceState::SEND_FILE));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else if (!packet.empty()) {
|
||||
@@ -959,17 +978,26 @@ void process_received_message(string mac, string id,const char* data, size_t len
|
||||
else {
|
||||
// 理论上不应出现
|
||||
std::cout << "*** send file invalid next packet ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::INTERNAL_ERROR), id, 0, static_cast<int>(DeviceState::SEND_FILE));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
}
|
||||
else if (udata[8] == static_cast<unsigned char>(MsgResponseType::Response_NewNACK)) {
|
||||
// 当前帧被拒收,文件上送失败
|
||||
std::cout << "*** send file 0x41 fail ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::REJECTED_BUSY), id, 0, static_cast<int>(DeviceState::SEND_FILE));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else {
|
||||
// 装置答非所问
|
||||
std::cout << "*** send file ?? fail ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::INTERNAL_ERROR), id, 0, static_cast<int>(DeviceState::SEND_FILE));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
break;
|
||||
@@ -979,16 +1007,25 @@ void process_received_message(string mac, string id,const char* data, size_t len
|
||||
if (udata[8] == static_cast<unsigned char>(MsgResponseType::Response_NewACK)) {
|
||||
//文件删除完毕!
|
||||
std::cout << "*** del file success ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::OK), id, 0, static_cast<int>(DeviceState::DEL_FILE));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else if (udata[8] == static_cast<unsigned char>(MsgResponseType::Response_NewNACK)) {
|
||||
// 当前帧被拒收,文件删除失败
|
||||
std::cout << "*** del file 0x41 fail ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::REJECTED_BUSY), id, 0, static_cast<int>(DeviceState::DEL_FILE));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else {
|
||||
// 装置答非所问
|
||||
std::cout << "*** del file ?? fail ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::INTERNAL_ERROR), id, 0, static_cast<int>(DeviceState::DEL_FILE));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
break;
|
||||
@@ -998,16 +1035,25 @@ void process_received_message(string mac, string id,const char* data, size_t len
|
||||
if (udata[8] == static_cast<unsigned char>(MsgResponseType::Response_NewACK)) {
|
||||
//创建目录完毕!
|
||||
std::cout << "*** send menu success ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::OK), id, 0, static_cast<int>(DeviceState::SEND_MENU));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else if (udata[8] == static_cast<unsigned char>(MsgResponseType::Response_NewNACK)) {
|
||||
// 当前帧被拒收,创建目录失败
|
||||
std::cout << "*** send menu 0x41 fail ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::REJECTED_BUSY), id, 0, static_cast<int>(DeviceState::SEND_MENU));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else {
|
||||
// 装置答非所问
|
||||
std::cout << "*** send menu ?? fail ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::INTERNAL_ERROR), id, 0, static_cast<int>(DeviceState::SEND_MENU));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
break;
|
||||
@@ -1017,16 +1063,25 @@ void process_received_message(string mac, string id,const char* data, size_t len
|
||||
if (udata[8] == static_cast<unsigned char>(MsgResponseType::Response_NewACK)) {
|
||||
//删除目录完毕!
|
||||
std::cout << "*** del menu success ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::OK), id, 0, static_cast<int>(DeviceState::DEL_MENU));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else if (udata[8] == static_cast<unsigned char>(MsgResponseType::Response_NewNACK)) {
|
||||
// 当前帧被拒收,删除目录失败
|
||||
std::cout << "*** del menu 0x41 fail ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::REJECTED_BUSY), id, 0, static_cast<int>(DeviceState::DEL_MENU));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
else {
|
||||
// 装置答非所问
|
||||
std::cout << "*** del menu ?? fail ***! " << mac << std::endl;
|
||||
|
||||
on_device_response_minimal(static_cast<int>(ResponseCode::INTERNAL_ERROR), id, 0, static_cast<int>(DeviceState::DEL_MENU));
|
||||
|
||||
ClientManager::instance().change_device_state(id, DeviceState::IDLE);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user