5-17-1 判断灯的状态

self.currentDevice.EQUIPMENT_ONOFF 为 nsinteger 类型

if (self.currentDevice.place == Max) {
                self.currentDevice.EQUIPMENT_ONOFF = self.currentDevice.EQUIPMENT_ONOFF ^ (1 << (5-1));
                command = (command | (1 << 5)) ^ (1 << (5-1));
            }else if (self.currentDevice.place == Min){
                self.currentDevice.EQUIPMENT_ONOFF = self.currentDevice.EQUIPMENT_ONOFF ^ (1 << 0);
                command = (command | (1 << 1)) ^ (1 << 0);
            }else if (self.currentDevice.place == Middle){
                self.currentDevice.EQUIPMENT_ONOFF = self.currentDevice.EQUIPMENT_ONOFF ^ (1 << (3-1));
                command = (command | (1 << 3)) ^ (1 << (3-1));
            }

你可能感兴趣的:(5-17-1 判断灯的状态)