本文整理匯總了PHP中IPS_GetObjectIDByIdent函數的典型用法代碼示例。如果您正苦於以下問題:PHP IPS_GetObjectIDByIdent函數的具體用法?PHP IPS_GetObjectIDByIdent怎麽用?PHP IPS_GetObjectIDByIdent使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了IPS_GetObjectIDByIdent函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: CreateVariable
function CreateVariable($Name, $Type, $Value, $Ident = '', $ParentID = 0)
{
echo "CreateVariable: ( {$Name}, {$Type}, {$Value}, {$Ident}, {$ParentID} ) \n";
if ('' != $Ident) {
$VarID = @IPS_GetObjectIDByIdent($Ident, $ParentID);
if (false !== $VarID) {
SetVariable($VarID, $Type, $Value);
return;
}
}
$VarID = @IPS_GetObjectIDByName($Name, $ParentID);
if (false !== $VarID) {
$Obj = IPS_GetObject($VarID);
if (2 == $Obj['ObjectType']) {
$Var = IPS_GetVariable($VarID);
if ($Type == $Var['VariableValue']['ValueType']) {
SetVariable($VarID, $Type, $Value);
return;
}
}
}
$VarID = IPS_CreateVariable($Type);
IPS_SetParent($VarID, $ParentID);
IPS_SetName($VarID, $Name);
if ('' != $Ident) {
IPS_SetIdent($VarID, $Ident);
}
SetVariable($VarID, $Type, $Value);
}
示例2: GenerateMediaObjectEx
public function GenerateMediaObjectEx(string $Text, int $MediaID, string $Format, string $Codec, string $Language)
{
if ($MediaID == 0) {
$MediaID = @IPS_GetObjectIDByIdent('Voice', $this->InstanceID);
}
if ($MediaID > 0) {
if (IPS_MediaExists($MediaID) === false) {
trigger_error('MediaObject not exists.', E_USER_NOTICE);
}
return false;
if (IPS_GetMedia($MediaID)['MediaType'] != 2) {
trigger_error('Wrong MediaType', E_USER_NOTICE);
}
return false;
}
$raw = $this->LoadTTSFile($Text, '', 0, $Format, $Codec, $Language, true);
if ($raw === false) {
return false;
}
if ($MediaID === false) {
$MediaID = IPS_CreateMedia(2);
IPS_SetMediaCached($MediaID, true);
IPS_SetName($MediaID, 'Voice');
IPS_SetParent($MediaID, $this->InstanceID);
IPS_SetIdent($MediaID, 'Voice');
}
$Filename = 'media' . DIRECTORY_SEPARATOR . $MediaID . '.' . strtolower($Codec);
IPS_SetMediaFile($MediaID, $Filename, False);
IPS_SetMediaContent($MediaID, base64_encode($raw));
IPS_SetInfo($MediaID, $Text);
return $MediaID;
}
示例3: RegisterTimer
protected function RegisterTimer($ident, $interval, $script) {
$id = @IPS_GetObjectIDByIdent($ident, $this->InstanceID);
if ($id && IPS_GetEvent($id)['EventType'] <> 1) {
IPS_DeleteEvent($id);
$id = 0;
}
if (!$id) {
$id = IPS_CreateEvent(1);
IPS_SetParent($id, $this->InstanceID);
IPS_SetIdent($id, $ident);
}
IPS_SetName($id, $ident);
IPS_SetHidden($id, true);
IPS_SetEventScript($id, "\$id = \$_IPS['TARGET'];\n$script;");
if (!IPS_EventExists($id)) throw new Exception("Ident with name $ident is used for wrong object type");
if (!($interval > 0)) {
IPS_SetEventCyclic($id, 0, 0, 0, 0, 1, 1);
IPS_SetEventActive($id, false);
} else {
IPS_SetEventCyclic($id, 0, 0, 0, 0, 1, $interval);
IPS_SetEventActive($id, true);
}
}
示例4: ExecuteButton
/**
* @public
*
* Ermöglicht das Verarbeiten eines Taster Signals
*
*/
public function ExecuteButton () {
$device = new IPSShadowing_Device($this->instanceId);
$movementId = GetValue(IPS_GetObjectIDByIdent(c_Control_Movement, $this->instanceId));
if ($movementId==c_MovementId_MovingIn or $movementId==c_MovementId_MovingOut or $movementId==c_MovementId_Up or $movementId==c_MovementId_Down) {
$device->MoveByControl(c_MovementId_Stop);
} else {
$device->MoveByControl($this->movementId);
}
}
示例5: CreateVariableByIdent
private function CreateVariableByIdent($id, $ident, $name, $type, $profile = "")
{
$vid = @IPS_GetObjectIDByIdent($ident, $id);
if ($vid === false) {
$vid = IPS_CreateVariable($type);
IPS_SetParent($vid, $id);
IPS_SetName($vid, $name);
IPS_SetIdent($vid, $ident);
if ($profile != "") {
IPS_SetVariableCustomProfile($vid, $profile);
}
}
return $vid;
}
示例6: SyncPosition
/**
* @public
*
* Ermöglicht die Synchronisation der aktuellen Position der Beschattung
*
* @param string $position Aktuelle Position der Beschattung (Wertebereich 0-100)
*/
public function SyncPosition($position, IPSComponentShutter $componentToSync) {
$componentParamsToSync = $componentToSync->GetComponentParams();
$deviceConfig = get_ShadowingConfiguration();
foreach ($deviceConfig as $deviceIdent=>$deviceData) {
$componentConfig = IPSComponent::CreateObjectByParams($deviceData[c_Property_Component]);
$componentParamsConfig = $componentConfig->GetComponentParams();
if ($componentParamsConfig==$componentParamsToSync) {
$categoryIdDevices = IPSUtil_ObjectIDByPath('Program.IPSLibrary.data.modules.IPSShadowing.Devices');
$deviceId = IPS_GetObjectIDByIdent($deviceIdent, $categoryIdDevices);
$device = new IPSShadowing_Device($deviceId);
$device->MoveByEvent($position);
}
}
}
示例7: IPSUtil_ObjectIDByPath
/** ObjektId aus Pfad ermittlen
*
* Der Befehl ermittelt aus einer Pfadangabe (zB. "IPSLibrary.IPSUtils.IPSUtils.inc.php") die ID des Scriptes
*
* @param string $path Pfadangabe
* @param string $returnFalse wenn true, retouniert die Funktion false wenn das übergebene Object nicht gefunden wurde
* @return integer ID des Objektes
*
*/
function IPSUtil_ObjectIDByPath($path, $returnFalse=false) {
$categoryList = explode('.',$path);
if (count($categoryList)==1 and is_numeric($categoryList[0])) {
return (int)$categoryList[0];
}
$objId = 0;
$parentId = 0;
foreach ($categoryList as $idx=>$category) {
$objId = @IPS_GetObjectIDByIdent($category, $parentId);
if ($objId===false) {
$objId=@IPS_GetObjectIDByName($category, $parentId);
}
if ($objId===false) {
if ($returnFalse) {
return false;
} else {
throw new IPSUtilException('"'.$category.'" could NOT be found while searching for Path '.$path);
}
}
$parentId = $objId;
}
return $objId;
}
示例8: GetState
/**
* @public
*
* Liefert aktuellen Zustand
*
* @return boolean aktueller Schaltzustand
*/
public function GetState() {
if ($this->b_class_multi and ($this->channel > 0))
$id = @IPS_GetObjectIDByIdent("MultiInstance".$this->channel."Variable",(int)$this->instanceId);
else
$id = @IPS_GetObjectIDByIdent("DataVariableBoolean",(int)$this->instanceId);
if ($id > 0)
return GetValue($id);
else
return false;
}
示例9: CreateENDevice
/**
* Create a new EneryDev instance and set its properties
* @param array $data parsed record
* @param String $caps String semicolon seperated capabilities of this device
* @return int new Instance ID
*/
private function CreateENDevice($data, $caps)
{
$instID = 0;
$class = $data['Class'];
$Device = $data['Id'];
$typ = $data['Typ'];
$ModuleID = $this->module_interfaces['EnergyDev'];
if (IPS_ModuleExists($ModuleID)) {
//return $result;
$this->debug(__FUNCTION__, 'Device:' . $Device);
$instID = IPS_CreateInstance($ModuleID);
if ($instID > 0) {
IPS_SetProperty($instID, 'DeviceID', $Device);
IPS_SetProperty($instID, 'Class', $class);
IPS_SetProperty($instID, 'Typ', $typ);
IPS_SetProperty($instID, 'CapList', $caps);
IPS_SetProperty($instID, 'Debug', $this->isDebug());
//follow debug settings from splitter
IPS_SetName($instID, "{$typ} Device " . $Device);
$ident = $class . "_" . $typ . "_" . $Device;
$ident = preg_replace("/\\W/", "_", $ident);
//nicht-Buchstaben/zahlen entfernen
IPS_SetIdent($instID, $ident);
IPS_ConnectInstance($instID, $this->InstanceID);
IPS_ApplyChanges($instID);
//set factor
if (isset($data['CounterFactor'])) {
IPS_SetProperty($instID, 'CounterFactor', floatval($data['CounterFactor']));
$this->debug(__FUNCTION__, 'Set Counterfactor=' . $data['CounterFactor']);
}
//set category
$cat = $this->GetCategory();
$pcat = $this->GetParentCategory();
$ident = preg_replace("/\\W/", "_", $cat);
//fix naming
$catid = @IPS_GetObjectIDByIdent($ident, $pcat);
if ($catid == 0) {
$catid = IPS_CreateCategory();
IPS_SetName($catid, $cat);
if (IPS_SetIdent($catid, $ident) && IPS_SetParent($catid, $pcat)) {
IPS_LogMessage($class, "Category {$cat} Ident {$ident} ({$catid}) created");
} else {
IPS_LogMessage($class, "Category {$cat} Ident {$ident} ({$catid}) FAILED");
}
}
$this->debug(__FUNCTION__, "Category:{$catid}");
if (!IPS_SetParent($instID, $catid)) {
$this->debug(__FUNCTION__, "SetParent Instance {$instID} to Cat {$catid} failed, Dropping instance");
IPS_DeleteInstance($instID);
$instID = 0;
} else {
$this->debug(__FUNCTION__, 'New ID:' . $instID);
}
//parent
if (IPS_HasChanges($instID)) {
IPS_ApplyChanges($instID);
}
} else {
$this->debug(__FUNCTION__, 'Instance is not created!');
}
//if instID
}
//module exists
return $instID;
}
示例10: UnregisterTimer
protected function UnregisterTimer($Name)
{
$id = @IPS_GetObjectIDByIdent($Name, $this->InstanceID);
if ($id > 0) {
if (!IPS_EventExists($id)) {
throw new Exception('Timer not present', E_USER_NOTICE);
}
IPS_DeleteEvent($id);
}
}
示例11: HandleError
private function HandleError($result) {
if ($result==false) {
$errorMessage = GetValue(IPS_GetObjectIDByIdent(AM_VAR_LASTERROR, $this->instanceId));
trigger_error($errorMessage);
}
}
示例12: RegisterEvent
protected function RegisterEvent($Name, $Source, $Script)
{
$id = @IPS_GetObjectIDByIdent($Name, $this->InstanceID);
if ($id === false) {
$id = 0;
}
if ($id > 0) {
if (!IPS_EventExists($id)) {
throw new Exception("Ident with name " . $Name . " is used for wrong object type", E_USER_WARNING);
}
if (IPS_GetEvent($id)['EventType'] != 0) {
IPS_DeleteEvent($id);
$id = 0;
}
}
if ($id == 0) {
$id = IPS_CreateEvent(0);
IPS_SetParent($id, $this->InstanceID);
IPS_SetIdent($id, $Name);
}
IPS_SetName($id, $Name);
IPS_SetHidden($id, true);
IPS_SetEventScript($id, $Script);
if ($Source > 0) {
IPS_SetEventTrigger($id, 0, $Source);
if (!IPS_GetEvent($id)['EventActive']) {
IPS_SetEventActive($id, true);
}
} else {
IPS_SetEventTrigger($id, 0, 0);
if (IPS_GetEvent($id)['EventActive']) {
IPS_SetEventActive($id, false);
}
}
}
示例13: IPSUtils_Include
</head>
<body >
<a href="#" onClick=trigger_button('Refresh','','')>Refresh</a> |
<a href="#" onClick=trigger_button('Overview','','')>Übersicht</a> |
<a href="#" onClick=trigger_button('Logs','','')>Log File's</a> |
<a href="#" onClick=trigger_button('Updates','','')>Update's</a> |
<a href="#" onClick=trigger_button('NewModule','','')>Neues Modul</a>
<BR>
<BR>
<?php
IPSUtils_Include("IPSModuleManagerGUI.inc.php", "IPSLibrary::app::modules::IPSModuleManagerGUI");
$baseId = IPSUtil_ObjectIDByPath('Program.IPSLibrary.data.modules.IPSModuleManagerGUI');
$action = GetValue(IPS_GetObjectIDByIdent(IPSMMG_VAR_ACTION, $baseId));
$module = GetValue(IPS_GetObjectIDByIdent(IPSMMG_VAR_MODULE, $baseId));
$info = GetValue(IPS_GetObjectIDByIdent(IPSMMG_VAR_INFO, $baseId));
$processing = !IPSModuleManagerGUI_GetLock();
if (!$processing) {
IPSModuleManagerGUI_ReleaseLock();
}
switch ($action) {
case IPSMMG_ACTION_OVERVIEW:
include 'IPSModuleManagerGUI_Overview.php';
break;
case IPSMMG_ACTION_UPDATES:
include 'IPSModuleManagerGUI_Updates.php';
break;
case IPSMMG_ACTION_MODULE:
include 'IPSModuleManagerGUI_Module.php';
break;
case IPSMMG_ACTION_WIZARD:
示例14: CreateInstanceByIdent
private function CreateInstanceByIdent($id, $ident, $name, $moduleid = "{485D0419-BE97-4548-AA9C-C083EB82E61E}")
{
$iid = @IPS_GetObjectIDByIdent($ident, $id);
if ($iid === false) {
$iid = IPS_CreateInstance($moduleid);
IPS_SetParent($iid, $id);
IPS_SetName($iid, $name);
IPS_SetIdent($iid, $ident);
}
return $iid;
}
示例15: SetTimerInterval
protected function SetTimerInterval($Name, $Interval)
{
$id = @IPS_GetObjectIDByIdent($Name, $this->InstanceID);
if ($id === false) {
throw new Exception('Timer not present');
}
if (!IPS_EventExists($id)) {
throw new Exception('Timer not present');
}
$Event = IPS_GetEvent($id);
if ($Interval < 1) {
if ($Event['EventActive']) {
IPS_SetEventActive($id, false);
}
} else {
if ($Event['CyclicTimeValue'] != $Interval) {
IPS_SetEventCyclic($id, 0, 0, 0, 0, 1, $Interval);
}
if (!$Event['EventActive']) {
IPS_SetEventActive($id, true);
}
}
}