|
16 | 16 | #include "node_queue.h" |
17 | 17 | #include "S2_wrap.h" |
18 | 18 | #include "S2_multicast_auto.h" |
19 | | -#include<stdlib.h> |
| 19 | +#include <stdlib.h> |
20 | 20 | #include "ZW_transport_api.h" |
21 | 21 | #include "ZIP_Router_logging.h" |
22 | 22 | #include "zgw_crc.h" |
|
25 | 25 | #include "ZW_classcmd_ex.h" |
26 | 26 | #include "ZW_ZIPApplication.h" |
27 | 27 | #include "zip_router_config.h" |
| 28 | +#include "ZW_classcmd.h" |
| 29 | +#include "CC_NetworkManagement.h" |
28 | 30 | /* |
29 | 31 | * SendData Hierarchy, each, level wraps the previous. A higher level call MUST only call lower level calls. |
30 | 32 | * |
@@ -701,7 +703,30 @@ void ZW_SendDataAppl_FrameRX_Notify(const ts_param_t *c, const uint8_t* frame, u |
701 | 703 | } |
702 | 704 | } |
703 | 705 |
|
| 706 | +/** |
| 707 | + * Notify the NCP controller status via unsolicited destination(s) (#1 and #2). |
| 708 | + * @param status Status code defined in ZW_classcmd_ex.h |
| 709 | + */ |
| 710 | +void notify_ncp_controller_status_via_unsolicited_dest(uint8_t status) |
| 711 | +{ |
| 712 | + // unsolicited connections |
| 713 | + zwave_connection_t uconn; |
| 714 | + memset(&uconn, 0, sizeof(zwave_connection_t)); |
| 715 | + |
| 716 | + DBG_PRINTF("Notify NCP soft reset status(%d) via unsolicited dest\n", status); |
| 717 | + if (uip_is_addr_unspecified(&cfg.unsolicited_dest) |
| 718 | + && uip_is_addr_unspecified(&cfg.unsolicited_dest2)) { |
| 719 | + ERR_PRINTF("No Unsolicited Destinations configured\n"); |
| 720 | + return; |
| 721 | + } |
704 | 722 |
|
| 723 | + // Send the report to both unsolicited destinations (#1 and #2) |
| 724 | + for (int i = 0; i < 2; i++) { |
| 725 | + if(setup_unsolicited_connection(&uconn, i+1)) { |
| 726 | + ZW_SendNCPControllerStatusZIP(&uconn, status); |
| 727 | + } |
| 728 | + } |
| 729 | +} |
705 | 730 |
|
706 | 731 | PROCESS_THREAD(ZW_SendDataAppl_process, ev, data) |
707 | 732 | { |
@@ -740,10 +765,12 @@ PROCESS_THREAD(ZW_SendDataAppl_process, ev, data) |
740 | 765 | if (ZW_SoftResetWithCheck()) { |
741 | 766 | DBG_PRINTF("Soft reset successful!\n"); |
742 | 767 | process_post(&ZW_SendDataAppl_process, SEND_EVENT_SEND_NEXT_LL, NULL); |
743 | | - ZW_SendResetReportZIP(STATUS_SOFT_RESET_OK); |
| 768 | + //ZW_SendResetReportZIP(STATUS_SOFT_RESET_OK); |
| 769 | + notify_ncp_controller_status_via_unsolicited_dest(STATUS_SOFT_RESET_OK); |
744 | 770 | } else { |
745 | 771 | ERR_PRINTF("Soft reset failed\n"); |
746 | | - ZW_SendResetReportZIP(STATUS_SOFT_RESET_FAIL); |
| 772 | + //ZW_SendResetReportZIP(STATUS_SOFT_RESET_FAIL); |
| 773 | + notify_ncp_controller_status_via_unsolicited_dest(STATUS_SOFT_RESET_FAIL); |
747 | 774 | } |
748 | 775 | } |
749 | 776 | } |
|
0 commit comments