private function unlock($ident) { IPS_SemaphoreLeave("LMS_" . (string) $this->InstanceID . (string) $ident); }
public function SendMsg(string $Text, integer $Type, integer $Timeout) { if ($this->GetPowerState() == 1) { if (IPS_SemaphoreEnter("Enigma2BY_SendMsg", 20000)) { $IP = $this->ReadPropertyString("Enigma2IP"); $WebPort = $this->ReadPropertyInteger("Enigma2WebPort"); $Text = urlencode(trim($Text)); $Text = str_replace('%A7', '%0A', $Text); $url = "http://" . $IP . ":" . $WebPort . "/web/message?text=" . $Text . "&type=" . $Type . "&timeout=" . $Timeout; $xml = @simplexml_load_file($url); $result = $this->ResultAuswerten($xml->e2state); if ($Type == 0) { $this->SendKey("ArrowDown", "short"); IPS_Sleep($Timeout * 1000 + 1000); $xml = @simplexml_load_file("http://" . $IP . ":" . $WebPort . "/web/messageanswer?getanswer=now"); if (trim($xml->e2statetext) == "Answer is NO!" or trim($xml->e2statetext) == "Antwort lautet NEIN!") { $AntwortINT = 0; } elseif (trim($xml->e2statetext) == "Answer is YES!" or trim($xml->e2statetext) == "Antwort lautet JA!") { $AntwortINT = 1; } elseif (trim($xml->e2statetext) == "No answer in time" or trim($xml->e2statetext) == "Keine rechtzeitige Antwort") { $AntwortINT = 2; if ($this->DistroCheck() == true) { $this->SendKey("Exit", "short"); } else { $this->SendKey("OK", "short"); } } $this->SetValueInteger("FrageAntwortVAR", $AntwortINT); IPS_SemaphoreLeave("Enigma2BY_SendMsg"); return $AntwortINT; } IPS_SemaphoreLeave("Enigma2BY_SendMsg"); return $result; } else { return false; } } else { return false; } }
$eventName = IPS_GetName($_IPS['EVENT']); foreach (IPSEDIP_GetConfiguration() as $configId=>$configData) { if (substr($eventName,0,strlen($configId))==$configId) { if ($configData[EDIP_CONFIG_REFRESHMETHOD]==EDIP_REFRESHMETHOD_EVENT or $configData[EDIP_CONFIG_REFRESHMETHOD]==EDIP_REFRESHMETHOD_BOTH) { $result = IPS_SemaphoreEnter($configId, 0); if (!$result) { IPSLogger_Trc(__file__, "Refresh is already in Process - ignore ..."); return; } IPSLogger_Trc(__file__, "Refresh EDIP by Event=$eventName"); IPS_Sleep(1000); IPS_SemaphoreLeave($configId); $instanceClass = $configData[EDIP_CONFIG_CLASSNAME]; $instanceId = IPS_GetObjectIDByIdent($configId, EDIP_ID_PROGRAM); include_once $instanceClass.'.class.php'; $edip = new $instanceClass($instanceId); $edip->RefreshDisplay(); } } } /** @}*/ ?>
/** * WriteSingleRegister * @param integer $UnitId * @param integer $Reference * @param integer $Data */ protected function WriteSingleRegister($UnitId, $Reference, $Data) { include_once __DIR__ . "/lib/ModbusMaster.php"; $URL = "http://" . $this->ReadPropertyString("IPAddress"); //$headers = @get_headers($URL); if (!Sys_Ping($this->ReadPropertyString("IPAddress"), 1000)) { $this->SetStatus(201); trigger_error("Invalid IP-Address", E_USER_ERROR); exit; } $this->SetStatus(102); if ($this->ReadPropertyInteger("GatewayMode") === 0) { $modbus = new ModbusMasterTcp($this->ReadPropertyString("IPAddress")); } else { $modbus = new ModbusMasterUdp($this->ReadPropertyString("IPAddress")); } //FC 6 try { if (IPS_SemaphoreEnter("ModbusMaster", 1000)) { $this->Log("WriteSingleRegister({$UnitId}|{$Reference}|{$Data})"); $modbus->writeSingleRegister($UnitId, $Reference, array($Data), array("INT")); IPS_SemaphoreLeave("ModbusMaster"); } } catch (Exception $e) { $this->SetStatus(200); trigger_error("ModbusMaster: " . $e->getMessage() . "!", E_USER_ERROR); exit; } }
function IPSModuleManagerGUI_ReleaseLock() { $result = IPS_SemaphoreLeave('IPSModuleManagerGUI'); return $result; }
private function unlock($ident) { IPS_SemaphoreLeave('Logamatic_' . (string) $this->InstanceID . (string) $ident); }
/** * Leave/unlock Semaphore * @param $resource */ protected function SemLeave($resource) { IPS_SemaphoreLeave($this->name . "-" . $resource); }
Entertainment_ReceiveData(array(c_Comm_NetPlayer, 'netplayer', 'poweron'), c_MessageType_Info); } else { Entertainment_ReceiveData(array(c_Comm_NetPlayer, 'netplayer', 'poweroff'), c_MessageType_Info); } break; case 'RemoteControl': $ControlId = get_ControlIdByDeviceName(c_Device_NetPlayer, c_Control_RemoteSourceType); if (GetValue(NP_ID_CONTROLTYPE) <> GetValue($ControlId)) { IPSLogger_Com(__file__, "Receive RemoteControlType ".GetValue(NP_ID_CONTROLTYPE)." for NetPlayer"); Entertainment_ReceiveData(array(c_Comm_NetPlayer, 'netplayertype', (string)GetValue(NP_ID_CONTROLTYPE)), c_MessageType_Info); } else { Entertainment_RefreshRemoteControlByDeviceName(c_Device_NetPlayer); } break; case 'MobileControl': //Entertainment_RefreshRemoteControlByDeviceName(c_Device_NetPlayer, c_Control_iRemoteSource); break; case 'ControlType': //IPSLogger_Com(__file__, "Receive RemoteControlType $IPS_VALUE for NetPlayer"); //Entertainment_ReceiveData(array(c_Comm_NetPlayer, 'netplayertype', (string)$IPS_VALUE), c_MessageType_Info); break; default: IPSLogger_Err(__file__, "Unknown Variable $variableName"); Exit; } } IPS_SemaphoreLeave('NetPlayer'); /** @}*/ ?>