1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.service.controls; 18 19 import android.annotation.IntDef; 20 21 import java.lang.annotation.Retention; 22 import java.lang.annotation.RetentionPolicy; 23 24 /** 25 * Device types for {@link Control}. 26 * 27 * Each {@link Control} declares a type for the device they represent. This type will be used to 28 * determine icons and colors. 29 * <p> 30 * The type of the device may change on status updates of the {@link Control}. For example, a 31 * device of {@link #TYPE_OUTLET} could be determined by the {@link ControlsProviderService} to be 32 * a {@link #TYPE_COFFEE_MAKER} and change the type for that {@link Control}, therefore possibly 33 * changing icon and color. 34 * <p> 35 * In case the device type is not know by the application but the basic function is, or there is no 36 * provided type, one of the generic types (those starting with {@code TYPE_GENERIC}) can be used. 37 * These will provide an identifiable icon based on the basic function of the device. 38 */ 39 public class DeviceTypes { 40 41 // Update this when adding new concrete types. Does not count TYPE_UNKNOWN 42 private static final int NUM_CONCRETE_TYPES = 52; 43 44 public static final @DeviceType int TYPE_UNKNOWN = 0; 45 public static final @DeviceType int TYPE_AC_HEATER = 1; 46 public static final @DeviceType int TYPE_AC_UNIT = 2; 47 public static final @DeviceType int TYPE_AIR_FRESHENER = 3; 48 public static final @DeviceType int TYPE_AIR_PURIFIER = 4; 49 public static final @DeviceType int TYPE_COFFEE_MAKER = 5; 50 public static final @DeviceType int TYPE_DEHUMIDIFIER = 6; 51 public static final @DeviceType int TYPE_DISPLAY = 7; 52 public static final @DeviceType int TYPE_FAN = 8; 53 public static final @DeviceType int TYPE_HOOD = 10; 54 public static final @DeviceType int TYPE_HUMIDIFIER = 11; 55 public static final @DeviceType int TYPE_KETTLE = 12; 56 public static final @DeviceType int TYPE_LIGHT = 13; 57 public static final @DeviceType int TYPE_MICROWAVE = 14; 58 public static final @DeviceType int TYPE_OUTLET = 15; 59 public static final @DeviceType int TYPE_RADIATOR = 16; 60 public static final @DeviceType int TYPE_REMOTE_CONTROL = 17; 61 public static final @DeviceType int TYPE_SET_TOP = 18; 62 public static final @DeviceType int TYPE_STANDMIXER = 19; 63 public static final @DeviceType int TYPE_STYLER = 20; 64 public static final @DeviceType int TYPE_SWITCH = 21; 65 public static final @DeviceType int TYPE_TV = 22; 66 public static final @DeviceType int TYPE_WATER_HEATER = 23; 67 68 public static final @DeviceType int TYPE_DISHWASHER = 24; 69 public static final @DeviceType int TYPE_DRYER = 25; 70 public static final @DeviceType int TYPE_MOP = 26; 71 public static final @DeviceType int TYPE_MOWER = 27; 72 public static final @DeviceType int TYPE_MULTICOOKER = 28; 73 public static final @DeviceType int TYPE_SHOWER = 29; 74 public static final @DeviceType int TYPE_SPRINKLER = 30; 75 public static final @DeviceType int TYPE_WASHER = 31; 76 public static final @DeviceType int TYPE_VACUUM = 32; 77 78 public static final @DeviceType int TYPE_AWNING = 33; 79 public static final @DeviceType int TYPE_BLINDS = 34; 80 public static final @DeviceType int TYPE_CLOSET = 35; 81 public static final @DeviceType int TYPE_CURTAIN = 36; 82 public static final @DeviceType int TYPE_DOOR = 37; 83 public static final @DeviceType int TYPE_DRAWER = 38; 84 public static final @DeviceType int TYPE_GARAGE = 39; 85 public static final @DeviceType int TYPE_GATE = 40; 86 public static final @DeviceType int TYPE_PERGOLA = 41; 87 public static final @DeviceType int TYPE_SHUTTER = 42; 88 public static final @DeviceType int TYPE_WINDOW = 43; 89 public static final @DeviceType int TYPE_VALVE = 44; 90 91 public static final @DeviceType int TYPE_LOCK = 45; 92 93 public static final @DeviceType int TYPE_SECURITY_SYSTEM = 46; 94 95 public static final @DeviceType int TYPE_HEATER = 47; 96 public static final @DeviceType int TYPE_REFRIGERATOR = 48; 97 public static final @DeviceType int TYPE_THERMOSTAT = 49; 98 99 public static final @DeviceType int TYPE_CAMERA = 50; 100 public static final @DeviceType int TYPE_DOORBELL = 51; 101 102 /* 103 * Also known as macros, routines can aggregate a series of actions across multiple devices 104 */ 105 public static final @DeviceType int TYPE_ROUTINE = 52; 106 107 // Update this when adding new generic types. 108 private static final int NUM_GENERIC_TYPES = 7; 109 public static final @DeviceType int TYPE_GENERIC_ON_OFF = -1; 110 public static final @DeviceType int TYPE_GENERIC_START_STOP = -2; 111 public static final @DeviceType int TYPE_GENERIC_OPEN_CLOSE = -3; 112 public static final @DeviceType int TYPE_GENERIC_LOCK_UNLOCK = -4; 113 public static final @DeviceType int TYPE_GENERIC_ARM_DISARM = -5; 114 public static final @DeviceType int TYPE_GENERIC_TEMP_SETTING = -6; 115 public static final @DeviceType int TYPE_GENERIC_VIEWSTREAM = -7; 116 validDeviceType(int deviceType)117 public static boolean validDeviceType(int deviceType) { 118 return deviceType >= -NUM_GENERIC_TYPES && deviceType <= NUM_CONCRETE_TYPES; 119 } 120 121 /** 122 * @hide 123 */ 124 @Retention(RetentionPolicy.SOURCE) 125 @IntDef({ 126 TYPE_GENERIC_ON_OFF, 127 TYPE_GENERIC_START_STOP, 128 TYPE_GENERIC_OPEN_CLOSE, 129 TYPE_GENERIC_LOCK_UNLOCK, 130 TYPE_GENERIC_ARM_DISARM, 131 TYPE_GENERIC_TEMP_SETTING, 132 TYPE_GENERIC_VIEWSTREAM, 133 134 TYPE_UNKNOWN, 135 136 TYPE_AC_HEATER, 137 TYPE_AC_UNIT, 138 TYPE_AIR_FRESHENER, 139 TYPE_AIR_PURIFIER, 140 TYPE_COFFEE_MAKER, 141 TYPE_DEHUMIDIFIER, 142 TYPE_DISPLAY, 143 TYPE_FAN, 144 TYPE_HOOD, 145 TYPE_HUMIDIFIER, 146 TYPE_KETTLE, 147 TYPE_LIGHT, 148 TYPE_MICROWAVE, 149 TYPE_OUTLET, 150 TYPE_RADIATOR, 151 TYPE_REMOTE_CONTROL, 152 TYPE_SET_TOP, 153 TYPE_STANDMIXER, 154 TYPE_STYLER, 155 TYPE_SWITCH, 156 TYPE_TV, 157 TYPE_WATER_HEATER, 158 TYPE_DISHWASHER, 159 TYPE_DRYER, 160 TYPE_MOP, 161 TYPE_MOWER, 162 TYPE_MULTICOOKER, 163 TYPE_SHOWER, 164 TYPE_SPRINKLER, 165 TYPE_WASHER, 166 TYPE_VACUUM, 167 TYPE_AWNING, 168 TYPE_BLINDS, 169 TYPE_CLOSET, 170 TYPE_CURTAIN, 171 TYPE_DOOR, 172 TYPE_DRAWER, 173 TYPE_GARAGE, 174 TYPE_GATE, 175 TYPE_PERGOLA, 176 TYPE_SHUTTER, 177 TYPE_WINDOW, 178 TYPE_VALVE, 179 TYPE_LOCK, 180 TYPE_SECURITY_SYSTEM, 181 TYPE_HEATER, 182 TYPE_REFRIGERATOR, 183 TYPE_THERMOSTAT, 184 TYPE_CAMERA, 185 TYPE_DOORBELL, 186 TYPE_ROUTINE 187 }) 188 public @interface DeviceType {} 189 DeviceTypes()190 private DeviceTypes() {} 191 } 192