php SetValueInteger类(方法)实例源码

下面列出了php SetValueInteger 类(方法)源码代码实例,从而了解它的用法。

作者:Wolbola    项目:IPSymconAIOGatewa   
public function RequestAction($Ident, $Value)
 {
     switch ($Ident) {
         case "Dooya":
             switch ($Value) {
                 case 0:
                     //Down
                     $state = false;
                     SetValueInteger($this->GetIDForIdent('Dooya'), $Value);
                     $this->Down();
                     break;
                 case 1:
                     //Stop
                     $this->Stop();
                     SetValueInteger($this->GetIDForIdent('Dooya'), $Value);
                     break;
                 case 2:
                     //Up
                     $this->Up();
                     SetValueInteger($this->GetIDForIdent('Dooya'), $Value);
                     break;
             }
             break;
         default:
             throw new Exception("Invalid ident");
     }
 }

作者:TierFreun    项目:Rpc2Symco   
protected function SetValueInteger($Ident, $Value)
 {
     $ID = $this->GetIDForIdent($Ident);
     if (GetValueInteger($ID) != $Value) {
         SetValueInteger($ID, intval($Value));
         return true;
     }
     return false;
 }

作者:hermanthegerman    项目:IPSBananaP   
private function SetValueInteger($Ident, $value)
 {
     $id = $this->GetIDForIdent($Ident);
     if (GetValueInteger($id) != $value) {
         SetValueInteger($id, $value);
         return true;
     }
     return false;
 }

作者:Spoosi    项目:KH_UniF   
function SetVariable($VarID, $Type, $Value)
{
    switch ($Type) {
        case 0:
            // boolean
            SetValueBoolean($VarID, $Value);
            break;
        case 1:
            // integer
            SetValueInteger($VarID, $Value);
            break;
        case 2:
            // float
            SetValueFloat($VarID, $Value);
            break;
        case 3:
            // string
            SetValueString($VarID, $Value);
            break;
    }
}

作者:Nall-cha    项目:IPSOnkyoAV   
private function UpdateVariable(ISCP_API_Data $APIData)
 {
     if ($APIData->Data == "N/A") {
         return;
     }
     switch ($APIData->Mapping->VarType) {
         case IPSVarType::vtBoolean:
             $VarID = $this->GetVariable($APIData->APICommand, $APIData->Mapping->VarType, $APIData->Mapping->VarName, $APIData->Mapping->Profile, $APIData->Mapping->EnableAction);
             $Value = ISCP_API_Commands::$BoolValueMapping[$APIData->Data];
             SetValueBoolean($VarID, $Value);
             break;
         case IPSVarType::vtFloat:
             $VarID = $this->GetVariable($APIData->APICommand, $APIData->Mapping->VarType, $APIData->Mapping->VarName, $APIData->Mapping->Profile, $APIData->Mapping->EnableAction);
             $Value = $APIData / 100;
             SetValueFloat($VarID, $Value);
             //                throw new Exception("Float VarType not implemented.");
             break;
         case IPSVarType::vtInteger:
             $VarID = $this->GetVariable($APIData->APICommand, $APIData->Mapping->VarType, $APIData->Mapping->VarName, $APIData->Mapping->Profile, $APIData->Mapping->EnableAction);
             $Value = hexdec($APIData->Data);
             SetValueInteger($VarID, $Value);
             break;
         case IPSVarType::vtString:
             $VarID = $this->GetVariable($APIData->APICommand, $APIData->Mapping->VarType, $APIData->Mapping->VarName, $APIData->Mapping->Profile, $APIData->Mapping->EnableAction);
             $Value = $APIData->Data;
             SetValueString($VarID, $Value);
             break;
         case IPSVarType::vtDualInteger:
             $Prefix = substr($APIData->Data, 0, 1);
             $VarID = $this->GetVariable($APIData->APICommand . $APIData->Mapping->ValuePrefix[$Prefix], IPSVarType::vtInteger, $APIData->Mapping->VarName[$Prefix], $APIData->Mapping->Profile, $APIData->Mapping->EnableAction);
             $Value = $APIData->Mapping->ValueMapping[substr($APIData->Data, 1, 2)];
             SetValueInteger($VarID, $Value);
             if (strlen($APIData->Data) > 3) {
                 $Prefix = substr($APIData->Data, 3, 1);
                 $VarID = $this->GetVariable($APIData->APICommand . $APIData->Mapping->ValuePrefix[$Prefix], IPSVarType::vtInteger, $APIData->Mapping->VarName[$Prefix], $APIData->Mapping->Profile, $APIData->Mapping->EnableAction);
                 $Value = $APIData->Mapping->ValueMapping[substr($APIData->Data, 4, 2)];
                 SetValueInteger($VarID, $Value);
             }
     }
 }

