Z-Wave Protocol Controller Reference
zwave_command_type.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * # License
3 * <b>Copyright 2022 Silicon Laboratories Inc. www.silabs.com</b>
4 ******************************************************************************
5 * The licensor of this software is Silicon Laboratories Inc. Your use of this
6 * software is governed by the terms of Silicon Labs Master Software License
7 * Agreement (MSLA) available at
8 * www.silabs.com/about-us/legal/master-software-license-agreement. This
9 * software is distributed to you in Source Code format and is governed by the
10 * sections of the MSLA applicable to Source Code.
11 *
12 *****************************************************************************/
13
21#ifndef ZWAVE_COMMAND_TYPE_HPP
22#define ZWAVE_COMMAND_TYPE_HPP
23
24#include <stdint.h>
25#include <set>
28{
29 public:
30 typedef enum { SET, GET, REPORT, SUPERVISION, UNKNOWN } type_t;
31
39 static inline type_t get_type(zwave_command_class_t command_class,
40 zwave_command_t command)
41 {
42 uint16_t key = (command_class << 8) | command;
43 if (key == 0x6C01) {
44 return type_t::SUPERVISION;
45 } else if (get_list.count(key)) {
46 return type_t::GET;
47 } else if (set_list.count(key)) {
48 return type_t::SET;
49 } else if (rep_list.count(key)) {
50 return type_t::REPORT;
51 }
52 return type_t::UNKNOWN;
53 }
54
63 static inline bool is_supporting(zwave_command_class_t command_class,
64 zwave_command_t command)
65 {
66 uint16_t key = (command_class << 8) | command;
67 return supported_list.count(key);
68 }
69
70 // The implementation of this is autogenerated
71 static const std::set<uint16_t> supported_list;
72 static const std::set<uint16_t> rep_list;
73 static const std::set<uint16_t> set_list;
74 static const std::set<uint16_t> get_list;
75};
76
77#endif //ZWAVE_COMMAND_TYPE_HPP
Definition: zwave_command_type.hpp:28
static const std::set< uint16_t > set_list
Definition: zwave_command_type.hpp:73
static type_t get_type(zwave_command_class_t command_class, zwave_command_t command)
Get the type of a Z-Wave frame.
Definition: zwave_command_type.hpp:39
static bool is_supporting(zwave_command_class_t command_class, zwave_command_t command)
Return is a frame is a supporting frame.
Definition: zwave_command_type.hpp:63
static const std::set< uint16_t > supported_list
Definition: zwave_command_type.hpp:71
static const std::set< uint16_t > get_list
Definition: zwave_command_type.hpp:74
static const std::set< uint16_t > rep_list
Definition: zwave_command_type.hpp:72
type_t
Definition: zwave_command_type.hpp:30
@ REPORT
Definition: zwave_command_type.hpp:30
@ SUPERVISION
Definition: zwave_command_type.hpp:30
@ UNKNOWN
Definition: zwave_command_type.hpp:30
@ GET
Definition: zwave_command_type.hpp:30
@ SET
Definition: zwave_command_type.hpp:30
uint16_t zwave_command_class_t
Definition: zwave_generic_types.h:29
uint8_t zwave_command_t
Definition: zwave_generic_types.h:30