|
1 | 1 | /* © 2014 Silicon Laboratories Inc. |
2 | 2 | */ |
3 | 3 | #include "CC_Gateway.h" |
| 4 | +#include "CC_GatewayKeepAlive.h" |
4 | 5 | #include "DataStore.h" |
5 | 6 | #include "ZW_classcmd.h" |
6 | 7 | #include "ZW_classcmd_ex.h" |
|
11 | 12 | #include "ZW_udp_server.h" |
12 | 13 | #include "Serialapi.h" |
13 | 14 | #include "ZW_ZIPApplication.h" |
| 15 | +#include "ClassicZIPNode.h" |
14 | 16 | #include "command_handler.h" |
| 17 | +#include "ZIP_Router_logging.h" |
| 18 | +#include "zw_network_info.h" |
| 19 | +#include "zip_router_ipv6_utils.h" |
15 | 20 | #include <stdlib.h> |
| 21 | +#include <string.h> |
16 | 22 |
|
17 | 23 | static u8_t tunnelTimer = 0xFF; |
18 | 24 |
|
@@ -379,6 +385,53 @@ static command_handler_codes_t Gateway_CommandHandler(zwave_connection_t *c, uin |
379 | 385 |
|
380 | 386 | break; |
381 | 387 |
|
| 388 | + case GATEWAY_IMPORTANT_NODE_LIST_SET: |
| 389 | + { |
| 390 | + uint8_t report[3]; |
| 391 | + int rc; |
| 392 | + |
| 393 | + if (bDatalen < 4) |
| 394 | + { |
| 395 | + printf("GATEWAY_IMPORTANT_NODE_LIST_SET: payload too short (%u)\r\n", bDatalen); |
| 396 | + report[0] = COMMAND_CLASS_ZIP_GATEWAY; |
| 397 | + report[1] = GATEWAY_IMPORTANT_NODE_LIST_REPORT; |
| 398 | + report[2] = 0xFF; |
| 399 | + ZW_SendDataZIP(c, report, sizeof(report), NULL); |
| 400 | + break; |
| 401 | + } |
| 402 | + |
| 403 | + rc = gw_keepalive_handle_important_node_set(pData + 2, bDatalen - 2); |
| 404 | + report[0] = COMMAND_CLASS_ZIP_GATEWAY; |
| 405 | + report[1] = GATEWAY_IMPORTANT_NODE_LIST_REPORT; |
| 406 | + report[2] = (rc == 0) ? 0x00 : 0xFF; |
| 407 | + ZW_SendDataZIP(c, report, sizeof(report), NULL); |
| 408 | + } |
| 409 | + break; |
| 410 | + |
| 411 | + case GATEWAY_APP_STATE_SET: |
| 412 | + { |
| 413 | + uint8_t report[3]; |
| 414 | + int rc; |
| 415 | + |
| 416 | + if (bDatalen < 3) |
| 417 | + { |
| 418 | + printf("GATEWAY_APP_STATE_SET: payload too short (%u)\r\n", bDatalen); |
| 419 | + report[0] = COMMAND_CLASS_ZIP_GATEWAY; |
| 420 | + report[1] = GATEWAY_APP_STATE_REPORT; |
| 421 | + report[2] = 0xFF; |
| 422 | + ZW_SendDataZIP(c, report, sizeof(report), NULL); |
| 423 | + break; |
| 424 | + } |
| 425 | + |
| 426 | + rc = gw_keepalive_handle_app_state_set(pData[2], |
| 427 | + (bDatalen >= 4) ? pData[3] : 0x00); |
| 428 | + report[0] = COMMAND_CLASS_ZIP_GATEWAY; |
| 429 | + report[1] = GATEWAY_APP_STATE_REPORT; |
| 430 | + report[2] = (rc == 0) ? 0x00 : 0xFF; |
| 431 | + ZW_SendDataZIP(c, report, sizeof(report), NULL); |
| 432 | + } |
| 433 | + break; |
| 434 | + |
382 | 435 | default: |
383 | 436 | printf("Gateway_CommandHandler: Unsupported command received.\r\n"); |
384 | 437 | return COMMAND_NOT_SUPPORTED; |
|
0 commit comments