作者:scheibuma    项目:SymconYAV   
public function SetInput($input)
 {
     SetValueInteger($this->GetIDForIdent('INPUT'), $this->GetInputId($input));
     return $this->Request("<Input><Input_Sel>{$input}</Input_Sel></Input>", 'PUT');
 }

作者:Wolbola    项目:IPSymconAIOGatewa   
public function SendRFCode(integer $Value)
 {
     //RF Code auslesen Value 0 entspricht RFCode 1
     $RFCode = "RFCode" . $Value;
     if ($Value <= 32 && !null == $this->GetIDForIdent('RFCODES1')) {
         $setvalue = $Value - 1;
         SetValueInteger($this->GetIDForIdent('RFCODES1'), $setvalue);
     } elseif ($Value <= 64 && $Value > 32 && !null == $this->GetIDForIdent('RFCODES2')) {
         $setvalue = $Value - 33;
         SetValueInteger($this->GetIDForIdent('RFCODES2'), $setvalue);
     } elseif ($Value <= 96 && $Value > 64 && !null == $this->GetIDForIdent('RFCODES3')) {
         $setvalue = $Value - 65;
         SetValueInteger($this->GetIDForIdent('RFCODES3'), $setvalue);
     } elseif ($Value <= 100 && $Value > 96 && !null == $this->GetIDForIdent('RFCODES4')) {
         $setvalue = $Value - 97;
         SetValueInteger($this->GetIDForIdent('RFCODES4'), $setvalue);
     }
     $RF_send = $this->ReadPropertyString($RFCode);
     return $this->Send_RF($RF_send);
 }

作者:Wolbola    项目:IPSymconAIOGatewa   
protected function SendCommand($command)
 {
     $FS20 = $this->Calculate();
     $ip_aiogateway = $this->GetIPGateway();
     IPS_LogMessage("FS20 Adresse:", $FS20);
     IPS_LogMessage("FS20 Command:", $command);
     $GatewayPassword = $this->GetPassword();
     switch ($command) {
         case "1000":
             //An
             SetValueBoolean($this->GetIDForIdent('Status'), true);
             if (IPS_StatusVariableExists($this->InstanceID, "Dimmer")) {
                 SetValueInteger($this->GetIDForIdent('Dimmer'), 10);
             }
             break;
         case "0000":
             //Aus
             SetValueBoolean($this->GetIDForIdent('Status'), false);
             if (IPS_StatusVariableExists($this->InstanceID, "Dimmer")) {
                 SetValueInteger($this->GetIDForIdent('Dimmer'), 0);
             }
             break;
         case "DIM0":
             //0
             SetValueBoolean($this->GetIDForIdent('Status'), false);
             SetValueInteger($this->GetIDForIdent('Dimmer'), 0);
             $command = "0000";
             break;
         case "0200":
             //10
             SetValueInteger($this->GetIDForIdent('Dimmer'), 1);
             break;
         case "0300":
             //20
             SetValueInteger($this->GetIDForIdent('Dimmer'), 2);
             break;
         case "0500":
             //30
             SetValueInteger($this->GetIDForIdent('Dimmer'), 3);
             break;
         case "0600":
             //40
             SetValueInteger($this->GetIDForIdent('Dimmer'), 4);
             break;
         case "0800":
             //50
             SetValueInteger($this->GetIDForIdent('Dimmer'), 5);
             break;
         case "0900":
             //60
             SetValueInteger($this->GetIDForIdent('Dimmer'), 6);
             break;
         case "0B00":
             //70
             SetValueInteger($this->GetIDForIdent('Dimmer'), 7);
             break;
         case "0D00":
             //80
             SetValueInteger($this->GetIDForIdent('Dimmer'), 8);
             break;
         case "0E00":
             //90
             SetValueInteger($this->GetIDForIdent('Dimmer'), 9);
             break;
         case "DIM100":
             //100
             SetValueBoolean($this->GetIDForIdent('Status'), true);
             SetValueInteger($this->GetIDForIdent('Dimmer'), 10);
             $command = "1000";
             break;
     }
     if ($GatewayPassword !== "") {
         $gwcheck = file_get_contents("http://" . $this->GetIPGateway() . "/command?XC_USER=user&XC_PASS=" . $GatewayPassword . "&XC_FNC=SendSC&type=FS20&data=" . $FS20 . $command);
         IPS_LogMessage("AIOGateway:", "Senden an Gateway mit Passwort");
     } else {
         $gwcheck = file_get_contents("http://" . $this->GetIPGateway() . "/command?XC_FNC=SendSC&type=FS20&data=" . $FS20 . $command);
     }
     if ($gwcheck == "{XC_SUC}") {
         $this->response = true;
     } elseif ($gwcheck == "{XC_AUTH}") {
         $this->response = false;
         echo "Keine Authentifizierung möglich. Das Passwort für das Gateway ist falsch.";
     }
     return $this->response;
 }

