text: /**
   * Author: Crownstone Team
   * Copyright: Crownstone (https://crownstone.rocks)
   * Date: Oct 9, 2019
   * License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
   */
  
  
  #include<common/cs_Types.h>
  #include <localisation/cs_TrackableEvent.h>
  
  CS_TYPE toCsType(uint16_t type) {
  
  	CS_TYPE csType = static_cast<CS_TYPE>(type);
  	switch (csType) {
  	case CS_TYPE::CONFIG_DO_NOT_USE:
  	case CS_TYPE::CONFIG_NAME:
  	case CS_TYPE::CONFIG_PWM_PERIOD:
  	case CS_TYPE::CONFIG_IBEACON_MAJOR:
  	case CS_TYPE::CONFIG_IBEACON_MINOR:
  	case CS_TYPE::CONFIG_IBEACON_UUID:
  	case CS_TYPE::CONFIG_IBEACON_TXPOWER:
  	case CS_TYPE::CONFIG_TX_POWER:
  	case CS_TYPE::CONFIG_ADV_INTERVAL:
  	case CS_TYPE::CONFIG_SCAN_DURATION:
  	case CS_TYPE::CONFIG_SCAN_BREAK_DURATION:
  	case CS_TYPE::CONFIG_BOOT_DELAY:
  	case CS_TYPE::CONFIG_MAX_CHIP_TEMP:
  	case CS_TYPE::CONFIG_CURRENT_LIMIT:
  	case CS_TYPE::CONFIG_MESH_ENABLED:
  	case CS_TYPE::CONFIG_ENCRYPTION_ENABLED:
  	case CS_TYPE::CONFIG_IBEACON_ENABLED:
  	case CS_TYPE::CONFIG_SCANNER_ENABLED:
  	case CS_TYPE::CONFIG_SPHERE_ID:
  	case CS_TYPE::CONFIG_CROWNSTONE_ID:
  	case CS_TYPE::CONFIG_KEY_ADMIN:
  	case CS_TYPE::CONFIG_KEY_MEMBER:
  	case CS_TYPE::CONFIG_KEY_BASIC:
  	case CS_TYPE::CONFIG_KEY_SERVICE_DATA:
  	case CS_TYPE::CONFIG_MESH_DEVICE_KEY:
  	case CS_TYPE::CONFIG_MESH_APP_KEY:
  	case CS_TYPE::CONFIG_MESH_NET_KEY:
  	case CS_TYPE::CONFIG_KEY_LOCALIZATION:
  	case CS_TYPE::CONFIG_SCAN_INTERVAL:
  	case CS_TYPE::CONFIG_SCAN_WINDOW:
  	case CS_TYPE::CONFIG_RELAY_HIGH_DURATION:
  	case CS_TYPE::CONFIG_LOW_TX_POWER:
  	case CS_TYPE::CONFIG_VOLTAGE_MULTIPLIER:
  	case CS_TYPE::CONFIG_CURRENT_MULTIPLIER:
  	case CS_TYPE::CONFIG_VOLTAGE_ADC_ZERO:
  	case CS_TYPE::CONFIG_CURRENT_ADC_ZERO:
  	case CS_TYPE::CONFIG_POWER_ZERO:
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD:
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD_DIMMER:
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_UP:
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_DOWN:
  	case CS_TYPE::CONFIG_PWM_ALLOWED:
  	case CS_TYPE::CONFIG_START_DIMMER_ON_ZERO_CROSSING:
  	case CS_TYPE::CONFIG_SWITCH_LOCKED:
  	case CS_TYPE::CONFIG_SWITCHCRAFT_ENABLED:
  	case CS_TYPE::CONFIG_SWITCHCRAFT_THRESHOLD:
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_ENABLED:
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_RSSI_THRESHOLD_OFFSET:
  	case CS_TYPE::CONFIG_UART_ENABLED:
  	case CS_TYPE::STATE_BEHAVIOUR_RULE:
  	case CS_TYPE::STATE_TWILIGHT_RULE:
  	case CS_TYPE::STATE_EXTENDED_BEHAVIOUR_RULE:
  	case CS_TYPE::STATE_BEHAVIOUR_SETTINGS:
  	case CS_TYPE::STATE_BEHAVIOUR_MASTER_HASH:
  	case CS_TYPE::STATE_RESET_COUNTER:
  	case CS_TYPE::STATE_OPERATION_MODE:
  	case CS_TYPE::STATE_SWITCH_STATE:
  	case CS_TYPE::STATE_ACCUMULATED_ENERGY:
  	case CS_TYPE::STATE_POWER_USAGE:
  	case CS_TYPE::STATE_TEMPERATURE:
  	case CS_TYPE::STATE_SUN_TIME:
  	case CS_TYPE::STATE_FACTORY_RESET:
  	case CS_TYPE::STATE_ERRORS:
  	case CS_TYPE::STATE_MESH_IV_INDEX:
  	case CS_TYPE::STATE_MESH_SEQ_NUMBER:
  	case CS_TYPE::STATE_IBEACON_CONFIG_ID:
  	case CS_TYPE::STATE_MICROAPP:
  	case CS_TYPE::STATE_SOFT_ON_SPEED:
  	case CS_TYPE::STATE_HUB_MODE:
  	case CS_TYPE::STATE_UART_KEY:
  	case CS_TYPE::CMD_SWITCH_OFF:
  	case CS_TYPE::CMD_SWITCH_ON:
  	case CS_TYPE::CMD_SWITCH_TOGGLE:
  	case CS_TYPE::CMD_SWITCH:
  	case CS_TYPE::CMD_MULTI_SWITCH:
  	case CS_TYPE::EVT_ADV_BACKGROUND:
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED:
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED_V1:
  	case CS_TYPE::EVT_ADVERTISEMENT_UPDATED:
  	case CS_TYPE::EVT_SCAN_STARTED:
  	case CS_TYPE::EVT_SCAN_STOPPED:
  	case CS_TYPE::EVT_DEVICE_SCANNED:
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD_DIMMER:
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_DIMMER_ON_FAILURE_DETECTED:
  	case CS_TYPE::EVT_DIMMER_OFF_FAILURE_DETECTED:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_REGISTER:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_REGISTER:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_TOKEN:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_TOKEN:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_LIST_SIZE:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_LIST_SIZE:
  	case CS_TYPE::CMD_SEND_MESH_CONTROL_COMMAND:
  	case CS_TYPE::EVT_BLE_CONNECT:
  	case CS_TYPE::EVT_BLE_DISCONNECT:
  	case CS_TYPE::EVT_OUTGOING_CONNECT_START:
  	case CS_TYPE::EVT_OUTGOING_CONNECTED:
  	case CS_TYPE::EVT_OUTGOING_DISCONNECTED:
  	case CS_TYPE::EVT_BROWNOUT_IMPENDING:
  	case CS_TYPE::EVT_SESSION_DATA_SET:
  	case CS_TYPE::EVT_DIMMER_FORCED_OFF:
  	case CS_TYPE::EVT_SWITCH_FORCED_OFF:
  	case CS_TYPE::EVT_RELAY_FORCED_ON:
  	case CS_TYPE::EVT_CHIP_TEMP_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_CHIP_TEMP_OK:
  	case CS_TYPE::EVT_DIMMER_TEMP_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_DIMMER_TEMP_OK:
  	case CS_TYPE::EVT_TICK:
  	case CS_TYPE::EVT_TIME_SET:
  	case CS_TYPE::EVT_DIMMER_POWERED:
  	case CS_TYPE::CMD_DIMMING_ALLOWED:
  	case CS_TYPE::CMD_SWITCHING_ALLOWED:
  	case CS_TYPE::EVT_STATE_EXTERNAL_STONE:
  	case CS_TYPE::EVT_STATE_FACTORY_RESET_DONE:
  	case CS_TYPE::EVT_STORAGE_INITIALIZED:
  	case CS_TYPE::EVT_STORAGE_WRITE_DONE:
  	case CS_TYPE::EVT_STORAGE_REMOVE_DONE:
  	case CS_TYPE::EVT_STORAGE_REMOVE_ALL_TYPES_WITH_ID_DONE:
  	case CS_TYPE::EVT_STORAGE_GC_DONE:
  	case CS_TYPE::EVT_STORAGE_FACTORY_RESET_DONE:
  	case CS_TYPE::EVT_STORAGE_PAGES_ERASED:
  	case CS_TYPE::EVT_MESH_FACTORY_RESET_DONE:
  	case CS_TYPE::CMD_STORAGE_GARBAGE_COLLECT:
  	case CS_TYPE::EVT_SETUP_DONE:
  	case CS_TYPE::EVT_ADC_RESTARTED:
  	case CS_TYPE::CMD_SEND_MESH_MSG:
  	case CS_TYPE::CMD_SEND_MESH_MSG_MULTI_SWITCH:
  	case CS_TYPE::CMD_SEND_MESH_MSG_PROFILE_LOCATION:
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_BEHAVIOUR_SETTINGS:
  	case CS_TYPE::CMD_SET_TIME:
  	case CS_TYPE::CMD_FACTORY_RESET:
  	case CS_TYPE::CMD_ENABLE_LOG_POWER:
  	case CS_TYPE::CMD_ENABLE_LOG_CURRENT:
  	case CS_TYPE::CMD_ENABLE_LOG_VOLTAGE:
  	case CS_TYPE::CMD_ENABLE_LOG_FILTERED_CURRENT:
  	case CS_TYPE::CMD_RESET_DELAYED:
  	case CS_TYPE::CMD_ENABLE_ADVERTISEMENT:
  	case CS_TYPE::CMD_ENABLE_MESH:
  	case CS_TYPE::CMD_TOGGLE_ADC_VOLTAGE_VDD_REFERENCE_PIN:
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_CURRENT:
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_VOLTAGE:
  	case CS_TYPE::CMD_INC_VOLTAGE_RANGE:
  	case CS_TYPE::CMD_DEC_VOLTAGE_RANGE:
  	case CS_TYPE::CMD_INC_CURRENT_RANGE:
  	case CS_TYPE::CMD_DEC_CURRENT_RANGE:
  	case CS_TYPE::CMD_CONTROL_CMD:
  	case CS_TYPE::CMD_ADD_BEHAVIOUR:
  	case CS_TYPE::CMD_REPLACE_BEHAVIOUR:
  	case CS_TYPE::CMD_REMOVE_BEHAVIOUR:
  	case CS_TYPE::CMD_GET_BEHAVIOUR:
  	case CS_TYPE::CMD_GET_BEHAVIOUR_INDICES:
  	case CS_TYPE::CMD_GET_BEHAVIOUR_DEBUG:
  	case CS_TYPE::CMD_CLEAR_ALL_BEHAVIOUR:
  	case CS_TYPE::EVT_BEHAVIOURSTORE_MUTATION:
  	case CS_TYPE::EVT_BEHAVIOUR_OVERRIDDEN:
  	case CS_TYPE::CMD_REGISTER_TRACKED_DEVICE:
  	case CS_TYPE::CMD_UPDATE_TRACKED_DEVICE:
  	case CS_TYPE::CMD_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::EVT_PRESENCE_MUTATION:
  	case CS_TYPE::EVT_PRESENCE_CHANGE:
  	case CS_TYPE::CMD_GET_PRESENCE:
  	case CS_TYPE::CMD_SET_RELAY:
  	case CS_TYPE::CMD_SET_DIMMER:
  	case CS_TYPE::EVT_GOING_TO_DFU:
  	case CS_TYPE::EVT_RECEIVED_PROFILE_LOCATION:
  	case CS_TYPE::EVT_TRACKABLE:
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_OUTGOING:
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_INCOMING:
  	case CS_TYPE::EVT_MESH_SYNC_FAILED:
  	case CS_TYPE::EVT_MESH_PAGES_ERASED:
  	case CS_TYPE::EVT_MESH_EXT_STATE_0:
  	case CS_TYPE::EVT_MESH_EXT_STATE_1:
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_TIME:
  	case CS_TYPE::CMD_SET_IBEACON_CONFIG_ID:
  	case CS_TYPE::CMD_SEND_MESH_MSG_NOOP:
  	case CS_TYPE::EVT_MESH_RSSI_PING:
  	case CS_TYPE::EVT_MESH_RSSI_DATA:
  	case CS_TYPE::EVT_MESH_NEAREST_WITNESS_REPORT:
  	case CS_TYPE::EVT_MESH_TIME_SYNC:
  	case CS_TYPE::EVT_RECV_MESH_MSG:
  	case CS_TYPE::CMD_GET_ADC_RESTARTS:
  	case CS_TYPE::CMD_GET_SWITCH_HISTORY:
  	case CS_TYPE::CMD_GET_POWER_SAMPLES:
  	case CS_TYPE::CMD_GET_SCHEDULER_MIN_FREE:
  	case CS_TYPE::CMD_GET_RESET_REASON:
  	case CS_TYPE::CMD_GET_GPREGRET:
  	case CS_TYPE::CMD_GET_ADC_CHANNEL_SWAPS:
  	case CS_TYPE::CMD_GET_RAM_STATS:
  	case CS_TYPE::EVT_GENERIC_TEST:
  	case CS_TYPE::CMD_TEST_SET_TIME:
  	case CS_TYPE::CMD_MICROAPP:
  	case CS_TYPE::EVT_MICROAPP:
  	case CS_TYPE::CMD_MICROAPP_ADVERTISE:
  	case CS_TYPE::EVT_HUB_DATA_REPLY:
  		return csType;
  	}
  	return CS_TYPE::CONFIG_DO_NOT_USE;
  }
  
  //bool validateSize(cs_state_data_t const & data, size16_t size) {
  //	auto type = data.type;
  //	switch (type) {
  //		case CS_TYPE::CONFIG_BEHAVIOUR: {
  //			return SwitchBehaviour::checkSize(data.data, data.size, size);
  //		}
  //	}
  //	return size == TypeSize(type);
  //}
  
  size16_t TypeSize(CS_TYPE const & type) {
  
  	switch (type) {
  	case CS_TYPE::CONFIG_DO_NOT_USE:
  		return 0;
  	case CS_TYPE::CONFIG_NAME:
  		return MAX_STRING_STORAGE_SIZE+1;
  	case CS_TYPE::CONFIG_PWM_PERIOD:
  		return sizeof(TYPIFY(CONFIG_PWM_PERIOD));
  	case CS_TYPE::CONFIG_IBEACON_MAJOR:
  		return sizeof(TYPIFY(CONFIG_IBEACON_MAJOR));
  	case CS_TYPE::CONFIG_IBEACON_MINOR:
  		return sizeof(TYPIFY(CONFIG_IBEACON_MINOR));
  	case CS_TYPE::CONFIG_IBEACON_UUID:
  		return sizeof(TYPIFY(CONFIG_IBEACON_UUID));
  	case CS_TYPE::CONFIG_IBEACON_TXPOWER:
  		return sizeof(TYPIFY(CONFIG_IBEACON_TXPOWER));
  	case CS_TYPE::CONFIG_TX_POWER:
  		return sizeof(TYPIFY(CONFIG_TX_POWER));
  	case CS_TYPE::CONFIG_ADV_INTERVAL:
  		return sizeof(TYPIFY(CONFIG_ADV_INTERVAL));
  	case CS_TYPE::CONFIG_SCAN_DURATION:
  		return sizeof(TYPIFY(CONFIG_SCAN_DURATION));
  	case CS_TYPE::CONFIG_SCAN_BREAK_DURATION:
  		return sizeof(TYPIFY(CONFIG_SCAN_BREAK_DURATION));
  	case CS_TYPE::CONFIG_BOOT_DELAY:
  		return sizeof(TYPIFY(CONFIG_BOOT_DELAY));
  	case CS_TYPE::CONFIG_MAX_CHIP_TEMP:
  		return sizeof(TYPIFY(CONFIG_MAX_CHIP_TEMP));
  	case CS_TYPE::CONFIG_CURRENT_LIMIT:
  		return 0; // Not implemented
  	case CS_TYPE::CONFIG_MESH_ENABLED:
  		return sizeof(TYPIFY(CONFIG_MESH_ENABLED));
  	case CS_TYPE::CONFIG_ENCRYPTION_ENABLED:
  		return sizeof(TYPIFY(CONFIG_ENCRYPTION_ENABLED));
  	case CS_TYPE::CONFIG_IBEACON_ENABLED:
  		return sizeof(TYPIFY(CONFIG_IBEACON_ENABLED));
  	case CS_TYPE::CONFIG_SCANNER_ENABLED:
  		return sizeof(TYPIFY(CONFIG_SCANNER_ENABLED));
  	case CS_TYPE::CONFIG_SPHERE_ID:
  		return sizeof(TYPIFY(CONFIG_SPHERE_ID));
  	case CS_TYPE::CONFIG_CROWNSTONE_ID:
  		return sizeof(TYPIFY(CONFIG_CROWNSTONE_ID));
  	case CS_TYPE::CONFIG_KEY_ADMIN:
  		return ENCRYPTION_KEY_LENGTH;
  	case CS_TYPE::CONFIG_KEY_MEMBER:
  		return ENCRYPTION_KEY_LENGTH;
  	case CS_TYPE::CONFIG_KEY_BASIC:
  		return ENCRYPTION_KEY_LENGTH;
  	case CS_TYPE::CONFIG_KEY_SERVICE_DATA:
  		return ENCRYPTION_KEY_LENGTH;
  	case CS_TYPE::CONFIG_MESH_DEVICE_KEY:
  		return ENCRYPTION_KEY_LENGTH;
  	case CS_TYPE::CONFIG_MESH_APP_KEY:
  		return ENCRYPTION_KEY_LENGTH;
  	case CS_TYPE::CONFIG_MESH_NET_KEY:
  		return ENCRYPTION_KEY_LENGTH;
  	case CS_TYPE::CONFIG_KEY_LOCALIZATION:
  		return ENCRYPTION_KEY_LENGTH;
  	case CS_TYPE::CONFIG_SCAN_INTERVAL:
  		return sizeof(TYPIFY(CONFIG_SCAN_INTERVAL));
  	case CS_TYPE::CONFIG_SCAN_WINDOW:
  		return sizeof(TYPIFY(CONFIG_SCAN_WINDOW));
  	case CS_TYPE::CONFIG_RELAY_HIGH_DURATION:
  		return sizeof(TYPIFY(CONFIG_RELAY_HIGH_DURATION));
  	case CS_TYPE::CONFIG_LOW_TX_POWER:
  		return sizeof(TYPIFY(CONFIG_LOW_TX_POWER));
  	case CS_TYPE::CONFIG_VOLTAGE_MULTIPLIER:
  		return sizeof(TYPIFY(CONFIG_VOLTAGE_MULTIPLIER));
  	case CS_TYPE::CONFIG_CURRENT_MULTIPLIER:
  		return sizeof(TYPIFY(CONFIG_CURRENT_MULTIPLIER));
  	case CS_TYPE::CONFIG_VOLTAGE_ADC_ZERO:
  		return sizeof(TYPIFY(CONFIG_VOLTAGE_ADC_ZERO));
  	case CS_TYPE::CONFIG_CURRENT_ADC_ZERO:
  		return sizeof(TYPIFY(CONFIG_CURRENT_ADC_ZERO));
  	case CS_TYPE::CONFIG_POWER_ZERO:
  		return sizeof(TYPIFY(CONFIG_POWER_ZERO));
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD:
  		return sizeof(TYPIFY(CONFIG_SOFT_FUSE_CURRENT_THRESHOLD));
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD_DIMMER:
  		return sizeof(TYPIFY(CONFIG_SOFT_FUSE_CURRENT_THRESHOLD_DIMMER));
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_UP:
  		return sizeof(TYPIFY(CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_UP));
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_DOWN:
  		return sizeof(TYPIFY(CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_DOWN));
  	case CS_TYPE::CONFIG_PWM_ALLOWED:
  		return sizeof(TYPIFY(CONFIG_PWM_ALLOWED));
  	case CS_TYPE::CONFIG_START_DIMMER_ON_ZERO_CROSSING:
  		return sizeof(TYPIFY(CONFIG_START_DIMMER_ON_ZERO_CROSSING));
  	case CS_TYPE::CONFIG_SWITCH_LOCKED:
  		return sizeof(TYPIFY(CONFIG_SWITCH_LOCKED));
  	case CS_TYPE::CONFIG_SWITCHCRAFT_ENABLED:
  		return sizeof(TYPIFY(CONFIG_SWITCHCRAFT_ENABLED));
  	case CS_TYPE::CONFIG_SWITCHCRAFT_THRESHOLD:
  		return sizeof(TYPIFY(CONFIG_SWITCHCRAFT_THRESHOLD));
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_ENABLED:
  		return sizeof(TYPIFY(CONFIG_TAP_TO_TOGGLE_ENABLED));
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_RSSI_THRESHOLD_OFFSET:
  		return sizeof(TYPIFY(CONFIG_TAP_TO_TOGGLE_RSSI_THRESHOLD_OFFSET));
  	case CS_TYPE::CONFIG_UART_ENABLED:
  		return sizeof(TYPIFY(CONFIG_UART_ENABLED));
  	case CS_TYPE::STATE_BEHAVIOUR_RULE:
  		return WireFormat::size<SwitchBehaviour>();
  	case CS_TYPE::STATE_TWILIGHT_RULE:
  		return WireFormat::size<TwilightBehaviour>();
  	case CS_TYPE::STATE_EXTENDED_BEHAVIOUR_RULE:
  		return WireFormat::size<ExtendedSwitchBehaviour>();
  	case CS_TYPE::STATE_BEHAVIOUR_SETTINGS:
  		return sizeof(TYPIFY(STATE_BEHAVIOUR_SETTINGS));
  	case CS_TYPE::STATE_BEHAVIOUR_MASTER_HASH:
  		return sizeof(TYPIFY(STATE_BEHAVIOUR_MASTER_HASH));
  	case CS_TYPE::STATE_RESET_COUNTER:
  		return sizeof(TYPIFY(STATE_RESET_COUNTER));
  	case CS_TYPE::STATE_SWITCH_STATE:
  		return sizeof(TYPIFY(STATE_SWITCH_STATE));
  	case CS_TYPE::STATE_ACCUMULATED_ENERGY:
  		return sizeof(TYPIFY(STATE_ACCUMULATED_ENERGY));
  	case CS_TYPE::STATE_POWER_USAGE:
  		return sizeof(TYPIFY(STATE_POWER_USAGE));
  	case CS_TYPE::STATE_OPERATION_MODE:
  		return sizeof(TYPIFY(STATE_OPERATION_MODE));
  	case CS_TYPE::STATE_TEMPERATURE:
  		return sizeof(TYPIFY(STATE_TEMPERATURE));
  	case CS_TYPE::STATE_SUN_TIME:
  		return sizeof(TYPIFY(STATE_SUN_TIME));
  	case CS_TYPE::STATE_FACTORY_RESET:
  		return sizeof(TYPIFY(STATE_FACTORY_RESET));
  	case CS_TYPE::STATE_ERRORS:
  		return sizeof(TYPIFY(STATE_ERRORS));
  	case CS_TYPE::STATE_MESH_IV_INDEX:
  		return sizeof(TYPIFY(STATE_MESH_IV_INDEX));
  	case CS_TYPE::STATE_MESH_SEQ_NUMBER:
  		return sizeof(TYPIFY(STATE_MESH_SEQ_NUMBER));
  	case CS_TYPE::STATE_IBEACON_CONFIG_ID:
  		return sizeof(TYPIFY(STATE_IBEACON_CONFIG_ID));
  	case CS_TYPE::STATE_MICROAPP:
  		return sizeof(TYPIFY(STATE_MICROAPP));
  	case CS_TYPE::STATE_SOFT_ON_SPEED:
  		return sizeof(TYPIFY(STATE_SOFT_ON_SPEED));
  	case CS_TYPE::STATE_HUB_MODE:
  		return sizeof(TYPIFY(STATE_HUB_MODE));
  	case CS_TYPE::STATE_UART_KEY:
  		return ENCRYPTION_KEY_LENGTH;
  	case CS_TYPE::CMD_SWITCH_OFF:
  		return 0;
  	case CS_TYPE::CMD_SWITCH_ON:
  		return 0;
  	case CS_TYPE::CMD_SWITCH_TOGGLE:
  		return 0;
  	case CS_TYPE::CMD_SWITCH:
  		return sizeof(TYPIFY(CMD_SWITCH));
  	case CS_TYPE::CMD_MULTI_SWITCH:
  		return sizeof(TYPIFY(CMD_MULTI_SWITCH));
  	case CS_TYPE::EVT_ADV_BACKGROUND:
  		return sizeof(TYPIFY(EVT_ADV_BACKGROUND));
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED:
  		return sizeof(TYPIFY(EVT_ADV_BACKGROUND_PARSED));
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED_V1:
  		return sizeof(TYPIFY(EVT_ADV_BACKGROUND_PARSED_V1));
  	case CS_TYPE::EVT_ADVERTISEMENT_UPDATED:
  		return 0;
  	case CS_TYPE::EVT_SCAN_STARTED:
  		return 0;
  	case CS_TYPE::EVT_SCAN_STOPPED:
  		return 0;
  	case CS_TYPE::EVT_DEVICE_SCANNED:
  		return sizeof(TYPIFY(EVT_DEVICE_SCANNED));
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD_DIMMER:
  		return 0;
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD:
  		return 0;
  	case CS_TYPE::EVT_DIMMER_ON_FAILURE_DETECTED:
  		return 0;
  	case CS_TYPE::EVT_DIMMER_OFF_FAILURE_DETECTED:
  		return 0;
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_REGISTER:
  		return sizeof(TYPIFY(EVT_MESH_TRACKED_DEVICE_REGISTER));
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_REGISTER:
  		return sizeof(TYPIFY(CMD_SEND_MESH_MSG_TRACKED_DEVICE_REGISTER));
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_TOKEN:
  		return sizeof(TYPIFY(EVT_MESH_TRACKED_DEVICE_TOKEN));
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_TOKEN:
  		return sizeof(TYPIFY(CMD_SEND_MESH_MSG_TRACKED_DEVICE_TOKEN));
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_HEARTBEAT:
  		return sizeof(TYPIFY(EVT_MESH_TRACKED_DEVICE_HEARTBEAT));
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_HEARTBEAT:
  		return sizeof(TYPIFY(CMD_SEND_MESH_MSG_TRACKED_DEVICE_HEARTBEAT));
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_LIST_SIZE:
  		return sizeof(TYPIFY(EVT_MESH_TRACKED_DEVICE_LIST_SIZE));
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_LIST_SIZE:
  		return sizeof(TYPIFY(CMD_SEND_MESH_MSG_TRACKED_DEVICE_LIST_SIZE));
  	case CS_TYPE::CMD_SEND_MESH_CONTROL_COMMAND:
  		return sizeof(TYPIFY(CMD_SEND_MESH_CONTROL_COMMAND));
  	case CS_TYPE::EVT_BLE_CONNECT:
  		return 0;
  	case CS_TYPE::EVT_BLE_DISCONNECT:
  		return 0;
  	case CS_TYPE::EVT_OUTGOING_CONNECT_START:
  		return 0;
  	case CS_TYPE::EVT_OUTGOING_CONNECTED:
  		return 0;
  	case CS_TYPE::EVT_OUTGOING_DISCONNECTED:
  		return 0;
  	case CS_TYPE::EVT_BROWNOUT_IMPENDING:
  		return 0;
  	case CS_TYPE::EVT_SESSION_DATA_SET:
  		return sizeof(TYPIFY(EVT_SESSION_DATA_SET));
  	case CS_TYPE::EVT_DIMMER_FORCED_OFF:
  		return 0;
  	case CS_TYPE::EVT_SWITCH_FORCED_OFF:
  		return 0;
  	case CS_TYPE::EVT_RELAY_FORCED_ON:
  		return 0;
  	case CS_TYPE::EVT_CHIP_TEMP_ABOVE_THRESHOLD:
  		return 0;
  	case CS_TYPE::EVT_CHIP_TEMP_OK:
  		return 0;
  	case CS_TYPE::EVT_DIMMER_TEMP_ABOVE_THRESHOLD:
  		return 0;
  	case CS_TYPE::EVT_DIMMER_TEMP_OK:
  		return 0;
  	case CS_TYPE::EVT_TICK:
  		return sizeof(uint32_t);
  	case CS_TYPE::EVT_TIME_SET:
  		return sizeof(uint32_t);
  	case CS_TYPE::EVT_DIMMER_POWERED:
  		return sizeof(TYPIFY(EVT_DIMMER_POWERED));
  	case CS_TYPE::CMD_DIMMING_ALLOWED:
  		return sizeof(TYPIFY(CMD_DIMMING_ALLOWED));
  	case CS_TYPE::CMD_SWITCHING_ALLOWED:
  		return sizeof(TYPIFY(CMD_SWITCHING_ALLOWED));
  	case CS_TYPE::EVT_STATE_EXTERNAL_STONE:
  		return sizeof(TYPIFY(EVT_STATE_EXTERNAL_STONE));
  	case CS_TYPE::EVT_STATE_FACTORY_RESET_DONE:
  		return 0;
  	case CS_TYPE::EVT_STORAGE_INITIALIZED:
  		return 0;
  	case CS_TYPE::EVT_STORAGE_WRITE_DONE:
  		return sizeof(TYPIFY(EVT_STORAGE_WRITE_DONE));
  	case CS_TYPE::EVT_STORAGE_REMOVE_DONE:
  		return sizeof(TYPIFY(EVT_STORAGE_REMOVE_DONE));
  	case CS_TYPE::EVT_STORAGE_REMOVE_ALL_TYPES_WITH_ID_DONE:
  		return sizeof(TYPIFY(EVT_STORAGE_REMOVE_ALL_TYPES_WITH_ID_DONE));
  	case CS_TYPE::EVT_STORAGE_GC_DONE:
  		return 0;
  	case CS_TYPE::EVT_STORAGE_FACTORY_RESET_DONE:
  		return 0;
  	case CS_TYPE::EVT_STORAGE_PAGES_ERASED:
  		return 0;
  	case CS_TYPE::EVT_MESH_FACTORY_RESET_DONE:
  		return 0;
  	case CS_TYPE::CMD_STORAGE_GARBAGE_COLLECT:
  		return 0;
  	case CS_TYPE::EVT_SETUP_DONE:
  		return 0;
  	case CS_TYPE::EVT_ADC_RESTARTED:
  		return 0;
  	case CS_TYPE::CMD_ENABLE_LOG_POWER:
  		return sizeof(TYPIFY(CMD_ENABLE_LOG_POWER));
  	case CS_TYPE::CMD_ENABLE_LOG_CURRENT:
  		return sizeof(TYPIFY(CMD_ENABLE_LOG_CURRENT));
  	case CS_TYPE::CMD_ENABLE_LOG_VOLTAGE:
  		return sizeof(TYPIFY(CMD_ENABLE_LOG_VOLTAGE));
  	case CS_TYPE::CMD_ENABLE_LOG_FILTERED_CURRENT:
  		return sizeof(TYPIFY(CMD_ENABLE_LOG_FILTERED_CURRENT));
  	case CS_TYPE::CMD_RESET_DELAYED:
  		return sizeof(TYPIFY(CMD_RESET_DELAYED));
  	case CS_TYPE::CMD_ENABLE_ADVERTISEMENT:
  		return sizeof(TYPIFY(CMD_ENABLE_ADVERTISEMENT));
  	case CS_TYPE::CMD_ENABLE_MESH:
  		return sizeof(TYPIFY(CMD_ENABLE_MESH));
  	case CS_TYPE::CMD_TOGGLE_ADC_VOLTAGE_VDD_REFERENCE_PIN:
  		return 0;
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_CURRENT:
  		return sizeof(TYPIFY(CMD_ENABLE_ADC_DIFFERENTIAL_CURRENT));
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_VOLTAGE:
  		return sizeof(TYPIFY(CMD_ENABLE_ADC_DIFFERENTIAL_VOLTAGE));
  	case CS_TYPE::CMD_INC_VOLTAGE_RANGE:
  		return 0;
  	case CS_TYPE::CMD_DEC_VOLTAGE_RANGE:
  		return 0;
  	case CS_TYPE::CMD_INC_CURRENT_RANGE:
  		return 0;
  	case CS_TYPE::CMD_DEC_CURRENT_RANGE:
  		return 0;
  	case CS_TYPE::CMD_CONTROL_CMD:
  		return sizeof(TYPIFY(CMD_CONTROL_CMD));
  	case CS_TYPE::CMD_SEND_MESH_MSG:
  		return sizeof(TYPIFY(CMD_SEND_MESH_MSG));
  	case CS_TYPE::CMD_SEND_MESH_MSG_MULTI_SWITCH:
  		return sizeof(TYPIFY(CMD_SEND_MESH_MSG_MULTI_SWITCH));
  	case CS_TYPE::CMD_SEND_MESH_MSG_PROFILE_LOCATION:
  		return sizeof(TYPIFY(CMD_SEND_MESH_MSG_PROFILE_LOCATION));
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_BEHAVIOUR_SETTINGS:
  		return sizeof(TYPIFY(CMD_SEND_MESH_MSG_SET_BEHAVIOUR_SETTINGS));
  	case CS_TYPE::CMD_SET_TIME:
  		return sizeof(TYPIFY(CMD_SET_TIME));
  	case CS_TYPE::CMD_FACTORY_RESET:
  		return 0;
  	case CS_TYPE::CMD_ADD_BEHAVIOUR:
  		return sizeof(TYPIFY(CMD_ADD_BEHAVIOUR));
  	case CS_TYPE::CMD_REPLACE_BEHAVIOUR:
  		return sizeof(TYPIFY(CMD_REPLACE_BEHAVIOUR));
  	case CS_TYPE::CMD_REMOVE_BEHAVIOUR:
  		return sizeof(TYPIFY(CMD_REMOVE_BEHAVIOUR));
  	case CS_TYPE::CMD_GET_BEHAVIOUR:
  		return sizeof(TYPIFY(CMD_GET_BEHAVIOUR));
  	case CS_TYPE::CMD_GET_BEHAVIOUR_INDICES:
  		return 0;
  	case CS_TYPE::CMD_GET_BEHAVIOUR_DEBUG:
  		return 0;
  	case CS_TYPE::CMD_CLEAR_ALL_BEHAVIOUR:
  		return 0;
  	case CS_TYPE::EVT_BEHAVIOURSTORE_MUTATION:
  		return 0;
  	case CS_TYPE::EVT_BEHAVIOUR_OVERRIDDEN:
  		return sizeof(TYPIFY(EVT_BEHAVIOUR_OVERRIDDEN));
  	case CS_TYPE::CMD_REGISTER_TRACKED_DEVICE:
  		return sizeof(TYPIFY(CMD_REGISTER_TRACKED_DEVICE));
  	case CS_TYPE::CMD_UPDATE_TRACKED_DEVICE:
  		return sizeof(TYPIFY(CMD_UPDATE_TRACKED_DEVICE));
  	case CS_TYPE::CMD_TRACKED_DEVICE_HEARTBEAT:
  		return sizeof(TYPIFY(CMD_TRACKED_DEVICE_HEARTBEAT));
  	case CS_TYPE::EVT_PRESENCE_MUTATION:
  		return sizeof(TYPIFY(EVT_PRESENCE_MUTATION));
  	case CS_TYPE::EVT_PRESENCE_CHANGE:
  		return sizeof(TYPIFY(EVT_PRESENCE_CHANGE));
  	case CS_TYPE::CMD_GET_PRESENCE:
  		return 0;
  	case CS_TYPE::CMD_SET_RELAY:
  		return sizeof(TYPIFY(CMD_SET_RELAY));
  	case CS_TYPE::CMD_SET_DIMMER:
  		return sizeof(TYPIFY(CMD_SET_DIMMER));
  	case CS_TYPE::EVT_GOING_TO_DFU:
  		return 0;
  	case CS_TYPE::EVT_RECEIVED_PROFILE_LOCATION:
  		return sizeof(TYPIFY(EVT_RECEIVED_PROFILE_LOCATION));
  	case CS_TYPE::EVT_TRACKABLE:
  		return sizeof(TYPIFY(EVT_TRACKABLE));
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_OUTGOING:
  		return sizeof(TYPIFY(EVT_MESH_SYNC_REQUEST_OUTGOING));
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_INCOMING:
  		return sizeof(TYPIFY(EVT_MESH_SYNC_REQUEST_INCOMING));
  	case CS_TYPE::EVT_MESH_SYNC_FAILED:
  		return 0;
  	case CS_TYPE::EVT_MESH_PAGES_ERASED:
  		return 0;
  	case CS_TYPE::EVT_MESH_EXT_STATE_0:
  		return sizeof(TYPIFY(EVT_MESH_EXT_STATE_0));
  	case CS_TYPE::EVT_MESH_EXT_STATE_1:
  		return sizeof(TYPIFY(EVT_MESH_EXT_STATE_1));
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_TIME:
  		return sizeof(TYPIFY(CMD_SEND_MESH_MSG_SET_TIME));
  	case CS_TYPE::CMD_SET_IBEACON_CONFIG_ID:
  		return sizeof(TYPIFY(CMD_SET_IBEACON_CONFIG_ID));
  	case CS_TYPE::CMD_SEND_MESH_MSG_NOOP:
  		return 0;
  	case CS_TYPE::EVT_MESH_RSSI_PING:
  		return sizeof(TYPIFY(EVT_MESH_RSSI_PING));
  	case CS_TYPE::EVT_MESH_RSSI_DATA:
  			return sizeof(TYPIFY(EVT_MESH_RSSI_DATA));
  	case CS_TYPE::EVT_MESH_NEAREST_WITNESS_REPORT:
  		return sizeof(TYPIFY(EVT_MESH_NEAREST_WITNESS_REPORT));
  	case CS_TYPE::EVT_MESH_TIME_SYNC:
  		return sizeof(TYPIFY(EVT_MESH_TIME_SYNC));
  	case CS_TYPE::EVT_RECV_MESH_MSG:
  		return sizeof(TYPIFY(EVT_RECV_MESH_MSG));
  	case CS_TYPE::CMD_GET_ADC_RESTARTS:
  		return 0;
  	case CS_TYPE::CMD_GET_SWITCH_HISTORY:
  		return 0;
  	case CS_TYPE::CMD_GET_POWER_SAMPLES:
  		return sizeof(TYPIFY(CMD_GET_POWER_SAMPLES));
  	case CS_TYPE::CMD_GET_SCHEDULER_MIN_FREE:
  		return 0;
  	case CS_TYPE::CMD_GET_RESET_REASON:
  		return 0;
  	case CS_TYPE::CMD_GET_GPREGRET:
  		return sizeof(TYPIFY(CMD_GET_GPREGRET));
  	case CS_TYPE::CMD_GET_ADC_CHANNEL_SWAPS:
  		return 0;
  	case CS_TYPE::CMD_GET_RAM_STATS:
  		return 0;
  	case CS_TYPE::EVT_GENERIC_TEST:
  		return 0;
  	case CS_TYPE::CMD_TEST_SET_TIME:
  		return sizeof(TYPIFY(CMD_TEST_SET_TIME));
  	case CS_TYPE::CMD_MICROAPP:
  		return sizeof(TYPIFY(CMD_MICROAPP));
  	case CS_TYPE::EVT_MICROAPP:
  		return sizeof(TYPIFY(EVT_MICROAPP));
  	case CS_TYPE::CMD_MICROAPP_ADVERTISE:
  		return sizeof(TYPIFY(CMD_MICROAPP_ADVERTISE));
  	case CS_TYPE::EVT_HUB_DATA_REPLY:
  		return sizeof(TYPIFY(EVT_HUB_DATA_REPLY));
  	} // end switch
  
  	// should never happen
  	return 0;
  }
  
  const char* typeName(CS_TYPE const & type) {
  
  	switch (type) {
  	case CS_TYPE::CONFIG_ADV_INTERVAL: return "CONFIG_ADV_INTERVAL";
  	case CS_TYPE::CONFIG_BOOT_DELAY: return "CONFIG_BOOT_DELAY";
  	case CS_TYPE::CONFIG_SPHERE_ID: return "CONFIG_SPHERE_ID";
  	case CS_TYPE::CONFIG_CROWNSTONE_ID: return "CONFIG_CROWNSTONE_ID";
  	case CS_TYPE::CONFIG_CURRENT_MULTIPLIER: return "CONFIG_CURRENT_MULTIPLIER";
  	case CS_TYPE::CONFIG_CURRENT_ADC_ZERO: return "CONFIG_CURRENT_ADC_ZERO";
  	case CS_TYPE::CONFIG_CURRENT_LIMIT: return "CONFIG_CURRENT_LIMIT";
  	case CS_TYPE::CONFIG_DO_NOT_USE: return "CONFIG_DO_NOT_USE";
  	case CS_TYPE::CONFIG_ENCRYPTION_ENABLED: return "CONFIG_ENCRYPTION_ENABLED";
  	case CS_TYPE::CONFIG_IBEACON_ENABLED: return "CONFIG_IBEACON_ENABLED";
  	case CS_TYPE::CONFIG_IBEACON_MAJOR: return "CONFIG_IBEACON_MAJOR";
  	case CS_TYPE::CONFIG_IBEACON_MINOR: return "CONFIG_IBEACON_MINOR";
  	case CS_TYPE::CONFIG_IBEACON_TXPOWER: return "CONFIG_IBEACON_TXPOWER";
  	case CS_TYPE::CONFIG_IBEACON_UUID: return "CONFIG_IBEACON_UUID";
  	case CS_TYPE::CONFIG_KEY_ADMIN: return "CONFIG_KEY_ADMIN";
  	case CS_TYPE::CONFIG_KEY_MEMBER: return "CONFIG_KEY_MEMBER";
  	case CS_TYPE::CONFIG_KEY_BASIC: return "CONFIG_KEY_BASIC";
  	case CS_TYPE::CONFIG_KEY_SERVICE_DATA: return "CONFIG_KEY_SERVICE_DATA";
  	case CS_TYPE::CONFIG_MESH_DEVICE_KEY: return "CONFIG_MESH_DEVICE_KEY";
  	case CS_TYPE::CONFIG_MESH_APP_KEY: return "CONFIG_MESH_APP_KEY";
  	case CS_TYPE::CONFIG_MESH_NET_KEY: return "CONFIG_MESH_NET_KEY";
  	case CS_TYPE::CONFIG_KEY_LOCALIZATION: return "CONFIG_KEY_LOCALIZATION";
  	case CS_TYPE::CONFIG_LOW_TX_POWER: return "CONFIG_LOW_TX_POWER";
  	case CS_TYPE::CONFIG_MAX_CHIP_TEMP: return "CONFIG_MAX_CHIP_TEMP";
  	case CS_TYPE::CONFIG_MESH_ENABLED: return "CONFIG_MESH_ENABLED";
  	case CS_TYPE::CONFIG_NAME: return "CONFIG_NAME";
  	case CS_TYPE::CONFIG_POWER_ZERO: return "CONFIG_POWER_ZERO";
  	case CS_TYPE::CONFIG_PWM_ALLOWED: return "CONFIG_PWM_ALLOWED";
  	case CS_TYPE::CONFIG_PWM_PERIOD: return "CONFIG_PWM_PERIOD";
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_DOWN: return "CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_DOWN";
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_UP: return "CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_UP";
  	case CS_TYPE::CONFIG_RELAY_HIGH_DURATION: return "CONFIG_RELAY_HIGH_DURATION";
  	case CS_TYPE::CONFIG_SCANNER_ENABLED: return "CONFIG_SCANNER_ENABLED";
  	case CS_TYPE::CONFIG_SCAN_BREAK_DURATION: return "CONFIG_SCAN_BREAK_DURATION";
  	case CS_TYPE::CONFIG_SCAN_DURATION: return "CONFIG_SCAN_DURATION";
  	case CS_TYPE::CONFIG_SCAN_INTERVAL: return "CONFIG_SCAN_INTERVAL";
  	case CS_TYPE::CONFIG_SCAN_WINDOW: return "CONFIG_SCAN_WINDOW";
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD: return "CONFIG_SOFT_FUSE_CURRENT_THRESHOLD";
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD_DIMMER: return "CONFIG_SOFT_FUSE_CURRENT_THRESHOLD_DIMMER";
  	case CS_TYPE::CONFIG_SWITCHCRAFT_ENABLED: return "CONFIG_SWITCHCRAFT_ENABLED";
  	case CS_TYPE::CONFIG_SWITCHCRAFT_THRESHOLD: return "CONFIG_SWITCHCRAFT_THRESHOLD";
  	case CS_TYPE::CONFIG_START_DIMMER_ON_ZERO_CROSSING: return "CONFIG_START_DIMMER_ON_ZERO_CROSSING";
  	case CS_TYPE::CONFIG_SWITCH_LOCKED: return "CONFIG_SWITCH_LOCKED";
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_ENABLED: return "CONFIG_TAP_TO_TOGGLE_ENABLED";
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_RSSI_THRESHOLD_OFFSET: return "CONFIG_TAP_TO_TOGGLE_RSSI_THRESHOLD_OFFSET";
  	case CS_TYPE::CONFIG_TX_POWER: return "CONFIG_TX_POWER";
  	case CS_TYPE::CONFIG_UART_ENABLED: return "CONFIG_UART_ENABLED";
  	case CS_TYPE::CONFIG_VOLTAGE_MULTIPLIER: return "CONFIG_VOLTAGE_MULTIPLIER";
  	case CS_TYPE::CONFIG_VOLTAGE_ADC_ZERO: return "CONFIG_VOLTAGE_ADC_ZERO";
  	case CS_TYPE::EVT_ADC_RESTARTED: return "EVT_ADC_RESTARTED";
  	case CS_TYPE::EVT_ADV_BACKGROUND: return "EVT_ADV_BACKGROUND";
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED: return "EVT_ADV_BACKGROUND_PARSED";
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED_V1: return "EVT_ADV_BACKGROUND_PARSED_V1";
  	case CS_TYPE::EVT_ADVERTISEMENT_UPDATED: return "EVT_ADVERTISEMENT_UPDATED";
  	case CS_TYPE::EVT_BLE_CONNECT: return "EVT_BLE_CONNECT";
  	case CS_TYPE::EVT_BLE_DISCONNECT: return "EVT_BLE_DISCONNECT";
  	case CS_TYPE::EVT_OUTGOING_CONNECT_START: return "EVT_OUTGOING_CONNECT_START";
  	case CS_TYPE::EVT_OUTGOING_CONNECTED: return "EVT_OUTGOING_CONNECTED";
  	case CS_TYPE::EVT_OUTGOING_DISCONNECTED: return "EVT_OUTGOING_DISCONNECTED";
  	case CS_TYPE::EVT_BROWNOUT_IMPENDING: return "EVT_BROWNOUT_IMPENDING";
  	case CS_TYPE::EVT_CHIP_TEMP_ABOVE_THRESHOLD: return "EVT_CHIP_TEMP_ABOVE_THRESHOLD";
  	case CS_TYPE::EVT_CHIP_TEMP_OK: return "EVT_CHIP_TEMP_OK";
  	case CS_TYPE::CMD_RESET_DELAYED: return "EVT_CMD_RESET";
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD: return "EVT_CURRENT_USAGE_ABOVE_THRESHOLD";
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD_DIMMER: return "EVT_CURRENT_USAGE_ABOVE_THRESHOLD_PWM";
  	case CS_TYPE::CMD_DEC_CURRENT_RANGE: return "EVT_DEC_CURRENT_RANGE";
  	case CS_TYPE::CMD_DEC_VOLTAGE_RANGE: return "EVT_DEC_VOLTAGE_RANGE";
  	case CS_TYPE::EVT_DEVICE_SCANNED: return "EVT_DEVICE_SCANNED";
  	case CS_TYPE::EVT_DIMMER_OFF_FAILURE_DETECTED: return "EVT_DIMMER_OFF_FAILURE_DETECTED";
  	case CS_TYPE::EVT_DIMMER_ON_FAILURE_DETECTED: return "EVT_DIMMER_ON_FAILURE_DETECTED";
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_CURRENT: return "EVT_ENABLE_ADC_DIFFERENTIAL_CURRENT";
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_VOLTAGE: return "EVT_ENABLE_ADC_DIFFERENTIAL_VOLTAGE";
  	case CS_TYPE::CMD_ENABLE_ADVERTISEMENT: return "EVT_ENABLE_ADVERTISEMENT";
  	case CS_TYPE::CMD_ENABLE_LOG_CURRENT: return "EVT_ENABLE_LOG_CURRENT";
  	case CS_TYPE::CMD_ENABLE_LOG_FILTERED_CURRENT: return "EVT_ENABLE_LOG_FILTERED_CURRENT";
  	case CS_TYPE::CMD_ENABLE_LOG_POWER: return "EVT_ENABLE_LOG_POWER";
  	case CS_TYPE::CMD_ENABLE_LOG_VOLTAGE: return "EVT_ENABLE_LOG_VOLTAGE";
  	case CS_TYPE::CMD_ENABLE_MESH: return "EVT_ENABLE_MESH";
  	case CS_TYPE::CMD_INC_CURRENT_RANGE: return "EVT_INC_CURRENT_RANGE";
  	case CS_TYPE::CMD_INC_VOLTAGE_RANGE: return "EVT_INC_VOLTAGE_RANGE";
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_REGISTER: return "EVT_MESH_TRACKED_DEVICE_REGISTER";
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_REGISTER: return "CMD_SEND_MESH_MSG_TRACKED_DEVICE_REGISTER";
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_TOKEN: return "EVT_MESH_TRACKED_DEVICE_TOKEN";
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_TOKEN: return "CMD_SEND_MESH_MSG_TRACKED_DEVICE_TOKEN";
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_HEARTBEAT: return "EVT_MESH_TRACKED_DEVICE_HEARTBEAT";
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_HEARTBEAT: return "CMD_SEND_MESH_MSG_TRACKED_DEVICE_HEARTBEAT";
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_LIST_SIZE: return "EVT_MESH_TRACKED_DEVICE_LIST_SIZE";
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_LIST_SIZE: return "CMD_SEND_MESH_MSG_TRACKED_DEVICE_LIST_SIZE";
  	case CS_TYPE::CMD_SEND_MESH_CONTROL_COMMAND: return "CMD_SEND_MESH_CONTROL_COMMAND";
  	case CS_TYPE::CMD_SWITCH_OFF: return "EVT_POWER_OFF";
  	case CS_TYPE::CMD_SWITCH_ON: return "EVT_POWER_ON";
  	case CS_TYPE::CMD_SWITCH_TOGGLE: return "EVT_POWER_TOGGLE";
  	case CS_TYPE::CMD_SWITCH: return "CMD_SWITCH";
  	case CS_TYPE::CMD_MULTI_SWITCH: return "CMD_MULTI_SWITCH";
  	case CS_TYPE::CMD_DIMMING_ALLOWED: return "CMD_DIMMING_ALLOWED";
  	case CS_TYPE::EVT_DIMMER_FORCED_OFF: return "EVT_DIMMER_FORCED_OFF";
  	case CS_TYPE::EVT_DIMMER_POWERED: return "EVT_DIMMER_POWERED";
  	case CS_TYPE::EVT_DIMMER_TEMP_ABOVE_THRESHOLD: return "EVT_PWM_TEMP_ABOVE_THRESHOLD";
  	case CS_TYPE::EVT_DIMMER_TEMP_OK: return "EVT_PWM_TEMP_OK";
  	case CS_TYPE::EVT_RELAY_FORCED_ON: return "EVT_RELAY_FORCED_ON";
  	case CS_TYPE::CMD_CONTROL_CMD: return "CMD_CONTROL_CMD";
  	case CS_TYPE::EVT_SCAN_STARTED: return "EVT_SCAN_STARTED";
  	case CS_TYPE::EVT_SCAN_STOPPED: return "EVT_SCAN_STOPPED";
  	case CS_TYPE::EVT_SESSION_DATA_SET: return "EVT_SESSION_DATA_SET";
  	case CS_TYPE::EVT_SETUP_DONE: return "EVT_SETUP_DONE";
  	case CS_TYPE::EVT_STATE_EXTERNAL_STONE: return "EVT_STATE_EXTERNAL_STONE";
  	case CS_TYPE::EVT_STATE_FACTORY_RESET_DONE: return "EVT_STATE_FACTORY_RESET_DONE";
  	case CS_TYPE::EVT_STORAGE_INITIALIZED: return "EVT_STORAGE_INITIALIZED";
  	case CS_TYPE::EVT_STORAGE_WRITE_DONE: return "EVT_STORAGE_WRITE_DONE";
  	case CS_TYPE::EVT_STORAGE_REMOVE_DONE: return "EVT_STORAGE_REMOVE_DONE";
  	case CS_TYPE::EVT_STORAGE_REMOVE_ALL_TYPES_WITH_ID_DONE: return "EVT_STORAGE_REMOVE_ALL_TYPES_WITH_ID";
  	case CS_TYPE::EVT_STORAGE_GC_DONE: return "EVT_STORAGE_GC_DONE";
  	case CS_TYPE::EVT_STORAGE_FACTORY_RESET_DONE: return "EVT_STORAGE_FACTORY_RESET";
  	case CS_TYPE::EVT_STORAGE_PAGES_ERASED: return "EVT_STORAGE_PAGES_ERASED";
  	case CS_TYPE::EVT_MESH_FACTORY_RESET_DONE: return "EVT_MESH_FACTORY_RESET";
  	case CS_TYPE::CMD_STORAGE_GARBAGE_COLLECT: return "CMD_STORAGE_GARBAGE_COLLECT";
  	case CS_TYPE::EVT_SWITCH_FORCED_OFF: return "EVT_SWITCH_FORCED_OFF";
  	case CS_TYPE::CMD_SWITCHING_ALLOWED: return "CMD_SWITCHING_ALLOWED";
  	case CS_TYPE::EVT_TICK: return "EVT_TICK";
  	case CS_TYPE::EVT_TIME_SET: return "EVT_TIME_SET";
  	case CS_TYPE::CMD_TOGGLE_ADC_VOLTAGE_VDD_REFERENCE_PIN: return "EVT_TOGGLE_ADC_VOLTAGE_VDD_REFERENCE_PIN";
  	case CS_TYPE::STATE_BEHAVIOUR_RULE: return "STATE_BEHAVIOUR_RULE";
  	case CS_TYPE::STATE_TWILIGHT_RULE: return "STATE_TWILIGHT_RULE";
  	case CS_TYPE::STATE_EXTENDED_BEHAVIOUR_RULE: return "STATE_EXTENDED_BEHAVIOUR_RULE";
  	case CS_TYPE::STATE_ACCUMULATED_ENERGY: return "STATE_ACCUMULATED_ENERGY";
  	case CS_TYPE::STATE_ERRORS: return "STATE_ERRORS";
  	case CS_TYPE::STATE_FACTORY_RESET: return "STATE_FACTORY_RESET";
  	case CS_TYPE::STATE_OPERATION_MODE: return "STATE_OPERATION_MODE";
  	case CS_TYPE::STATE_POWER_USAGE: return "STATE_POWER_USAGE";
  	case CS_TYPE::STATE_RESET_COUNTER: return "STATE_RESET_COUNTER";
  	case CS_TYPE::STATE_SWITCH_STATE: return "STATE_SWITCH_STATE";
  	case CS_TYPE::STATE_TEMPERATURE: return "STATE_TEMPERATURE";
  	case CS_TYPE::STATE_SUN_TIME: return "STATE_SUN_TIME";
  	case CS_TYPE::STATE_BEHAVIOUR_SETTINGS: return "STATE_BEHAVIOUR_SETTINGS";
  	case CS_TYPE::STATE_BEHAVIOUR_MASTER_HASH: return "STATE_BEHAVIOUR_MASTER_HASH";
  	case CS_TYPE::STATE_MESH_IV_INDEX: return "STATE_MESH_IV_INDEX";
  	case CS_TYPE::STATE_MESH_SEQ_NUMBER: return "STATE_MESH_SEQ_NUMBER";
  	case CS_TYPE::STATE_IBEACON_CONFIG_ID: return "STATE_IBEACON_CONFIG_ID";
  	case CS_TYPE::STATE_MICROAPP: return "STATE_MICROAPP";
  	case CS_TYPE::STATE_SOFT_ON_SPEED: return "STATE_SOFT_ON_SPEED";
  	case CS_TYPE::STATE_HUB_MODE: return "STATE_HUB_MODE";
  	case CS_TYPE::STATE_UART_KEY: return "STATE_UART_KEY";
  	case CS_TYPE::CMD_SEND_MESH_MSG: return "CMD_SEND_MESH_MSG";
  	case CS_TYPE::CMD_SEND_MESH_MSG_MULTI_SWITCH: return "CMD_SEND_MESH_MSG_MULTI_SWITCH";
  	case CS_TYPE::CMD_SEND_MESH_MSG_PROFILE_LOCATION: return "CMD_SEND_MESH_MSG_PROFILE_LOCATION";
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_BEHAVIOUR_SETTINGS: return "CMD_SEND_MESH_MSG_SET_BEHAVIOUR_SETTINGS";
  	case CS_TYPE::CMD_SET_TIME: return "CMD_SET_TIME";
  	case CS_TYPE::CMD_FACTORY_RESET: return "CMD_FACTORY_RESET";
  	case CS_TYPE::CMD_ADD_BEHAVIOUR: return "CMD_ADD_BEHAVIOUR";
  	case CS_TYPE::CMD_REPLACE_BEHAVIOUR: return "CMD_REPLACE_BEHAVIOUR";
  	case CS_TYPE::CMD_REMOVE_BEHAVIOUR: return "CMD_REMOVE_BEHAVIOUR";
  	case CS_TYPE::CMD_GET_BEHAVIOUR: return "CMD_GET_BEHAVIOUR";
  	case CS_TYPE::CMD_GET_BEHAVIOUR_INDICES: return "CMD_GET_BEHAVIOUR_INDICES";
  	case CS_TYPE::CMD_GET_BEHAVIOUR_DEBUG: return "CMD_GET_BEHAVIOUR_DEBUG";
  	case CS_TYPE::CMD_CLEAR_ALL_BEHAVIOUR: return "CMD_CLEAR_ALL_BEHAVIOUR";
  	case CS_TYPE::EVT_BEHAVIOURSTORE_MUTATION: return "EVT_BEHAVIOURSTORE_MUTATION";
  	case CS_TYPE::EVT_BEHAVIOUR_OVERRIDDEN: return "EVT_BEHAVIOUR_OVERRIDDEN";
  	case CS_TYPE::CMD_REGISTER_TRACKED_DEVICE: return "CMD_REGISTER_TRACKED_DEVICE";
  	case CS_TYPE::CMD_UPDATE_TRACKED_DEVICE: return "CMD_UPDATE_TRACKED_DEVICE";
  	case CS_TYPE::CMD_TRACKED_DEVICE_HEARTBEAT: return "CMD_TRACKED_DEVICE_HEARTBEAT";
  	case CS_TYPE::EVT_PRESENCE_MUTATION: return "EVT_PRESENCE_MUTATION";
  	case CS_TYPE::EVT_PRESENCE_CHANGE: return "EVT_PRESENCE_CHANGE";
  	case CS_TYPE::CMD_GET_PRESENCE: return "CMD_GET_PRESENCE";
  	case CS_TYPE::CMD_SET_RELAY: return "CMD_SET_RELAY";
  	case CS_TYPE::CMD_SET_DIMMER: return "CMD_SET_DIMMER";
  	case CS_TYPE::EVT_GOING_TO_DFU: return "EVT_GOING_TO_DFU";
  	case CS_TYPE::EVT_RECEIVED_PROFILE_LOCATION: return "EVT_PROFILE_LOCATION";
  	case CS_TYPE::EVT_TRACKABLE: return "EVT_TRACKABLE";
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_OUTGOING: return "EVT_MESH_SYNC_REQUEST_OUTGOING";
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_INCOMING: return "EVT_MESH_SYNC_REQUEST_INCOMING";
  	case CS_TYPE::EVT_MESH_SYNC_FAILED: return "EVT_MESH_SYNC_FAILED";
  	case CS_TYPE::EVT_MESH_PAGES_ERASED: return "EVT_MESH_PAGES_ERASED";
  	case CS_TYPE::EVT_MESH_EXT_STATE_0: return "EVT_MESH_EXT_STATE_0";
  	case CS_TYPE::EVT_MESH_EXT_STATE_1: return "EVT_MESH_EXT_STATE_1";
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_TIME: return "CMD_SEND_MESH_MSG_SET_TIME";
  	case CS_TYPE::CMD_SET_IBEACON_CONFIG_ID: return "CMD_SET_IBEACON_CONFIG_ID";
  	case CS_TYPE::CMD_SEND_MESH_MSG_NOOP: return "CMD_SEND_MESH_MSG_NOOP";
  	case CS_TYPE::EVT_MESH_RSSI_PING: return "EVT_MESH_RSSI_PING";
  	case CS_TYPE::EVT_MESH_RSSI_DATA: return "EVT_MESH_RSSI_DATA";
  	case CS_TYPE::EVT_MESH_NEAREST_WITNESS_REPORT: return "EVT_MESH_NEAREST_WITNESS_REPORT";
  	case CS_TYPE::EVT_MESH_TIME_SYNC: return "EVT_MESH_TIME_SYNC";
  	case CS_TYPE::EVT_RECV_MESH_MSG: return "EVT_RECV_MESH_MSG";
  	case CS_TYPE::CMD_GET_ADC_RESTARTS: return "CMD_GET_ADC_RESTARTS";
  	case CS_TYPE::CMD_GET_SWITCH_HISTORY: return "CMD_GET_SWITCH_HISTORY";
  	case CS_TYPE::CMD_GET_POWER_SAMPLES: return "CMD_GET_POWER_SAMPLES";
  	case CS_TYPE::CMD_GET_SCHEDULER_MIN_FREE: return "CMD_GET_SCHEDULER_MIN_FREE";
  	case CS_TYPE::CMD_GET_RESET_REASON: return "CMD_GET_RESET_REASON";
  	case CS_TYPE::CMD_GET_GPREGRET: return "CMD_GET_GPREGRET";
  	case CS_TYPE::CMD_GET_ADC_CHANNEL_SWAPS: return "CMD_GET_ADC_CHANNEL_SWAPS";
  	case CS_TYPE::CMD_GET_RAM_STATS: return "CMD_GET_RAM_STATS";
  	case CS_TYPE::EVT_GENERIC_TEST: return "EVT_GENERIC_TEST";
  	case CS_TYPE::CMD_TEST_SET_TIME: return "CMD_TEST_SET_TIME";
  	case CS_TYPE::CMD_MICROAPP: return "CMD_MICROAPP";
  	case CS_TYPE::EVT_MICROAPP: return "EVT_MICROAPP";
  	case CS_TYPE::CMD_MICROAPP_ADVERTISE: return "CMD_MICROAPP_ADVERTISE";
  	case CS_TYPE::EVT_HUB_DATA_REPLY: return "EVT_HUB_DATA_REPLY";
  	}
  	return "Unknown";
  }
  
  
  
  bool hasMultipleIds(CS_TYPE const & type) {
  	switch (type) {
  	case CS_TYPE::CONFIG_NAME:
  	case CS_TYPE::CONFIG_PWM_PERIOD:
  	case CS_TYPE::CONFIG_TX_POWER:
  	case CS_TYPE::CONFIG_ADV_INTERVAL:
  	case CS_TYPE::CONFIG_SCAN_DURATION:
  	case CS_TYPE::CONFIG_SCAN_BREAK_DURATION:
  	case CS_TYPE::CONFIG_BOOT_DELAY:
  	case CS_TYPE::CONFIG_MAX_CHIP_TEMP:
  	case CS_TYPE::CONFIG_CURRENT_LIMIT:
  	case CS_TYPE::CONFIG_MESH_ENABLED:
  	case CS_TYPE::CONFIG_ENCRYPTION_ENABLED:
  	case CS_TYPE::CONFIG_IBEACON_ENABLED:
  	case CS_TYPE::CONFIG_SCANNER_ENABLED:
  	case CS_TYPE::CONFIG_SPHERE_ID:
  	case CS_TYPE::CONFIG_CROWNSTONE_ID:
  	case CS_TYPE::CONFIG_KEY_ADMIN:
  	case CS_TYPE::CONFIG_KEY_MEMBER:
  	case CS_TYPE::CONFIG_KEY_BASIC:
  	case CS_TYPE::CONFIG_KEY_SERVICE_DATA:
  	case CS_TYPE::CONFIG_MESH_DEVICE_KEY:
  	case CS_TYPE::CONFIG_MESH_APP_KEY:
  	case CS_TYPE::CONFIG_MESH_NET_KEY:
  	case CS_TYPE::CONFIG_KEY_LOCALIZATION:
  	case CS_TYPE::CONFIG_SCAN_INTERVAL:
  	case CS_TYPE::CONFIG_SCAN_WINDOW:
  	case CS_TYPE::CONFIG_RELAY_HIGH_DURATION:
  	case CS_TYPE::CONFIG_LOW_TX_POWER:
  	case CS_TYPE::CONFIG_VOLTAGE_MULTIPLIER:
  	case CS_TYPE::CONFIG_CURRENT_MULTIPLIER:
  	case CS_TYPE::CONFIG_VOLTAGE_ADC_ZERO:
  	case CS_TYPE::CONFIG_CURRENT_ADC_ZERO:
  	case CS_TYPE::CONFIG_POWER_ZERO:
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD:
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD_DIMMER:
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_UP:
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_DOWN:
  	case CS_TYPE::CONFIG_PWM_ALLOWED:
  	case CS_TYPE::CONFIG_START_DIMMER_ON_ZERO_CROSSING:
  	case CS_TYPE::CONFIG_SWITCH_LOCKED:
  	case CS_TYPE::CONFIG_SWITCHCRAFT_ENABLED:
  	case CS_TYPE::CONFIG_SWITCHCRAFT_THRESHOLD:
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_ENABLED:
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_RSSI_THRESHOLD_OFFSET:
  	case CS_TYPE::CONFIG_UART_ENABLED:
  	case CS_TYPE::STATE_OPERATION_MODE:
  	case CS_TYPE::STATE_SWITCH_STATE:
  	case CS_TYPE::STATE_RESET_COUNTER:
  	case CS_TYPE::CONFIG_DO_NOT_USE:
  	case CS_TYPE::STATE_ACCUMULATED_ENERGY:
  	case CS_TYPE::STATE_BEHAVIOUR_SETTINGS:
  	case CS_TYPE::STATE_BEHAVIOUR_MASTER_HASH:
  	case CS_TYPE::STATE_POWER_USAGE:
  	case CS_TYPE::STATE_TEMPERATURE:
  	case CS_TYPE::STATE_SUN_TIME:
  	case CS_TYPE::STATE_FACTORY_RESET:
  	case CS_TYPE::STATE_MESH_IV_INDEX:
  	case CS_TYPE::STATE_MESH_SEQ_NUMBER:
  	case CS_TYPE::STATE_ERRORS:
  	case CS_TYPE::STATE_MICROAPP:
  	case CS_TYPE::STATE_SOFT_ON_SPEED:
  	case CS_TYPE::STATE_HUB_MODE:
  	case CS_TYPE::CMD_SWITCH_OFF:
  	case CS_TYPE::CMD_SWITCH_ON:
  	case CS_TYPE::CMD_SWITCH_TOGGLE:
  	case CS_TYPE::CMD_SWITCH:
  	case CS_TYPE::CMD_MULTI_SWITCH:
  	case CS_TYPE::EVT_ADV_BACKGROUND:
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED:
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED_V1:
  	case CS_TYPE::EVT_ADVERTISEMENT_UPDATED:
  	case CS_TYPE::EVT_SCAN_STARTED:
  	case CS_TYPE::EVT_SCAN_STOPPED:
  	case CS_TYPE::EVT_DEVICE_SCANNED:
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD_DIMMER:
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_DIMMER_ON_FAILURE_DETECTED:
  	case CS_TYPE::EVT_DIMMER_OFF_FAILURE_DETECTED:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_REGISTER:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_REGISTER:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_TOKEN:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_TOKEN:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_LIST_SIZE:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_LIST_SIZE:
  	case CS_TYPE::CMD_SEND_MESH_CONTROL_COMMAND:
  	case CS_TYPE::EVT_BLE_CONNECT:
  	case CS_TYPE::EVT_BLE_DISCONNECT:
  	case CS_TYPE::EVT_OUTGOING_CONNECT_START:
  	case CS_TYPE::EVT_OUTGOING_CONNECTED:
  	case CS_TYPE::EVT_OUTGOING_DISCONNECTED:
  	case CS_TYPE::EVT_BROWNOUT_IMPENDING:
  	case CS_TYPE::EVT_SESSION_DATA_SET:
  	case CS_TYPE::EVT_DIMMER_FORCED_OFF:
  	case CS_TYPE::EVT_SWITCH_FORCED_OFF:
  	case CS_TYPE::EVT_RELAY_FORCED_ON:
  	case CS_TYPE::EVT_CHIP_TEMP_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_CHIP_TEMP_OK:
  	case CS_TYPE::EVT_DIMMER_TEMP_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_DIMMER_TEMP_OK:
  	case CS_TYPE::EVT_TICK:
  	case CS_TYPE::EVT_TIME_SET:
  	case CS_TYPE::EVT_DIMMER_POWERED:
  	case CS_TYPE::CMD_DIMMING_ALLOWED:
  	case CS_TYPE::CMD_SWITCHING_ALLOWED:
  	case CS_TYPE::EVT_STATE_EXTERNAL_STONE:
  	case CS_TYPE::EVT_STATE_FACTORY_RESET_DONE:
  	case CS_TYPE::EVT_STORAGE_INITIALIZED:
  	case CS_TYPE::EVT_STORAGE_WRITE_DONE:
  	case CS_TYPE::EVT_STORAGE_REMOVE_DONE:
  	case CS_TYPE::EVT_STORAGE_REMOVE_ALL_TYPES_WITH_ID_DONE:
  	case CS_TYPE::EVT_STORAGE_GC_DONE:
  	case CS_TYPE::EVT_STORAGE_FACTORY_RESET_DONE:
  	case CS_TYPE::EVT_STORAGE_PAGES_ERASED:
  	case CS_TYPE::EVT_MESH_FACTORY_RESET_DONE:
  	case CS_TYPE::CMD_STORAGE_GARBAGE_COLLECT:
  	case CS_TYPE::EVT_SETUP_DONE:
  	case CS_TYPE::EVT_ADC_RESTARTED:
  	case CS_TYPE::CMD_ENABLE_LOG_POWER:
  	case CS_TYPE::CMD_ENABLE_LOG_CURRENT:
  	case CS_TYPE::CMD_ENABLE_LOG_VOLTAGE:
  	case CS_TYPE::CMD_ENABLE_LOG_FILTERED_CURRENT:
  	case CS_TYPE::CMD_RESET_DELAYED:
  	case CS_TYPE::CMD_ENABLE_ADVERTISEMENT:
  	case CS_TYPE::CMD_ENABLE_MESH:
  	case CS_TYPE::CMD_TOGGLE_ADC_VOLTAGE_VDD_REFERENCE_PIN:
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_CURRENT:
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_VOLTAGE:
  	case CS_TYPE::CMD_INC_VOLTAGE_RANGE:
  	case CS_TYPE::CMD_DEC_VOLTAGE_RANGE:
  	case CS_TYPE::CMD_INC_CURRENT_RANGE:
  	case CS_TYPE::CMD_DEC_CURRENT_RANGE:
  	case CS_TYPE::CMD_CONTROL_CMD:
  	case CS_TYPE::CMD_SEND_MESH_MSG:
  	case CS_TYPE::CMD_SEND_MESH_MSG_MULTI_SWITCH:
  	case CS_TYPE::CMD_SEND_MESH_MSG_PROFILE_LOCATION:
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_BEHAVIOUR_SETTINGS:
  	case CS_TYPE::CMD_SET_TIME:
  	case CS_TYPE::CMD_FACTORY_RESET:
  	case CS_TYPE::CMD_ADD_BEHAVIOUR:
  	case CS_TYPE::CMD_REPLACE_BEHAVIOUR:
  	case CS_TYPE::CMD_REMOVE_BEHAVIOUR:
  	case CS_TYPE::CMD_GET_BEHAVIOUR:
  	case CS_TYPE::CMD_GET_BEHAVIOUR_INDICES:
  	case CS_TYPE::CMD_GET_BEHAVIOUR_DEBUG:
  	case CS_TYPE::CMD_CLEAR_ALL_BEHAVIOUR:
  	case CS_TYPE::EVT_BEHAVIOURSTORE_MUTATION:
  	case CS_TYPE::EVT_BEHAVIOUR_OVERRIDDEN:
  	case CS_TYPE::CMD_REGISTER_TRACKED_DEVICE:
  	case CS_TYPE::CMD_UPDATE_TRACKED_DEVICE:
  	case CS_TYPE::CMD_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::EVT_PRESENCE_MUTATION:
  	case CS_TYPE::EVT_PRESENCE_CHANGE:
  	case CS_TYPE::CMD_GET_PRESENCE:
  	case CS_TYPE::CMD_SET_RELAY:
  	case CS_TYPE::CMD_SET_DIMMER:
  	case CS_TYPE::EVT_GOING_TO_DFU:
  	case CS_TYPE::EVT_RECEIVED_PROFILE_LOCATION:
  	case CS_TYPE::EVT_TRACKABLE:
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_OUTGOING:
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_INCOMING:
  	case CS_TYPE::EVT_MESH_SYNC_FAILED:
  	case CS_TYPE::EVT_MESH_PAGES_ERASED:
  	case CS_TYPE::EVT_MESH_EXT_STATE_0:
  	case CS_TYPE::EVT_MESH_EXT_STATE_1:
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_TIME:
  	case CS_TYPE::CMD_SET_IBEACON_CONFIG_ID:
  	case CS_TYPE::CMD_SEND_MESH_MSG_NOOP:
  	case CS_TYPE::EVT_MESH_RSSI_PING:
  	case CS_TYPE::EVT_MESH_RSSI_DATA:
  	case CS_TYPE::EVT_MESH_NEAREST_WITNESS_REPORT:
  	case CS_TYPE::EVT_MESH_TIME_SYNC:
  	case CS_TYPE::EVT_RECV_MESH_MSG:
  	case CS_TYPE::CMD_GET_ADC_RESTARTS:
  	case CS_TYPE::CMD_GET_SWITCH_HISTORY:
  	case CS_TYPE::CMD_GET_POWER_SAMPLES:
  	case CS_TYPE::CMD_GET_SCHEDULER_MIN_FREE:
  	case CS_TYPE::CMD_GET_RESET_REASON:
  	case CS_TYPE::CMD_GET_GPREGRET:
  	case CS_TYPE::CMD_GET_ADC_CHANNEL_SWAPS:
  	case CS_TYPE::CMD_GET_RAM_STATS:
  	case CS_TYPE::EVT_GENERIC_TEST:
  	case CS_TYPE::CMD_TEST_SET_TIME:
  	case CS_TYPE::CMD_MICROAPP:
  	case CS_TYPE::EVT_MICROAPP:
  	case CS_TYPE::CMD_MICROAPP_ADVERTISE:
  	case CS_TYPE::EVT_HUB_DATA_REPLY:
  		return false;
  	case CS_TYPE::STATE_BEHAVIOUR_RULE:
  	case CS_TYPE::STATE_TWILIGHT_RULE:
  	case CS_TYPE::STATE_EXTENDED_BEHAVIOUR_RULE:
  	case CS_TYPE::CONFIG_IBEACON_MAJOR:
  	case CS_TYPE::CONFIG_IBEACON_MINOR:
  	case CS_TYPE::CONFIG_IBEACON_UUID:
  	case CS_TYPE::CONFIG_IBEACON_TXPOWER:
  	case CS_TYPE::STATE_IBEACON_CONFIG_ID:
  	case CS_TYPE::STATE_UART_KEY:
  		return true;
  	}
  	// should not reach this
  	return false;
  }
  
  bool removeOnFactoryReset(CS_TYPE const & type, cs_state_id_t id) {
  	switch (type) {
  	case CS_TYPE::STATE_RESET_COUNTER: {
  		return id != 0;
  	}
  	case CS_TYPE::CONFIG_NAME:
  	case CS_TYPE::CONFIG_PWM_PERIOD:
  	case CS_TYPE::CONFIG_IBEACON_MAJOR:
  	case CS_TYPE::CONFIG_IBEACON_MINOR:
  	case CS_TYPE::CONFIG_IBEACON_UUID:
  	case CS_TYPE::CONFIG_IBEACON_TXPOWER:
  	case CS_TYPE::CONFIG_TX_POWER:
  	case CS_TYPE::CONFIG_ADV_INTERVAL:
  	case CS_TYPE::CONFIG_SCAN_DURATION:
  	case CS_TYPE::CONFIG_SCAN_BREAK_DURATION:
  	case CS_TYPE::CONFIG_BOOT_DELAY:
  	case CS_TYPE::CONFIG_MAX_CHIP_TEMP:
  	case CS_TYPE::CONFIG_CURRENT_LIMIT:
  	case CS_TYPE::CONFIG_MESH_ENABLED:
  	case CS_TYPE::CONFIG_ENCRYPTION_ENABLED:
  	case CS_TYPE::CONFIG_IBEACON_ENABLED:
  	case CS_TYPE::CONFIG_SCANNER_ENABLED:
  	case CS_TYPE::CONFIG_SPHERE_ID:
  	case CS_TYPE::CONFIG_CROWNSTONE_ID:
  	case CS_TYPE::CONFIG_KEY_ADMIN:
  	case CS_TYPE::CONFIG_KEY_MEMBER:
  	case CS_TYPE::CONFIG_KEY_BASIC:
  	case CS_TYPE::CONFIG_KEY_SERVICE_DATA:
  	case CS_TYPE::CONFIG_MESH_DEVICE_KEY:
  	case CS_TYPE::CONFIG_MESH_APP_KEY:
  	case CS_TYPE::CONFIG_MESH_NET_KEY:
  	case CS_TYPE::CONFIG_KEY_LOCALIZATION:
  	case CS_TYPE::CONFIG_SCAN_INTERVAL:
  	case CS_TYPE::CONFIG_SCAN_WINDOW:
  	case CS_TYPE::CONFIG_RELAY_HIGH_DURATION:
  	case CS_TYPE::CONFIG_LOW_TX_POWER:
  	case CS_TYPE::CONFIG_VOLTAGE_MULTIPLIER:
  	case CS_TYPE::CONFIG_CURRENT_MULTIPLIER:
  	case CS_TYPE::CONFIG_VOLTAGE_ADC_ZERO:
  	case CS_TYPE::CONFIG_CURRENT_ADC_ZERO:
  	case CS_TYPE::CONFIG_POWER_ZERO:
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD:
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD_DIMMER:
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_UP:
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_DOWN:
  	case CS_TYPE::CONFIG_PWM_ALLOWED:
  	case CS_TYPE::CONFIG_START_DIMMER_ON_ZERO_CROSSING:
  	case CS_TYPE::CONFIG_SWITCH_LOCKED:
  	case CS_TYPE::CONFIG_SWITCHCRAFT_ENABLED:
  	case CS_TYPE::CONFIG_SWITCHCRAFT_THRESHOLD:
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_ENABLED:
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_RSSI_THRESHOLD_OFFSET:
  	case CS_TYPE::CONFIG_UART_ENABLED:
  	case CS_TYPE::STATE_OPERATION_MODE:
  	case CS_TYPE::STATE_SWITCH_STATE:
  	case CS_TYPE::STATE_BEHAVIOUR_RULE:
  	case CS_TYPE::STATE_TWILIGHT_RULE:
  	case CS_TYPE::STATE_EXTENDED_BEHAVIOUR_RULE:
  	case CS_TYPE::CONFIG_DO_NOT_USE:
  	case CS_TYPE::STATE_ACCUMULATED_ENERGY:
  	case CS_TYPE::STATE_BEHAVIOUR_SETTINGS:
  	case CS_TYPE::STATE_BEHAVIOUR_MASTER_HASH:
  	case CS_TYPE::STATE_POWER_USAGE:
  	case CS_TYPE::STATE_TEMPERATURE:
  	case CS_TYPE::STATE_SUN_TIME:
  	case CS_TYPE::STATE_FACTORY_RESET:
  	case CS_TYPE::STATE_ERRORS:
  	case CS_TYPE::STATE_MESH_IV_INDEX:
  	case CS_TYPE::STATE_MESH_SEQ_NUMBER:
  	case CS_TYPE::STATE_IBEACON_CONFIG_ID:
  	case CS_TYPE::STATE_MICROAPP:
  	case CS_TYPE::STATE_SOFT_ON_SPEED:
  	case CS_TYPE::STATE_HUB_MODE:
  	case CS_TYPE::STATE_UART_KEY:
  	case CS_TYPE::CMD_SWITCH_OFF:
  	case CS_TYPE::CMD_SWITCH_ON:
  	case CS_TYPE::CMD_SWITCH_TOGGLE:
  	case CS_TYPE::CMD_SWITCH:
  	case CS_TYPE::CMD_MULTI_SWITCH:
  	case CS_TYPE::EVT_ADV_BACKGROUND:
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED:
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED_V1:
  	case CS_TYPE::EVT_ADVERTISEMENT_UPDATED:
  	case CS_TYPE::EVT_SCAN_STARTED:
  	case CS_TYPE::EVT_SCAN_STOPPED:
  	case CS_TYPE::EVT_DEVICE_SCANNED:
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD_DIMMER:
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_DIMMER_ON_FAILURE_DETECTED:
  	case CS_TYPE::EVT_DIMMER_OFF_FAILURE_DETECTED:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_REGISTER:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_REGISTER:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_TOKEN:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_TOKEN:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_LIST_SIZE:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_LIST_SIZE:
  	case CS_TYPE::CMD_SEND_MESH_CONTROL_COMMAND:
  	case CS_TYPE::EVT_BLE_CONNECT:
  	case CS_TYPE::EVT_BLE_DISCONNECT:
  	case CS_TYPE::EVT_OUTGOING_CONNECT_START:
  	case CS_TYPE::EVT_OUTGOING_CONNECTED:
  	case CS_TYPE::EVT_OUTGOING_DISCONNECTED:
  	case CS_TYPE::EVT_BROWNOUT_IMPENDING:
  	case CS_TYPE::EVT_SESSION_DATA_SET:
  	case CS_TYPE::EVT_DIMMER_FORCED_OFF:
  	case CS_TYPE::EVT_SWITCH_FORCED_OFF:
  	case CS_TYPE::EVT_RELAY_FORCED_ON:
  	case CS_TYPE::EVT_CHIP_TEMP_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_CHIP_TEMP_OK:
  	case CS_TYPE::EVT_DIMMER_TEMP_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_DIMMER_TEMP_OK:
  	case CS_TYPE::EVT_TICK:
  	case CS_TYPE::EVT_TIME_SET:
  	case CS_TYPE::EVT_DIMMER_POWERED:
  	case CS_TYPE::CMD_DIMMING_ALLOWED:
  	case CS_TYPE::CMD_SWITCHING_ALLOWED:
  	case CS_TYPE::EVT_STATE_EXTERNAL_STONE:
  	case CS_TYPE::EVT_STATE_FACTORY_RESET_DONE:
  	case CS_TYPE::EVT_STORAGE_INITIALIZED:
  	case CS_TYPE::EVT_STORAGE_WRITE_DONE:
  	case CS_TYPE::EVT_STORAGE_REMOVE_DONE:
  	case CS_TYPE::EVT_STORAGE_REMOVE_ALL_TYPES_WITH_ID_DONE:
  	case CS_TYPE::EVT_STORAGE_GC_DONE:
  	case CS_TYPE::EVT_STORAGE_FACTORY_RESET_DONE:
  	case CS_TYPE::EVT_STORAGE_PAGES_ERASED:
  	case CS_TYPE::EVT_MESH_FACTORY_RESET_DONE:
  	case CS_TYPE::CMD_STORAGE_GARBAGE_COLLECT:
  	case CS_TYPE::EVT_SETUP_DONE:
  	case CS_TYPE::EVT_ADC_RESTARTED:
  	case CS_TYPE::CMD_ENABLE_LOG_POWER:
  	case CS_TYPE::CMD_ENABLE_LOG_CURRENT:
  	case CS_TYPE::CMD_ENABLE_LOG_VOLTAGE:
  	case CS_TYPE::CMD_ENABLE_LOG_FILTERED_CURRENT:
  	case CS_TYPE::CMD_RESET_DELAYED:
  	case CS_TYPE::CMD_ENABLE_ADVERTISEMENT:
  	case CS_TYPE::CMD_ENABLE_MESH:
  	case CS_TYPE::CMD_TOGGLE_ADC_VOLTAGE_VDD_REFERENCE_PIN:
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_CURRENT:
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_VOLTAGE:
  	case CS_TYPE::CMD_INC_VOLTAGE_RANGE:
  	case CS_TYPE::CMD_DEC_VOLTAGE_RANGE:
  	case CS_TYPE::CMD_INC_CURRENT_RANGE:
  	case CS_TYPE::CMD_DEC_CURRENT_RANGE:
  	case CS_TYPE::CMD_CONTROL_CMD:
  	case CS_TYPE::CMD_SEND_MESH_MSG:
  	case CS_TYPE::CMD_SEND_MESH_MSG_MULTI_SWITCH:
  	case CS_TYPE::CMD_SEND_MESH_MSG_PROFILE_LOCATION:
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_BEHAVIOUR_SETTINGS:
  	case CS_TYPE::CMD_SET_TIME:
  	case CS_TYPE::CMD_FACTORY_RESET:
  	case CS_TYPE::CMD_ADD_BEHAVIOUR:
  	case CS_TYPE::CMD_REPLACE_BEHAVIOUR:
  	case CS_TYPE::CMD_REMOVE_BEHAVIOUR:
  	case CS_TYPE::CMD_GET_BEHAVIOUR:
  	case CS_TYPE::CMD_GET_BEHAVIOUR_INDICES:
  	case CS_TYPE::CMD_GET_BEHAVIOUR_DEBUG:
  	case CS_TYPE::CMD_CLEAR_ALL_BEHAVIOUR:
  	case CS_TYPE::EVT_BEHAVIOURSTORE_MUTATION:
  	case CS_TYPE::EVT_BEHAVIOUR_OVERRIDDEN:
  	case CS_TYPE::CMD_REGISTER_TRACKED_DEVICE:
  	case CS_TYPE::CMD_UPDATE_TRACKED_DEVICE:
  	case CS_TYPE::CMD_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::EVT_PRESENCE_MUTATION:
  	case CS_TYPE::EVT_PRESENCE_CHANGE:
  	case CS_TYPE::CMD_GET_PRESENCE:
  	case CS_TYPE::CMD_SET_RELAY:
  	case CS_TYPE::CMD_SET_DIMMER:
  	case CS_TYPE::EVT_GOING_TO_DFU:
  	case CS_TYPE::EVT_RECEIVED_PROFILE_LOCATION:
  	case CS_TYPE::EVT_TRACKABLE:
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_OUTGOING:
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_INCOMING:
  	case CS_TYPE::EVT_MESH_SYNC_FAILED:
  	case CS_TYPE::EVT_MESH_PAGES_ERASED:
  	case CS_TYPE::EVT_MESH_EXT_STATE_0:
  	case CS_TYPE::EVT_MESH_EXT_STATE_1:
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_TIME:
  	case CS_TYPE::CMD_SET_IBEACON_CONFIG_ID:
  	case CS_TYPE::CMD_SEND_MESH_MSG_NOOP:
  	case CS_TYPE::EVT_MESH_RSSI_PING:
  	case CS_TYPE::EVT_MESH_RSSI_DATA:
  	case CS_TYPE::EVT_MESH_NEAREST_WITNESS_REPORT:
  	case CS_TYPE::EVT_MESH_TIME_SYNC:
  	case CS_TYPE::EVT_RECV_MESH_MSG:
  	case CS_TYPE::CMD_GET_ADC_RESTARTS:
  	case CS_TYPE::CMD_GET_SWITCH_HISTORY:
  	case CS_TYPE::CMD_GET_POWER_SAMPLES:
  	case CS_TYPE::CMD_GET_SCHEDULER_MIN_FREE:
  	case CS_TYPE::CMD_GET_RESET_REASON:
  	case CS_TYPE::CMD_GET_GPREGRET:
  	case CS_TYPE::CMD_GET_ADC_CHANNEL_SWAPS:
  	case CS_TYPE::CMD_GET_RAM_STATS:
  	case CS_TYPE::EVT_GENERIC_TEST:
  	case CS_TYPE::CMD_TEST_SET_TIME:
  	case CS_TYPE::CMD_MICROAPP:
  	case CS_TYPE::EVT_MICROAPP:
  	case CS_TYPE::CMD_MICROAPP_ADVERTISE:
  	case CS_TYPE::EVT_HUB_DATA_REPLY:
  		return true;
  	}
  	// should not reach this
  	return true;
  }
  
  EncryptionAccessLevel getUserAccessLevelSet(CS_TYPE const & type)  {
  	switch (type) {
  	case CS_TYPE::CONFIG_ADV_INTERVAL:
  	case CS_TYPE::CONFIG_BOOT_DELAY:
  	case CS_TYPE::CONFIG_SPHERE_ID:
  	case CS_TYPE::CONFIG_CROWNSTONE_ID:
  	case CS_TYPE::CONFIG_CURRENT_ADC_ZERO:
  	case CS_TYPE::CONFIG_CURRENT_MULTIPLIER:
  	case CS_TYPE::CONFIG_IBEACON_MAJOR:
  	case CS_TYPE::CONFIG_IBEACON_MINOR:
  	case CS_TYPE::CONFIG_IBEACON_UUID:
  	case CS_TYPE::CONFIG_IBEACON_TXPOWER:
  	case CS_TYPE::CONFIG_LOW_TX_POWER:
  	case CS_TYPE::CONFIG_MAX_CHIP_TEMP:
  	case CS_TYPE::CONFIG_MESH_ENABLED:
  	case CS_TYPE::CONFIG_NAME:
  	case CS_TYPE::CONFIG_POWER_ZERO:
  	case CS_TYPE::CONFIG_PWM_ALLOWED:
  	case CS_TYPE::CONFIG_PWM_PERIOD:
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_DOWN:
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_UP:
  	case CS_TYPE::CONFIG_RELAY_HIGH_DURATION:
  	case CS_TYPE::CONFIG_SCAN_BREAK_DURATION:
  	case CS_TYPE::CONFIG_SCAN_DURATION:
  	case CS_TYPE::CONFIG_SCANNER_ENABLED:
  	case CS_TYPE::CONFIG_SCAN_INTERVAL:
  	case CS_TYPE::CONFIG_SCAN_WINDOW:
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD:
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD_DIMMER:
  	case CS_TYPE::CONFIG_START_DIMMER_ON_ZERO_CROSSING:
  	case CS_TYPE::CONFIG_SWITCH_LOCKED:
  	case CS_TYPE::CONFIG_SWITCHCRAFT_ENABLED:
  	case CS_TYPE::CONFIG_SWITCHCRAFT_THRESHOLD:
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_ENABLED:
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_RSSI_THRESHOLD_OFFSET:
  	case CS_TYPE::CONFIG_TX_POWER:
  	case CS_TYPE::CONFIG_UART_ENABLED:
  	case CS_TYPE::CONFIG_VOLTAGE_ADC_ZERO:
  	case CS_TYPE::CONFIG_VOLTAGE_MULTIPLIER:
  	case CS_TYPE::STATE_IBEACON_CONFIG_ID:
  	case CS_TYPE::STATE_SOFT_ON_SPEED:
  	case CS_TYPE::STATE_HUB_MODE:
  	case CS_TYPE::STATE_UART_KEY:
  		return ADMIN;
  	case CS_TYPE::STATE_BEHAVIOUR_SETTINGS:
  		return MEMBER;
  	case CS_TYPE::CONFIG_CURRENT_LIMIT:
  	case CS_TYPE::CONFIG_ENCRYPTION_ENABLED:
  	case CS_TYPE::CONFIG_IBEACON_ENABLED:
  	case CS_TYPE::CONFIG_KEY_ADMIN:
  	case CS_TYPE::CONFIG_KEY_MEMBER:
  	case CS_TYPE::CONFIG_KEY_BASIC:
  	case CS_TYPE::CONFIG_KEY_SERVICE_DATA:
  	case CS_TYPE::CONFIG_MESH_DEVICE_KEY:
  	case CS_TYPE::CONFIG_MESH_APP_KEY:
  	case CS_TYPE::CONFIG_MESH_NET_KEY:
  	case CS_TYPE::CONFIG_KEY_LOCALIZATION:
  	case CS_TYPE::CONFIG_DO_NOT_USE:
  	case CS_TYPE::STATE_BEHAVIOUR_RULE:
  	case CS_TYPE::STATE_TWILIGHT_RULE:
  	case CS_TYPE::STATE_EXTENDED_BEHAVIOUR_RULE:
  	case CS_TYPE::STATE_BEHAVIOUR_MASTER_HASH:
  	case CS_TYPE::STATE_ACCUMULATED_ENERGY:
  	case CS_TYPE::STATE_ERRORS:
  	case CS_TYPE::STATE_FACTORY_RESET:
  	case CS_TYPE::STATE_OPERATION_MODE:
  	case CS_TYPE::STATE_POWER_USAGE:
  	case CS_TYPE::STATE_RESET_COUNTER:
  	case CS_TYPE::STATE_SWITCH_STATE:
  	case CS_TYPE::STATE_TEMPERATURE:
  	case CS_TYPE::STATE_SUN_TIME:
  	case CS_TYPE::STATE_MESH_IV_INDEX:
  	case CS_TYPE::STATE_MESH_SEQ_NUMBER:
  	case CS_TYPE::STATE_MICROAPP:
  	case CS_TYPE::CMD_CONTROL_CMD:
  	case CS_TYPE::CMD_DEC_CURRENT_RANGE:
  	case CS_TYPE::CMD_DEC_VOLTAGE_RANGE:
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_CURRENT:
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_VOLTAGE:
  	case CS_TYPE::CMD_ENABLE_ADVERTISEMENT:
  	case CS_TYPE::CMD_ENABLE_LOG_CURRENT:
  	case CS_TYPE::CMD_ENABLE_LOG_FILTERED_CURRENT:
  	case CS_TYPE::CMD_ENABLE_LOG_POWER:
  	case CS_TYPE::CMD_ENABLE_LOG_VOLTAGE:
  	case CS_TYPE::CMD_ENABLE_MESH:
  	case CS_TYPE::CMD_FACTORY_RESET:
  	case CS_TYPE::CMD_INC_CURRENT_RANGE:
  	case CS_TYPE::CMD_INC_VOLTAGE_RANGE:
  	case CS_TYPE::CMD_RESET_DELAYED:
  	case CS_TYPE::CMD_SEND_MESH_MSG:
  	case CS_TYPE::CMD_SEND_MESH_MSG_MULTI_SWITCH:
  	case CS_TYPE::CMD_SEND_MESH_MSG_PROFILE_LOCATION:
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_BEHAVIOUR_SETTINGS:
  	case CS_TYPE::CMD_SET_TIME:
  	case CS_TYPE::CMD_SWITCH_OFF:
  	case CS_TYPE::CMD_SWITCH_ON:
  	case CS_TYPE::CMD_SWITCH_TOGGLE:
  	case CS_TYPE::CMD_SWITCH:
  	case CS_TYPE::CMD_MULTI_SWITCH:
  	case CS_TYPE::CMD_TOGGLE_ADC_VOLTAGE_VDD_REFERENCE_PIN:
  	case CS_TYPE::EVT_ADC_RESTARTED:
  	case CS_TYPE::EVT_ADV_BACKGROUND:
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED:
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED_V1:
  	case CS_TYPE::EVT_ADVERTISEMENT_UPDATED:
  	case CS_TYPE::EVT_BLE_CONNECT:
  	case CS_TYPE::EVT_BLE_DISCONNECT:
  	case CS_TYPE::EVT_OUTGOING_CONNECT_START:
  	case CS_TYPE::EVT_OUTGOING_CONNECTED:
  	case CS_TYPE::EVT_OUTGOING_DISCONNECTED:
  	case CS_TYPE::EVT_BROWNOUT_IMPENDING:
  	case CS_TYPE::EVT_CHIP_TEMP_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_CHIP_TEMP_OK:
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD_DIMMER:
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_DEVICE_SCANNED:
  	case CS_TYPE::EVT_DIMMER_FORCED_OFF:
  	case CS_TYPE::EVT_DIMMER_OFF_FAILURE_DETECTED:
  	case CS_TYPE::EVT_DIMMER_ON_FAILURE_DETECTED:
  	case CS_TYPE::EVT_DIMMER_POWERED:
  	case CS_TYPE::EVT_DIMMER_TEMP_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_DIMMER_TEMP_OK:
  	case CS_TYPE::CMD_DIMMING_ALLOWED:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_REGISTER:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_REGISTER:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_TOKEN:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_TOKEN:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_LIST_SIZE:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_LIST_SIZE:
  	case CS_TYPE::CMD_SEND_MESH_CONTROL_COMMAND:
  	case CS_TYPE::EVT_RELAY_FORCED_ON:
  	case CS_TYPE::EVT_SCAN_STARTED:
  	case CS_TYPE::EVT_SCAN_STOPPED:
  	case CS_TYPE::EVT_SESSION_DATA_SET:
  	case CS_TYPE::EVT_SETUP_DONE:
  	case CS_TYPE::EVT_STATE_EXTERNAL_STONE:
  	case CS_TYPE::EVT_STATE_FACTORY_RESET_DONE:
  	case CS_TYPE::EVT_STORAGE_INITIALIZED:
  	case CS_TYPE::EVT_STORAGE_WRITE_DONE:
  	case CS_TYPE::EVT_STORAGE_REMOVE_DONE:
  	case CS_TYPE::EVT_STORAGE_REMOVE_ALL_TYPES_WITH_ID_DONE:
  	case CS_TYPE::EVT_STORAGE_GC_DONE:
  	case CS_TYPE::EVT_STORAGE_FACTORY_RESET_DONE:
  	case CS_TYPE::EVT_STORAGE_PAGES_ERASED:
  	case CS_TYPE::EVT_MESH_FACTORY_RESET_DONE:
  	case CS_TYPE::CMD_STORAGE_GARBAGE_COLLECT:
  	case CS_TYPE::EVT_SWITCH_FORCED_OFF:
  	case CS_TYPE::CMD_SWITCHING_ALLOWED:
  	case CS_TYPE::EVT_TICK:
  	case CS_TYPE::EVT_TIME_SET:
  	case CS_TYPE::CMD_ADD_BEHAVIOUR:
  	case CS_TYPE::CMD_REPLACE_BEHAVIOUR:
  	case CS_TYPE::CMD_REMOVE_BEHAVIOUR:
  	case CS_TYPE::CMD_GET_BEHAVIOUR:
  	case CS_TYPE::CMD_GET_BEHAVIOUR_INDICES:
  	case CS_TYPE::CMD_GET_BEHAVIOUR_DEBUG:
  	case CS_TYPE::CMD_CLEAR_ALL_BEHAVIOUR:
  	case CS_TYPE::EVT_BEHAVIOURSTORE_MUTATION:
  	case CS_TYPE::EVT_BEHAVIOUR_OVERRIDDEN:
  	case CS_TYPE::CMD_REGISTER_TRACKED_DEVICE:
  	case CS_TYPE::CMD_UPDATE_TRACKED_DEVICE:
  	case CS_TYPE::CMD_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::EVT_PRESENCE_MUTATION:
  	case CS_TYPE::EVT_PRESENCE_CHANGE:
  	case CS_TYPE::CMD_GET_PRESENCE:
  	case CS_TYPE::CMD_SET_RELAY:
  	case CS_TYPE::CMD_SET_DIMMER:
  	case CS_TYPE::EVT_GOING_TO_DFU:
  	case CS_TYPE::EVT_RECEIVED_PROFILE_LOCATION:
  	case CS_TYPE::EVT_TRACKABLE:
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_OUTGOING:
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_INCOMING:
  	case CS_TYPE::EVT_MESH_SYNC_FAILED:
  	case CS_TYPE::EVT_MESH_PAGES_ERASED:
  	case CS_TYPE::EVT_MESH_EXT_STATE_0:
  	case CS_TYPE::EVT_MESH_EXT_STATE_1:
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_TIME:
  	case CS_TYPE::CMD_SET_IBEACON_CONFIG_ID:
  	case CS_TYPE::CMD_SEND_MESH_MSG_NOOP:
  	case CS_TYPE::EVT_MESH_RSSI_PING:
  	case CS_TYPE::EVT_MESH_RSSI_DATA:
  	case CS_TYPE::EVT_MESH_NEAREST_WITNESS_REPORT:
  	case CS_TYPE::EVT_MESH_TIME_SYNC:
  	case CS_TYPE::EVT_RECV_MESH_MSG:
  	case CS_TYPE::CMD_GET_ADC_RESTARTS:
  	case CS_TYPE::CMD_GET_SWITCH_HISTORY:
  	case CS_TYPE::CMD_GET_POWER_SAMPLES:
  	case CS_TYPE::CMD_GET_SCHEDULER_MIN_FREE:
  	case CS_TYPE::CMD_GET_RESET_REASON:
  	case CS_TYPE::CMD_GET_GPREGRET:
  	case CS_TYPE::CMD_GET_ADC_CHANNEL_SWAPS:
  	case CS_TYPE::CMD_GET_RAM_STATS:
  	case CS_TYPE::EVT_GENERIC_TEST:
  	case CS_TYPE::CMD_TEST_SET_TIME:
  	case CS_TYPE::CMD_MICROAPP:
  	case CS_TYPE::EVT_MICROAPP:
  	case CS_TYPE::CMD_MICROAPP_ADVERTISE:
  	case CS_TYPE::EVT_HUB_DATA_REPLY:
  		return NO_ONE;
  	}
  	return NO_ONE;
  }
  
  EncryptionAccessLevel getUserAccessLevelGet(CS_TYPE const & type) {
  	switch (type) {
  	case CS_TYPE::CONFIG_ADV_INTERVAL:
  	case CS_TYPE::CONFIG_BOOT_DELAY:
  	case CS_TYPE::CONFIG_SPHERE_ID:
  	case CS_TYPE::CONFIG_CROWNSTONE_ID:
  	case CS_TYPE::CONFIG_CURRENT_ADC_ZERO:
  	case CS_TYPE::CONFIG_CURRENT_MULTIPLIER:
  	case CS_TYPE::CONFIG_ENCRYPTION_ENABLED:
  	case CS_TYPE::CONFIG_IBEACON_ENABLED:
  	case CS_TYPE::CONFIG_IBEACON_MAJOR:
  	case CS_TYPE::CONFIG_IBEACON_MINOR:
  	case CS_TYPE::CONFIG_IBEACON_UUID:
  	case CS_TYPE::CONFIG_IBEACON_TXPOWER:
  	case CS_TYPE::CONFIG_LOW_TX_POWER:
  	case CS_TYPE::CONFIG_MAX_CHIP_TEMP:
  	case CS_TYPE::CONFIG_MESH_ENABLED:
  	case CS_TYPE::CONFIG_NAME:
  	case CS_TYPE::CONFIG_POWER_ZERO:
  	case CS_TYPE::CONFIG_PWM_ALLOWED:
  	case CS_TYPE::CONFIG_PWM_PERIOD:
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_DOWN:
  	case CS_TYPE::CONFIG_PWM_TEMP_VOLTAGE_THRESHOLD_UP:
  	case CS_TYPE::CONFIG_RELAY_HIGH_DURATION:
  	case CS_TYPE::CONFIG_SCAN_BREAK_DURATION:
  	case CS_TYPE::CONFIG_SCAN_DURATION:
  	case CS_TYPE::CONFIG_SCANNER_ENABLED:
  	case CS_TYPE::CONFIG_SCAN_INTERVAL:
  	case CS_TYPE::CONFIG_SCAN_WINDOW:
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD:
  	case CS_TYPE::CONFIG_SOFT_FUSE_CURRENT_THRESHOLD_DIMMER:
  	case CS_TYPE::CONFIG_START_DIMMER_ON_ZERO_CROSSING:
  	case CS_TYPE::CONFIG_SWITCH_LOCKED:
  	case CS_TYPE::CONFIG_SWITCHCRAFT_ENABLED:
  	case CS_TYPE::CONFIG_SWITCHCRAFT_THRESHOLD:
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_ENABLED:
  	case CS_TYPE::CONFIG_TAP_TO_TOGGLE_RSSI_THRESHOLD_OFFSET:
  	case CS_TYPE::CONFIG_TX_POWER:
  	case CS_TYPE::CONFIG_UART_ENABLED:
  	case CS_TYPE::CONFIG_VOLTAGE_ADC_ZERO:
  	case CS_TYPE::CONFIG_VOLTAGE_MULTIPLIER:
  	case CS_TYPE::STATE_MESH_IV_INDEX:
  	case CS_TYPE::STATE_MESH_SEQ_NUMBER:
  	case CS_TYPE::STATE_IBEACON_CONFIG_ID:
  	case CS_TYPE::STATE_MICROAPP:
  	case CS_TYPE::STATE_SOFT_ON_SPEED:
  	case CS_TYPE::STATE_HUB_MODE:
  		return ADMIN;
  	case CS_TYPE::STATE_ACCUMULATED_ENERGY:
  	case CS_TYPE::STATE_ERRORS:
  	case CS_TYPE::STATE_POWER_USAGE:
  	case CS_TYPE::STATE_RESET_COUNTER:
  	case CS_TYPE::STATE_SWITCH_STATE:
  	case CS_TYPE::STATE_TEMPERATURE:
  	case CS_TYPE::STATE_SUN_TIME:
  	case CS_TYPE::STATE_BEHAVIOUR_MASTER_HASH:
  		return MEMBER;
  	case CS_TYPE::STATE_BEHAVIOUR_SETTINGS:
  		return BASIC;
  	case CS_TYPE::CONFIG_CURRENT_LIMIT:
  	case CS_TYPE::CONFIG_KEY_ADMIN:
  	case CS_TYPE::CONFIG_KEY_MEMBER:
  	case CS_TYPE::CONFIG_KEY_BASIC:
  	case CS_TYPE::CONFIG_KEY_SERVICE_DATA:
  	case CS_TYPE::CONFIG_MESH_DEVICE_KEY:
  	case CS_TYPE::CONFIG_MESH_APP_KEY:
  	case CS_TYPE::CONFIG_MESH_NET_KEY:
  	case CS_TYPE::CONFIG_KEY_LOCALIZATION:
  	case CS_TYPE::CONFIG_DO_NOT_USE:
  	case CS_TYPE::STATE_BEHAVIOUR_RULE:
  	case CS_TYPE::STATE_TWILIGHT_RULE:
  	case CS_TYPE::STATE_EXTENDED_BEHAVIOUR_RULE:
  	case CS_TYPE::STATE_FACTORY_RESET:
  	case CS_TYPE::STATE_OPERATION_MODE:
  	case CS_TYPE::STATE_UART_KEY:
  	case CS_TYPE::CMD_CONTROL_CMD:
  	case CS_TYPE::CMD_DEC_CURRENT_RANGE:
  	case CS_TYPE::CMD_DEC_VOLTAGE_RANGE:
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_CURRENT:
  	case CS_TYPE::CMD_ENABLE_ADC_DIFFERENTIAL_VOLTAGE:
  	case CS_TYPE::CMD_ENABLE_ADVERTISEMENT:
  	case CS_TYPE::CMD_ENABLE_LOG_CURRENT:
  	case CS_TYPE::CMD_ENABLE_LOG_FILTERED_CURRENT:
  	case CS_TYPE::CMD_ENABLE_LOG_POWER:
  	case CS_TYPE::CMD_ENABLE_LOG_VOLTAGE:
  	case CS_TYPE::CMD_ENABLE_MESH:
  	case CS_TYPE::CMD_FACTORY_RESET:
  	case CS_TYPE::CMD_INC_CURRENT_RANGE:
  	case CS_TYPE::CMD_INC_VOLTAGE_RANGE:
  	case CS_TYPE::CMD_RESET_DELAYED:
  	case CS_TYPE::CMD_SEND_MESH_MSG:
  	case CS_TYPE::CMD_SEND_MESH_MSG_MULTI_SWITCH:
  	case CS_TYPE::CMD_SEND_MESH_MSG_PROFILE_LOCATION:
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_BEHAVIOUR_SETTINGS:
  	case CS_TYPE::CMD_SET_TIME:
  	case CS_TYPE::CMD_SWITCH_OFF:
  	case CS_TYPE::CMD_SWITCH_ON:
  	case CS_TYPE::CMD_SWITCH_TOGGLE:
  	case CS_TYPE::CMD_SWITCH:
  	case CS_TYPE::CMD_MULTI_SWITCH:
  	case CS_TYPE::CMD_TOGGLE_ADC_VOLTAGE_VDD_REFERENCE_PIN:
  	case CS_TYPE::EVT_ADC_RESTARTED:
  	case CS_TYPE::EVT_ADV_BACKGROUND:
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED:
  	case CS_TYPE::EVT_ADV_BACKGROUND_PARSED_V1:
  	case CS_TYPE::EVT_ADVERTISEMENT_UPDATED:
  	case CS_TYPE::EVT_BLE_CONNECT:
  	case CS_TYPE::EVT_BLE_DISCONNECT:
  	case CS_TYPE::EVT_OUTGOING_CONNECT_START:
  	case CS_TYPE::EVT_OUTGOING_CONNECTED:
  	case CS_TYPE::EVT_OUTGOING_DISCONNECTED:
  	case CS_TYPE::EVT_BROWNOUT_IMPENDING:
  	case CS_TYPE::EVT_CHIP_TEMP_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_CHIP_TEMP_OK:
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD_DIMMER:
  	case CS_TYPE::EVT_CURRENT_USAGE_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_DEVICE_SCANNED:
  	case CS_TYPE::EVT_DIMMER_FORCED_OFF:
  	case CS_TYPE::EVT_DIMMER_OFF_FAILURE_DETECTED:
  	case CS_TYPE::EVT_DIMMER_ON_FAILURE_DETECTED:
  	case CS_TYPE::EVT_DIMMER_POWERED:
  	case CS_TYPE::EVT_DIMMER_TEMP_ABOVE_THRESHOLD:
  	case CS_TYPE::EVT_DIMMER_TEMP_OK:
  	case CS_TYPE::CMD_DIMMING_ALLOWED:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_REGISTER:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_REGISTER:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_TOKEN:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_TOKEN:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::EVT_MESH_TRACKED_DEVICE_LIST_SIZE:
  	case CS_TYPE::CMD_SEND_MESH_MSG_TRACKED_DEVICE_LIST_SIZE:
  	case CS_TYPE::CMD_SEND_MESH_CONTROL_COMMAND:
  	case CS_TYPE::EVT_RELAY_FORCED_ON:
  	case CS_TYPE::EVT_SCAN_STARTED:
  	case CS_TYPE::EVT_SCAN_STOPPED:
  	case CS_TYPE::EVT_SESSION_DATA_SET:
  	case CS_TYPE::EVT_SETUP_DONE:
  	case CS_TYPE::EVT_STATE_EXTERNAL_STONE:
  	case CS_TYPE::EVT_STATE_FACTORY_RESET_DONE:
  	case CS_TYPE::EVT_STORAGE_INITIALIZED:
  	case CS_TYPE::EVT_STORAGE_WRITE_DONE:
  	case CS_TYPE::EVT_STORAGE_REMOVE_DONE:
  	case CS_TYPE::EVT_STORAGE_REMOVE_ALL_TYPES_WITH_ID_DONE:
  	case CS_TYPE::EVT_STORAGE_GC_DONE:
  	case CS_TYPE::EVT_STORAGE_FACTORY_RESET_DONE:
  	case CS_TYPE::EVT_STORAGE_PAGES_ERASED:
  	case CS_TYPE::EVT_MESH_FACTORY_RESET_DONE:
  	case CS_TYPE::CMD_STORAGE_GARBAGE_COLLECT:
  	case CS_TYPE::EVT_SWITCH_FORCED_OFF:
  	case CS_TYPE::CMD_SWITCHING_ALLOWED:
  	case CS_TYPE::EVT_TICK:
  	case CS_TYPE::EVT_TIME_SET:
  	case CS_TYPE::CMD_ADD_BEHAVIOUR:
  	case CS_TYPE::CMD_REPLACE_BEHAVIOUR:
  	case CS_TYPE::CMD_REMOVE_BEHAVIOUR:
  	case CS_TYPE::CMD_GET_BEHAVIOUR:
  	case CS_TYPE::CMD_GET_BEHAVIOUR_INDICES:
  	case CS_TYPE::CMD_GET_BEHAVIOUR_DEBUG:
  	case CS_TYPE::CMD_CLEAR_ALL_BEHAVIOUR:
  	case CS_TYPE::EVT_BEHAVIOURSTORE_MUTATION:
  	case CS_TYPE::EVT_BEHAVIOUR_OVERRIDDEN:
  	case CS_TYPE::CMD_REGISTER_TRACKED_DEVICE:
  	case CS_TYPE::CMD_UPDATE_TRACKED_DEVICE:
  	case CS_TYPE::CMD_TRACKED_DEVICE_HEARTBEAT:
  	case CS_TYPE::EVT_PRESENCE_MUTATION:
  	case CS_TYPE::EVT_PRESENCE_CHANGE:
  	case CS_TYPE::CMD_GET_PRESENCE:
  	case CS_TYPE::CMD_SET_RELAY:
  	case CS_TYPE::CMD_SET_DIMMER:
  	case CS_TYPE::EVT_GOING_TO_DFU:
  	case CS_TYPE::EVT_RECEIVED_PROFILE_LOCATION:
  	case CS_TYPE::EVT_TRACKABLE:
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_OUTGOING:
  	case CS_TYPE::EVT_MESH_SYNC_REQUEST_INCOMING:
  	case CS_TYPE::EVT_MESH_SYNC_FAILED:
  	case CS_TYPE::EVT_MESH_PAGES_ERASED:
  	case CS_TYPE::EVT_MESH_EXT_STATE_0:
  	case CS_TYPE::EVT_MESH_EXT_STATE_1:
  	case CS_TYPE::CMD_SEND_MESH_MSG_SET_TIME:
  	case CS_TYPE::CMD_SET_IBEACON_CONFIG_ID:
  	case CS_TYPE::CMD_SEND_MESH_MSG_NOOP:
  	case CS_TYPE::EVT_MESH_RSSI_PING:
  	case CS_TYPE::EVT_MESH_RSSI_DATA:
  	case CS_TYPE::EVT_MESH_NEAREST_WITNESS_REPORT:
  	case CS_TYPE::EVT_MESH_TIME_SYNC:
  	case CS_TYPE::EVT_RECV_MESH_MSG:
  	case CS_TYPE::CMD_GET_ADC_RESTARTS:
  	case CS_TYPE::CMD_GET_SWITCH_HISTORY:
  	case CS_TYPE::CMD_GET_POWER_SAMPLES:
  	case CS_TYPE::CMD_GET_SCHEDULER_MIN_FREE:
  	case CS_TYPE::CMD_GET_RESET_REASON:
  	case CS_TYPE::CMD_GET_GPREGRET:
  	case CS_TYPE::CMD_GET_ADC_CHANNEL_SWAPS:
  	case CS_TYPE::CMD_GET_RAM_STATS:
  	case CS_TYPE::EVT_GENERIC_TEST:
  	case CS_TYPE::CMD_TEST_SET_TIME:
  	case CS_TYPE::CMD_MICROAPP:
  	case CS_TYPE::EVT_MICROAPP:
  	case CS_TYPE::CMD_MICROAPP_ADVERTISE:
  	case CS_TYPE::EVT_HUB_DATA_REPLY:
  		return NO_ONE;
  	}
  	return NO_ONE;
  }
  
  