作者:Wolbola    项目:IPSymconAIOGatewa   
public function SendIRCode(integer $Value)
 {
     //IR Code auslesen Value 0 entspricht IRCode 1
     $IRCode = "IRCode" . $Value;
     if ($Value <= 32 && !null == $this->GetIDForIdent('IRCODES1')) {
         $setvalue = $Value - 1;
         SetValueInteger($this->GetIDForIdent('IRCODES1'), $setvalue);
     } elseif ($Value <= 64 && $Value > 32 && !null == $this->GetIDForIdent('IRCODES2')) {
         $setvalue = $Value - 33;
         SetValueInteger($this->GetIDForIdent('IRCODES2'), $setvalue);
     } elseif ($Value <= 96 && $Value > 64 && !null == $this->GetIDForIdent('IRCODES3')) {
         $setvalue = $Value - 65;
         SetValueInteger($this->GetIDForIdent('IRCODES3'), $setvalue);
     } elseif ($Value <= 100 && $Value > 96 && !null == $this->GetIDForIdent('IRCODES4')) {
         $setvalue = $Value - 97;
         SetValueInteger($this->GetIDForIdent('IRCODES4'), $setvalue);
     }
     $IR_send = $this->ReadPropertyString($IRCode);
     $this->Send_IR($IR_send, $this->GetIRDiode(), $this->GetExtIRDiode());
     return true;
 }

作者:Tommi2Da    项目:ipsymcon-phpmodule-by-Tomm   
/**
  * handle incoming data along capabilities
  * @param array $data
  */
 private function ParseData($data)
 {
     //
     $caps = $this->GetCaps();
     //$this->debug(__FUNCTION__,print_r($this->all_caps,true));
     foreach (array_keys($caps) as $cap) {
         $ident = $caps[$cap];
         $vid = @$this->GetIDForIdent($ident);
         if ($vid == 0) {
             $this->debug(__FUNCTION__, "Cap {$cap} Ident {$ident}: Variable missed");
             continue;
         }
         if (!isset($data[$cap])) {
             continue;
         }
         $s = $data[$cap];
         switch ($cap) {
             //integer
             case 'TS':
                 //Timestamp
             //Timestamp
             case 'Signal':
                 //RSSI
             //RSSI
             case 'Timer':
                 //Duration code
             //Duration code
             case 'Dimmer':
                 //intensity 100%
             //intensity 100%
             case 'Shutter':
                 //intensity 100%
                 $iv = (int) $s;
                 SetValueInteger($vid, $iv);
                 break;
                 //String
             //String
             case 'Name':
                 //Duration code
                 $st = utf8_decode($s);
                 SetValueString($vid, $st);
                 break;
                 //special
             //special
             case 'Switch':
                 //Status
                 $state = $this->SwitchStatus($s);
                 SetValueBoolean($vid, $state);
                 break;
             case 'Lock':
                 //Status
                 $state = preg_match("/YES|CLOSE|OK/i", $s);
                 //reversed
                 SetValueBoolean($vid, $state);
                 break;
             case 'Alert':
                 //Status
                 $state = !preg_match("/YES|ALERT/i", $s);
                 //reversed
                 SetValueBoolean($vid, $state);
                 break;
             case 'Battery':
                 //battery
                 $state = !preg_match("/LOW|WARN/i", $s);
                 //reversed
                 SetValueBoolean($vid, $state);
                 break;
             case 'FS20':
                 //fs20 mode decoding
                 $state = false;
                 $intensity = 0;
                 $timer = 0;
                 $acode = '';
                 $actioncode = '';
                 $code = utf8_decode($s);
                 $this->debug(__FUNCTION__, "FS20 Code " . strToHex($code));
                 $action = $code[0];
                 $ext = ord($code[1]);
                 $tvid = @$this->GetIDForIdent($caps['Timer']);
                 $dvid = @$this->GetIDForIdent($caps['Dimmer']);
                 $swid = @$this->GetIDForIdent($caps['Switch']);
                 $avid = @$this->GetIDForIdent($caps['TimerActionCode']);
                 $this->debug(__FUNCTION__, "FS20 Vars S:{$swid},D:{$dvid},T:{$tvid},A:{$avid}");
                 if ($dvid) {
                     $intensity = GetValueInteger($dvid);
                 }
                 if ($swid) {
                     $state = GetValueBoolean($swid);
                 }
                 if ($tvid) {
                     $timer = GetValueInteger($tvid);
                 }
                 if ($avid) {
                     $acode = GetValueString($avid);
                 }
                 $ac = ord($action) & 0x1f;
//.........这里部分代码省略.........

作者:Wolbola    项目:IPSymconAIOGatewa   
public function Colorselect(integer $Value)
 {
     SetValueInteger($this->GetIDForIdent('Farbauswahl'), $Value);
     // HEX-Wert in einzelne Werte für Rot / Grün / Blau zerlegen
     $r = $Value >> 16 & 0xff;
     $g = $Value >> 8 & 0xff;
     $b = $Value >> 0 & 0xff;
     // Farbsättigung
     /**
     Berechnung der Helligkeit aus den RGB-Werten mit fs = 255
     http://www.w3.org/TR/2006/WD-WCAG20-20060427/appendixA.html#luminosity-contrastdef
     
      Der Controller hat insgesamt 9 Helligkeitsstufen.
     */
     $fs = 255;
     $Helligkeit = 0.2126 * pow($r / $fs, 2.2) + 0.7151999999999999 * pow($g / $fs, 2.2) + 0.0722 * pow($b / $fs, 2.2);
     $Helligkeitsstufe = intval($Helligkeit * 9 + 1);
     $Helligkeitsstufe_alt = $this->ReadPropertyInteger("Helligkeit");
     $Anzahl = $Helligkeitsstufe - $Helligkeitsstufe_alt;
     SetValue($this->GetIDForIdent("Helligkeit"), $Helligkeitsstufe);
     // Umwandeln der RGB Werte
     $hsv = $this->RGBtoHSV($r, $g, $b);
     $address = $this->ReadPropertyString("LEDAdresse");
     /**
     Holen der 6-stelligen Hex Stringadresse des LM II Controllers
      Diese muss um 0X ergänzt und mit 00 verlängert werden ---> 0xAdresse00.
     
      Ferner werden für die Helligkeitsregelung die Hex Adressen für Up (+3) und
     Down (+) benötigt.
     
     Buchstaben der Hex Werte müssen in Grossbuchstaben umgewandelt werden.
     */
     $Adresse_Hex = "0x" . $address . "00";
     $Adresse_Int = hexdec($Adresse_Hex);
     $Adresse_Up_Hex = strtoupper(dechex($Adresse_Int + 3));
     $Adresse_Down_Hex = strtoupper(dechex($Adresse_Int + 4));
     /**
     			 Der Controller hat insgesamt 128 Farbcodes ---> es gibt 128 Raster mit je 2.8125°. Aufgrund des
     			 hsv Wertes wird das Raster bestimmt.
     
     			Der Farbkreis beginnt mit Rot bei 0°. Innerhalb der Codesequenz des Controllers befindet sich Rot
     			 auf Index = 103. Deshalb müssen die Werte bis zum Index 103 jeweils verringert werden, um den Übergang
     			 zu Gelb, Orange ... zu erhalten. Ab Index 104 muss mit dem letzten Index 128 angefangen werden (lila)
     			und dann immer verringert werden bis rot erreicht ist.
     			
     			Dabei ist zu beachten, dass die gültigen Codes nur die Endstellen 0, 7, 8 und F haben und somit entweder
     			7 oder 1 zu addieren ist.
     */
     $hsv = intval($hsv / 2.8125) + 1;
     if ($hsv > 103) {
         $hsv = 232 - $hsv;
     } else {
         $hsv = 104 - $hsv;
     }
     $Int1 = intval(($hsv - 1) / 4) * 16;
     $Rest = ($hsv - 1) % 4;
     switch ($Rest) {
         case 0:
             $Int2 = 0;
             break;
         case 1:
             $Int2 = 7;
             break;
         case 2:
             $Int2 = 8;
             break;
         case 3:
             $Int2 = 15;
             break;
     }
     // Adresse zum Senden des Farbcodes bilden
     $Adresse_Int = $Adresse_Int + $Int1 + $Int2;
     $address = strtoupper(dechex($Adresse_Int));
     $command = "";
     // command ist schon in address enthalten
     return $this->Send_LED($address, $command, $this->GetIPGateway());
     // Setzen der Helligkeit nachdem die Farbe eingestellt worden ist
     if ($Anzahl > 0) {
         for ($i = 1; $i <= $Anzahl; $i++) {
             $this->Up();
         }
     }
     if ($Anzahl < 0) {
         for ($i = -1; $i >= $Anzahl; $i--) {
             $this->Down();
         }
     }
 }

作者:Tommi2Da    项目:ipsymcon-phpmodule-by-Tomm   
/**
  * parses an record string
  * 
  * @param $data string
  * @param $status string
  * @return array
  */
 private function Parse($data, $status)
 {
     /**
      * @par Status
      * @code
      * #----Status (te923con -s -i '')
      * 0x29 :0x17 :0x14 :0x10 :0x26 :1   :1   :1   :1   :1   :1   :1   :1
      * SYSSW:BARSW:EXTSW:RCCSW:WINSW:BATR:BATU:BATW:BAT5:BAT4:BAT5:BAT2:BAT1
      * @endcode
      * - SYSSW  - software version of system controller
      * - BARSW  - software version of barometer
      * - EXTSW  - software version of UV and channel controller
      * - RCCSW  - software version of rain controller
      * - WINSW  - software version of wind controller
      * - BATR   - battery of rain sensor (1-good (not present), 0-low)
      * - BATU   - battery of UV sensor (1-good (not present), 0-low)
      * - BATW   - battery of wind sensor (1-good (not present), 0-low)
      * - BAT5   - battery of sensor 5 (1-good (not present), 0-low)
      * - BAT4   - battery of sensor 4 (1-good (not present), 0-low)
      * - BAT3   - battery of sensor 3 (1-good (not present), 0-low)
      * - BAT2   - battery of sensor 2 (1-good (not present), 0-low)
      * - BAT1   - battery of sensor 1 (1-good (not present), 0-low)
      *
      * @par Data
      * @code
      * #------Data (te923con -i 'i')
      *
      * 1356207784:22.95:41:7.70:91:8.00:83:i :i :i :i :i :i :1001.9:i :3 :0    :9 :0.1:0.0:7.2:356
      * T0   :H0:T1  :H1:T2  :H2:T3:H3:T4:H4:T5:H5:PRESS :UV:FC:STORM:WD:WS :WG :WC :RC
      * @endcode
      * -  T0    - temperature from internal sensor in °C
      * -  H0    - humidity from internal sensor in % rel
      * -  T1..5 - temperature from external sensor 1..4 in °C
      * -  H1..5 - humidity from external sensor 1...4 in % rel
      * -  PRESS - air pressure in mBar
      * -  UV    - UV index from UV sensor
      * -  FC    - station forecast, see below for more details
      * -  STORM - stormwarning; 0 - no warning, 1 - fix your dog
      * -  WD    - wind direction in n x 22.5°; 0 -> north
      * -  WS    - wind speed in m/s
      * -  WG    - wind gust speed in m/s
      * -  WC    - windchill temperature in °C
      * -  RC    - rain counter (maybe since station starts measurement) as value
      *
      *
      * weather forecast means (as precisely as possible)
      * - 0 - heavy snow
      * - 1 - little snow
      * - 2 - heavy rain
      * - 3 - little rain
      * - 4 - cloudy
      * - 5 - some clouds
      * - 6 - sunny
      */
     $te_data = array();
     $status = explode(":", $status);
     $data = explode(":", $data);
     $cdata = count($data);
     $cstatus = count($status);
     $this->debug(__FUNCTION__, "Entered: Data:{$cdata},Status: {$cstatus}");
     //if (($cdata == 22) && ($cstatus == 13)) {
     $date = $data[0];
     $tsid = @$this->GetIDForIdent('TimeStamp');
     if ($tsid > 0) {
         SetValueInteger($tsid, $date);
     }
     $te_data['date'] = $date;
     //Indoor and Sensor1-5 T/H
     for ($s = 0; $s < self::MAXSENSORS; $s++) {
         $f = $s * 2 + 1;
         if (trim($data[$f]) == 'i') {
             continue;
         }
         $te_data[$s]['Id'] = "{$s}";
         $te_data[$s]['Temp'] = (double) $data[$f];
         if ($s > 0) {
             $batf = 13 - $s;
             if (isset($status[$batf])) {
                 $stat = $status[$batf] == '0' ? 'LOW' : 'OK';
                 $te_data[$s]['Battery'] = $stat;
             }
         }
         if (trim($data[$f + 1]) != 'i') {
             $te_data[$s]['Hum'] = (int) $data[$f + 1];
         }
         //todo
         $te_data[$s]['Typ'] = 'T/F';
         if ($s == 0) {
             $te_data[$s]['Typ'] = 'Indoor';
         } else {
             if (!isset($te_data[$s]['Hum'])) {
                 $te_data[$s]['Typ'] = 'T';
             }
//.........这里部分代码省略.........

作者:Tommi2Da    项目:ipsymcon-phpmodule-by-Tomm   
/**
  * inc Error counter
  */
 private function incError()
 {
     $vid = $this->GetIDForIdent('Errors');
     if ($vid) {
         $val = GetValueInteger($vid);
         SetValueInteger($vid, $val + 1);
     }
 }

作者:Nall-cha    项目:IPSXBeeZigBe   
public function ReceiveData($JSONString)
 {
     $Data = json_decode($JSONString);
     // Nur API Daten annehmen.
     //        IPS_LogMessage('ReceiveDataFromGateway:'.$this->InstanceID,  print_r($Data,1));
     if ($Data->DataID != '{0C541DDF-CE0F-4113-A76F-B4836015212B}') {
         return false;
     }
     $APIData = new TXB_API_Data();
     $APIData->GetDataFromJSONObject($Data);
     // Auf NodeNamen prüfen
     if ($APIData->NodeName != $this->ReadPropertyString('NodeName')) {
         return false;
     }
     switch ($APIData->APICommand) {
         case TXB_API_Command::XB_API_Transmit_Status:
             $TransmitStatusID = $this->GetIDForIdent("TransmitStatus");
             if (!$this->lock('Transmit_Status')) {
                 throw new Exception('Receive Transmit Status is locked');
             }
             $this->SendDebug('TX_Status_Received(8B)', $APIData->Data, 1);
             SetValueInteger($TransmitStatusID, ord($APIData->Data[1]));
             $this->unlock('Transmit_Status');
             break;
         case TXB_API_Command::XB_API_Receive_Paket:
             $Receive_Status = $APIData->Data[0];
             if ((ord($Receive_Status) & TXB_Receive_Status::XB_Receive_Packet_Acknowledged) == TXB_Receive_Status::XB_Receive_Packet_Acknowledged) {
                 $this->SendDebug('Receive_Paket(OK)', substr($APIData->Data, 1), 1);
                 $this->SendDataToChild(substr($APIData->Data, 1));
             } else {
                 $this->SendDebug('ReceivePaket(Error:' . bin2hex($Receive_Status) . ')', substr($APIData->Data, 1), 1);
             }
             break;
         case TXB_API_Command::XB_API_Remote_AT_Command_Responde:
             $ATData = new TXB_Command_Data();
             $ATData->ATCommand = substr($APIData->Data, 0, 2);
             $ATData->Status = $APIData->Data[2];
             $ATData->Data = substr($APIData->Data, 3);
             $this->SendDebug('Remote_AT_Command_Responde(' . $ATData->ATCommand . ')', $ATData->Data, 1);
             $this->SendDataToDevice($ATData);
             break;
         case TXB_API_Command::XB_API_IO_Data_Sample_Rx:
             $IOSample = new TXB_API_IO_Sample();
             $IOSample->Status = $APIData->Data[0];
             $IOSample->Sample = substr($APIData->Data, 1);
             $this->SendDebug('IO_Data_Sample_Rx(' . $APIData->APICommand . ')', $APIData->Data, 1);
             $this->SendDataToDevice($IOSample);
             break;
         default:
             /*
                               SendData('unhandle('+inttohex(ord(APIData.APICommand),2)+')',APIdata.Data);
             */
             break;
     }
     return true;
 }

作者:100    项目:Symcon1007_Withing   
protected function DoBlutdruck($ModulID, $data)
 {
     $diastolic = 0;
     $systolic = 0;
     $pulse = 0;
     $CatID = @IPS_GetCategoryIDByName("Blutdruck", $ModulID);
     if ($CatID === false) {
         return;
     }
     $time = @$data['measuregrps'][0]['date'];
     $data = @$data['measuregrps'][0]['measures'];
     if (count($data) != 3) {
         $this->Logging("Fehler bei DoBlutdruck " . count($data));
         //return;
     }
     $id = @IPS_GetVariableIDByName("DatumUhrzeit", $CatID);
     if ($id > 0) {
         $old = GetValueInteger($id);
         if ($old == $time) {
             // keine neue Daten
             return false;
         }
         SetValueInteger($id, $time);
     }
     foreach ($data as $messung) {
         $val = $messung['value'];
         if ($messung['type'] == 9) {
             $diastolic = $val;
         }
         if ($messung['type'] == 10) {
             $systolic = $val;
         }
         if ($messung['type'] == 11) {
             $pulse = $val;
         }
     }
     $id = IPS_GetVariableIDByName("Diastolic", $CatID);
     if ($id > 0) {
         SetValueInteger($id, $diastolic);
     }
     $id = IPS_GetVariableIDByName("Systolic", $CatID);
     if ($id > 0) {
         SetValueInteger($id, $systolic);
     }
     $id = IPS_GetVariableIDByName("Puls", $CatID);
     if ($id > 0) {
         SetValueInteger($id, $pulse);
     }
 }

作者:mcbeye    项目:SymconSono   
public function SetDefaultGroupVolume()
 {
     if (!$this->ReadPropertyBoolean("GroupCoordinator")) {
         die("This function is only allowed for GroupCoordinators");
     }
     $groupMembers = GetValueString(IPS_GetObjectIDByName("GroupMembers", $this->InstanceID));
     $groupMembersArray = array();
     if ($groupMembers) {
         $groupMembersArray = array_map("intval", explode(",", $groupMembers));
     }
     $groupMembersArray[] = $this->InstanceID;
     foreach ($groupMembersArray as $key => $ID) {
         try {
             SNS_SetDefaultVolume($ID);
         } catch (Exception $e) {
         }
     }
     $GroupVolume = 0;
     foreach ($groupMembersArray as $key => $ID) {
         $GroupVolume += GetValueInteger(IPS_GetObjectIDByName("Volume", $ID));
     }
     SetValueInteger(IPS_GetObjectIDByName("GroupVolume", $this->InstanceID), intval(round($GroupVolume / sizeof($groupMembersArray))));
 }

作者:Wolbola    项目:IPSymconAIOGatewa   
public function LEDOff()
 {
     $adress = $this->ReadPropertyString("Host");
     $command = "0101";
     SetValueInteger($this->GetIDForIdent('Farbe'), 4);
     IPS_LogMessage("LED Gateway:", "Aus");
     return $this->Set_LEDGW($adress, $command);
 }

作者:Vansda    项目:SymconHU   
public function SetValue($key, $value) {
    $stateId = IPS_GetObjectIDByIdent('STATE', $this->InstanceID);
    $cmId = IPS_GetObjectIDByIdent('COLOR_MODE', $this->InstanceID);
    $ctId = @IPS_GetObjectIDByIdent('COLOR_TEMPERATURE', $this->InstanceID);
    $briId = IPS_GetObjectIDByIdent('BRIGHTNESS', $this->InstanceID);
    $satId = @IPS_GetObjectIDByIdent('SATURATION', $this->InstanceID);
    $hueId = @IPS_GetObjectIDByIdent('HUE', $this->InstanceID);
    $colorId = @IPS_GetObjectIDByIdent('COLOR', $this->InstanceID);

    $stateValue = GetValueBoolean($stateId);
    $cmValue = $cmId ? GetValueInteger($cmId) : 0;
    $ctValue = $ctId ? (500 - round(347 * GetValueInteger($ctId) / 100)) : 0;
    $briValue = round(GetValueInteger($briId)*2.54);
    $satValue = $satId ? round(GetValueInteger($satId)*2.54) : 0;
    $hueValue = $hueId ? GetValueInteger($hueId) : 0;
    $colorValue = $colorId ? GetValueInteger($colorId) : 0;

    switch ($key) {
      case 'STATE':
        $stateNewValue = $value;
        break;
      case 'COLOR':
        $colorNewValue = $value;
        $stateNewValue = true;
        $hex = str_pad(dechex($value), 6, 0, STR_PAD_LEFT);
        $hsv = $this->HEX2HSV($hex);
        SetValueInteger($colorId, $value);
        $hueNewValue = $hsv['h'];
        $briNewValue = $hsv['v'];
        $satNewValue = $hsv['s'];
        $cmNewValue = 0;
        break;
      case 'BRIGHTNESS':
        $briNewValue = $value;
        $stateNewValue = true;
        if (IPS_GetProperty($this->InstanceID, 'LightFeatures') != 3) {
          if ($cmValue == '0') {
            $newHex = $this->HSV2HEX($hueValue, $satValue, $briNewValue);
            SetValueInteger($colorId, hexdec($newHex));
            $hueNewValue = $hueValue;
            $satNewValue = $satValue;
          } else {
            $ctNewValue = $ctValue;
          }
        }
        break;
      case 'SATURATION':
        $cmNewValue = 0;
        $satNewValue = $value;
        $stateNewValue = true;
        $newHex = $this->HSV2HEX($hueValue, $satNewValue, $briValue);
        SetValueInteger($colorId, hexdec($newHex));
        $hueNewValue = $hueValue;
        $briNewValue = $briValue;
        break;
      case 'COLOR_TEMPERATURE':
        $cmNewValue = 1;
        $ctNewValue = $value;
        $briNewValue = $briValue;
        break;
      case 'COLOR_MODE':
        $cmNewValue = $value;
        $stateNewValue = true;
        if ($cmNewValue == 1) {
          $ctNewValue = $ctValue;
          IPS_SetHidden($colorId, true);
          IPS_SetHidden($ctId, false);
          IPS_SetHidden($satId, true);
        } else {
          $hueNewValue = $hueValue;
          $satNewValue = $satValue;
          $briNewValue = $briValue;
          $newHex = $this->HSV2HEX($hueValue, $satValue, $briValue);
          SetValueInteger($colorId, hexdec($newHex));
          IPS_SetHidden($colorId, false);
          IPS_SetHidden($ctId, true);
          IPS_SetHidden($satId, false);
        }
        break;
    }

    $changes = array();
    if (isset($stateNewValue)) {
      SetValueBoolean($stateId, $stateNewValue);
      $changes['on'] = $stateNewValue;
    }
    if (isset($hueNewValue)) {
      SetValueInteger($hueId, $hueNewValue);
      $changes['hue'] = $hueNewValue;
    }
    if (isset($satNewValue)) {
      SetValueInteger($satId, round($satNewValue * 100 / 254));
      $changes['sat'] = $satNewValue;
    }
    if (isset($briNewValue)) {
      SetValueInteger($briId, round($briNewValue * 100 / 254));
      $changes['bri'] = $briNewValue;
    }
    if (isset($ctNewValue)) {
      SetValueInteger($ctId, 100 - round(($ctNewValue - 153) * 100 / 347));
//.........这里部分代码省略.........

作者:Wolbola    项目:IPSymconAIOGatewa   
public function SpeedDown()
 {
     $adress = $this->ReadPropertyString("LEDAdresse");
     $command = "C00";
     SetValueInteger($this->GetIDForIdent('Speed'), 1);
     return $this->Send_LED($adress, $command);
 }

作者:mcbeye    项目:SymconSono   
if ($sleeptimer) {
                $SleeptimerArray = explode(":", $sonos->GetSleeptimer());
                $SleeptimerMinutes = $SleeptimerArray[0] * 60 + $SleeptimerArray[1];
                if ($SleeptimerArray[2]) {
                    $SleeptimerMinutes = $SleeptimerMinutes + 1;
                }
            } else {
                $SleeptimerMinutes = 0;
            }
            SetValueInteger(IPS_GetObjectIDByName("Sleeptimer", IPS_GetParent($_IPS["SELF"])), $SleeptimerMinutes);
        }
    }
    $nowPlaying = GetValueString(IPS_GetObjectIDByName("nowPlaying", IPS_GetParent($_IPS["SELF"])));
    if ($actuallyPlaying != $nowPlaying) {
        SetValueString(IPS_GetObjectIDByName("nowPlaying", IPS_GetParent($_IPS["SELF"])), $actuallyPlaying);
    }
}
// Set Group Volume
if (IPS_GetProperty(IPS_GetParent($_IPS["SELF"]), "GroupCoordinator")) {
    $groupMembers = GetValueString(IPS_GetObjectIDByName("GroupMembers", IPS_GetParent($_IPS["SELF"])));
    $groupMembersArray = array();
    if ($groupMembers) {
        $groupMembersArray = array_map("intval", explode(",", $groupMembers));
    }
    $groupMembersArray[] = IPS_GetParent($_IPS["SELF"]);
    $GroupVolume = 0;
    foreach ($groupMembersArray as $key => $ID) {
        $GroupVolume += GetValueInteger(IPS_GetObjectIDByName("Volume", $ID));
    }
    SetValueInteger(IPS_GetObjectIDByName("GroupVolume", IPS_GetParent($_IPS["SELF"])), intval(round($GroupVolume / sizeof($groupMembersArray))));
}


问题


面经


文章

微信
公众号

扫码关注公众号