本文整理汇总了PHP中SetValueString函数的典型用法代码示例。如果您正苦于以下问题:PHP SetValueString函数的具体用法?PHP SetValueString怎么用?PHP SetValueString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetValueString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetValueString
protected function SetValueString($Ident, $Value)
{
$ID = $this->GetIDForIdent($Ident);
if (GetValueString($ID) != $Value) {
SetValueString($ID, strval($Value));
return true;
}
return false;
}
示例2: SetValueString
private function SetValueString($Ident, $value)
{
$id = $this->GetIDForIdent($Ident);
if (GetValueString($id) != $value) {
SetValueString($id, $value);
return true;
}
return false;
}
示例3: ReadService
public function ReadService() {
$serviceData = $this->request('/web/subservices');
if ($serviceData) {
$serviceName = utf8_decode((string)$serviceData->e2service->e2servicename);
$serviceReference = utf8_decode((string)$serviceData->e2service->e2servicereference);
if ($serviceName == 'N/A') $serviceName = '';
if ($serviceReference == 'N/A') $serviceReference = '';
SetValueString($this->GetIDForIdent('SERVICE_REFERENCE'), $serviceReference);
SetValueString($this->GetIDForIdent('SERVICE_NAME'), $serviceName);
}
}
示例4: SetVariable
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;
}
}
示例5: ReceiveData
public function ReceiveData($JSONString)
{
$data = json_decode($JSONString);
IPS_LogMessage('Logamatic <- Gateway:', bin2hex(utf8_decode($data->Buffer)));
$monitorID = $this->GetIDForIdent('Monitordaten');
$EinstellParID = $this->GetIDForIdent('EinstellPar');
$stream = bin2hex(utf8_decode($data->Buffer));
$datentyp = substr($stream, 0, 2);
$bus = substr($stream, 4, 2);
$modultyp = substr($stream, 8, 2);
switch ($datentyp) {
case 'a5':
// A5 Statusmeldung
IPS_LogMessage('Buderus Logamatic', 'ECO-CAN Adresse ' . $bus . ' is alive');
return true;
case 'a7':
// A7 Monitordaten Normalmodus
IPS_LogMessage('Buderus Logamatic', 'Monitordaten ECO-CAN Adresse ' . $bus . ' Normalmodus :' . $stream);
EncodeMonitorNormalData($stream, $this->InstanceID, chr($this->ReadPropertyString('Bus')));
break;
case 'a9':
// A9 Kennung für einstellbare Parameter
$head = GetValueString($EinstellParID);
$EinstellPar = $head . $stream;
SetValueString($EinstellParID, $EinstellPar);
break;
case 'aa':
// AA Einstellbare Parameter komplett übertragen
IPS_LogMessage('Buderus Logamatic', 'Einstellbare Parameter ECO-CAN Adresse ' . $bus . ' komplett :' . strlen(GetValueString($EinstellParID)) . ' Bytes');
EncodeEinstellParData(GetValueString($EinstellParID), $this->InstanceID, chr($this->ReadPropertyString('Bus')));
$data = chr(Command::Normalmodus) . chr($this->ReadPropertyString('Bus')) . chr(Command::NUL) . chr(Command::NUL);
$this->SendDataToParent($data);
// Umschalten in Normalmodus senden
break;
case 'ab':
// AB Monitordaten Direktmodus
$head = GetValueString($monitorID);
$Monitordaten = $head . $stream;
SetValueString($monitorID, $Monitordaten);
break;
case 'ac':
// AC Monitordaten komplett übertragen
//$monitordaten = GetValueString($monitorID);
IPS_LogMessage('Buderus Logamatic:', 'Monitordaten ECO-CAN Adresse ' . $bus . ' komplett :' . strlen(GetValueString($monitorID)) . ' Bytes\\n');
EncodeMonitorDirektData(GetValueString($monitorID), $this->InstanceID, chr($this->ReadPropertyString('Bus')));
$data = chr(Command::Normalmodus) . chr($this->ReadPropertyString('Bus')) . chr(Command::NUL) . chr(Command::NUL);
$this->SendDataToParent($data);
// Umschalten in Normalmodus senden
break;
case 'ad':
// AD Datenblock empfangen
IPS_LogMessage('Buderus Logamatic', 'Datenblock ' . $stream);
break;
}
$stream = '';
return true;
}
示例6: SendSwitchData
/**
* Forward Switch data to SwitchDev instances
* Create one if needed
* @param array $data
*/
private function SendSwitchData($data)
{
//parsing was OK, start distributing
$this->debug(__FUNCTION__, 'Prepare');
$class = __CLASS__ . "-SW";
$Device = $data['DeviceID'];
$typ = $data['Typ'];
$found = false;
$instID = 0;
$caps = "Switch;Dimmer;Timer;FS20;TimerActionCode";
$instances = IPS_GetInstanceListByModuleID($this->module_interfaces['SwitchDev']);
foreach ($instances as $instID) {
$I = IPS_GetInstance($instID);
$iid = (string) IPS_GetProperty($instID, 'DeviceID');
$ityp = (string) IPS_GetProperty($instID, 'Typ');
$iclass = (string) IPS_GetProperty($instID, 'Class');
$this->debug(__FUNCTION__, "Check my Device '{$Device}'' with Instance {$instID}({$iid})");
if ($I['ConnectionID'] == $this->InstanceID) {
//my child
if ($iid == $Device && $iclass == $class && $ityp == $typ) {
$this->debug(__FUNCTION__, 'Use existing ID:' . $instID);
$found = true;
break;
}
//if destdevice
}
//if
}
//for
if (!$found) {
//no free instance available, have to create a new one
if ($this->ReadPropertyBoolean('AutoCreate') == true) {
//new instance needed
$this->debug(__FUNCTION__, 'CREATE NEW Device');
$instID = $this->CreateSwitchDevice($data, $caps);
$found = true;
} else {
$this->debug(__FUNCTION__, 'Creating FS20 Device ID ' . $Device . ' disabled by Property AutoCreate');
IPS_LogMessage($class, 'Creating FS20 Device ID ' . $Device . ' disabled by Property AutoCreate');
}
//if autocreate
}
//if found
if ($found && $instID > 0) {
//send record to children
$json = json_encode(array("DataID" => $this->module_interfaces['SWD-RX'], "DeviceID" => $data['DeviceID'], "Typ" => $data['Typ'], "Class" => $class, "SWData" => $data));
$this->debug(__FUNCTION__, $json);
@$this->SendDataToChildren($json);
$datum = date('Y-m-d H:i:s', time());
$vid = @$this->GetIDForIdent('LastUpdate');
if ($vid) {
SetValueString($vid, $datum);
}
}
//found
}
示例7: SetGroup
public function SetGroup($groupCoordinator)
{
if ($this->ReadPropertyBoolean("GroupCoordinator")) {
return;
}
$ip = $this->ReadPropertyString("IPAddress");
$timeout = $this->ReadPropertyString("TimeOut");
if ($timeout && Sys_Ping($ip, $timeout) != true) {
throw new Exception("Sonos Box " . $ip . " is not available");
}
// get variable of coordinator members to be updated
if ($groupCoordinator) {
$groupMembersID = @IPS_GetObjectIDByIdent("GroupMembers", $groupCoordinator);
$uri = "x-rincon:" . IPS_GetProperty($groupCoordinator, "RINCON");
} else {
$groupMembersID = @IPS_GetObjectIDByIdent("GroupMembers", GetValue($this->GetIDForIdent("MemberOfGroup")));
$uri = "";
}
// update coordinator members
SetValue($this->GetIDForIdent("MemberOfGroup"), $groupCoordinator);
if ($groupMembersID) {
$currentMembers = explode(",", GetValueString($groupMembersID));
$currentMembers = array_filter($currentMembers, function ($v) {
return $v != "";
});
$currentMembers = array_filter($currentMembers, function ($v) {
return $v != $this->InstanceID;
});
if ($groupCoordinator) {
$currentMembers[] = $this->InstanceID;
}
SetValueString($groupMembersID, implode(",", $currentMembers));
}
// Set relevant variables to hidden/unhidden
if ($groupCoordinator) {
$hidden = true;
} else {
$hidden = false;
}
IPS_SetHidden($this->GetIDForIdent("nowPlaying"), $hidden);
IPS_SetHidden($this->GetIDForIdent("Radio"), $hidden);
IPS_SetHidden($this->GetIDForIdent("Playlist"), $hidden);
IPS_SetHidden($this->GetIDForIdent("Status"), $hidden);
IPS_SetHidden($this->GetIDForIdent("Sleeptimer"), $hidden);
include_once __DIR__ . "/sonosAccess.php";
(new SonosAccess($ip))->SetAVTransportURI($uri);
}
示例8: WaitForResponse
private function WaitForResponse($APIData_Command)
{
$ReplyAPIDataID = $this->GetIDForIdent('ReplyAPIData');
for ($i = 0; $i < 300; $i++) {
if (GetValueString($ReplyAPIDataID) === '') {
IPS_Sleep(5);
} else {
if ($this->lock('ReplyAPIData')) {
$ret = GetValueString($ReplyAPIDataID);
SetValueString($ReplyAPIDataID, '');
$this->unlock('ReplyAPIData');
$JSON = json_decode($ret);
$APIData = new ISCP_API_Data();
$APIData->GetDataFromJSONObject($JSON);
if ($APIData_Command == $APIData->APICommand) {
return $APIData;
} else {
$i = $i - 100;
if ($i < 0) {
$i = 0;
}
}
}
}
}
if ($this->lock('ReplyAPIData')) {
SetValueString($ReplyAPIDataID, '');
$this->unlock('ReplyAPIData');
}
return false;
}
示例9: SendWSData
//.........这里部分代码省略.........
$id = $weather_data['records'][$Device]['id'];
$typ = $weather_data['records'][$Device]['typ'];
//$sensor=$weather_data['records'][$Device]['sensor'];
$temp = $weather_data['records'][$Device]['temp'];
$hum = $weather_data['records'][$Device]['hum'];
$data['Id'] = $id;
$data['Typ'] = $typ;
$data['Date'] = $datum;
$caps = "Temp";
$data['Temp'] = $temp;
if ($typ == 'T/F') {
$data['Hum'] = $hum;
$caps .= ";Hum";
}
if ($Device < 9) {
//innensensor hat keinenbatteryanzeige
$lost = $weather_data['records'][$Device]['lost'];
$bat = $weather_data['records'][$Device]['battery'];
$data["Battery"] = $bat;
$data["Lost"] = $lost;
$caps .= ";Battery;Lost";
}
if ($Device == 8) {
$rain = $weather_data['rain'];
$rainc = $weather_data['rainc'];
$israining = $weather_data['israining'];
$wind = $weather_data['wind'];
$typ = 'Kombisensor';
$data['Typ'] = $typ;
$data['Rain'] = $rain;
$data['RainCounter'] = $rainc;
$data['IsRaining'] = $israining;
$data['Wind'] = $wind;
$caps .= ";Wind;Rain;IsRaining;RainCounter";
}
if ($Device == 9) {
$typ = 'Indoor';
$press = $weather_data['press'];
$willi = $weather_data['willi'];
$data['Typ'] = $typ;
$data["Press"] = $press;
$data['Forecast'] = $willi;
$caps .= ";Hum;Press;Forecast";
}
if (strlen($temp) == 0) {
continue;
//nothing to send
}
//if temp
//$this->debug(__FUNCTION__, "Sensor: $id Caps: $caps Data:" . print_r($data, true));
$found = false;
$instID = 0;
$instances = IPS_GetInstanceListByModuleID($this->module_interfaces['WSDEV']);
foreach ($instances as $instID) {
$I = @IPS_GetInstance($instID);
if ($I && $I['ConnectionID'] == $this->InstanceID) {
//my child
$iid = (string) IPS_GetProperty($instID, 'DeviceID');
$ityp = (string) IPS_GetProperty($instID, 'Typ');
$class = (string) IPS_GetProperty($instID, 'Class');
if ($iid == $Device && $ityp == $typ && $class == __CLASS__) {
$this->debug(__FUNCTION__, 'Use existing ID:' . $instID);
$found = true;
break;
}
//if destdevice
}
//if
}
//for
if (!$found) {
//no free instance available, have to create a new one
if ($this->ReadPropertyBoolean('AutoCreate') == true) {
//new instance needed
$instID = $this->CreateWSDevice($data, $caps);
if ($instID > 0) {
//new instance needed
$this->debug(__FUNCTION__, 'CREATE Device with Caps: ' . $caps);
$found = true;
}
} else {
$this->debug(__FUNCTION__, 'Creating Device ID ' . $Device . ' disabled by Property AutoCreate');
IPS_LogMessage(__CLASS__, 'Creating Device ID ' . $Device . ' disabled by Property AutoCreate');
}
//if autocreate
}
//if found
if ($found && $instID > 0) {
//send record to children
$json = json_encode(array("DataID" => $this->module_interfaces['WS-RX'], "DeviceID" => $Device, "Typ" => $typ, "Class" => __CLASS__, "WSData" => $data));
$this->debug(__FUNCTION__, $json);
@$this->SendDataToChildren($json);
}
//found
}
//for
$this->debug(__FUNCTION__, 'Finished');
$vid = $this->GetIDForIdent('LastUpdate');
SetValueString($vid, $datum);
}
示例10: ParseData
/**
* parsing 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 'Hum':
//hum
//hum
case 'RainCounter':
//raincounter
//raincounter
case 'Press':
//pressure
//pressure
case 'Forecast':
//willi
//willi
case 'UV':
//UVIndex
//UVIndex
case 'Light':
//Brightness
//Brightness
case 'Level':
//level
//level
case 'TS':
//TimeStamp
//TimeStamp
case 'Lost':
//lost
//lost
case 'Signal':
if (strlen($s) == 0) {
continue;
}
$iv = (int) $s;
SetValueInteger($vid, $iv);
break;
//float
//float
case 'Temp':
//temp
//temp
case 'Wind':
//wind
//wind
case 'WindChill':
//wind
//wind
case 'WindGust':
//wind
//wind
case 'WindDir':
//wind
//wind
case 'Rain':
//rain
//rain
case 'RainDaily':
//rain this day
//rain this day
case 'RainHourly':
//rain 1h
//rain 1h
case 'RainLastDay':
//rain 24h
if (strlen($s) == 0) {
continue;
}
$fv = (double) $s;
SetValueFloat($vid, $fv);
break;
//String
//String
case 'Name':
//
$st = utf8_decode($s);
SetValueString($vid, $st);
break;
//special
//special
case 'IsRaining':
//.........这里部分代码省略.........
示例11: EncodeMonitorNormalData
function EncodeMonitorNormalData($Monitordaten, $ID, $Bus)
{
$Bus = 1;
$array = str_split($Monitordaten, 24);
for ($x = 0; $x < count($array); $x++) {
if (substr($array[$x], 0, 2) == 'a7') {
$typ = ord(hex2bin(substr($array[$x], 8, 2)));
if ($Bus === ord(hex2bin(substr($array[$x], 4, 2)))) {
IPS_LogMessage('Buderus Logamatic', 'ECO-CAN Adresse ' . $Bus . ' Array: ' . $array[$x]);
$offset = ord(hex2bin(substr($array[$x], 12, 2)));
$substring = substr($array[$x], 16, 2);
IPS_LogMessage('Buderus Logamatic', 'ECO-CAN Adresse ' . $Bus . ' Data: ' . $typ . ' : ' . $offset . ' : ' . $substring);
$var = CheckVariable($typ, -1, 0, $ID);
$value = GetValueString($var);
$newvalue = substr_replace($value, $substring, $offset * 2, 2);
SetValueString($var, $newvalue);
EncodeVariableData($ID, $typ);
} else {
IPS_LogMessage('Logamatic Gateway', 'EncodeMonitorNormalData für falsche Bus-Adresse');
}
}
}
return true;
}
示例12: SetValueString
private function SetValueString($Ident, $value)
{
$id = $this->GetIDForIdent($Ident);
if (GetValueString($id) != $value) {
SetValueString($id, $value);
}
}
示例13: SetValueString
protected function SetValueString($Ident, $value)
{
$id = $this->GetIDForIdent($Ident);
SetValueString($id, $value);
}
示例14: ProcessData
public function ProcessData()
{
$error = false;
$Content = "";
//CommandList processing
$CommandListString = "";
if ($this->Debug) {
echo "working on CommandList...";
}
foreach ($this->CommandList as $key => $value) {
$temp = implode("#=#", $value);
if (strlen($CommandListString) > 0) {
$CommandListString = $CommandListString . "#+#" . $key . "#-#" . $temp;
} else {
$CommandListString = $key . "#-#" . $temp;
}
if (!isset($this->FeedbackList[$key])) {
echo "Error, missing Feedback entry for Command '" . $key . "'\n";
$error = true;
}
if (!isset($this->ExampleList[$key])) {
echo "Error, missing Example entry for Command '" . $key . "'\n";
$error = true;
}
}
//echo "CommandListString:".$CommandListString."\n";
if ($this->Debug) {
echo "processed!\n";
}
//FeedbackList processiong
$FeedbackListString = "";
if ($this->Debug) {
echo "working on FeedbackList...";
}
foreach ($this->FeedbackList as $key => $value) {
if (strlen($FeedbackListString) > 0) {
$FeedbackListString = $FeedbackListString . "#+#" . $key . "#-#" . $value;
} else {
$FeedbackListString = $key . "#-#" . $value;
}
}
if ($this->Debug) {
echo "...processed!\n";
}
//ExampleList processiong
$ExampleListString = "";
if ($this->Debug) {
echo "working on ExampleListString...";
}
foreach ($this->ExampleList as $key => $value) {
if (strlen($ExampleListString) > 0) {
$ExampleListString = $ExampleListString . "#+#" . $key . "#-#" . $value;
} else {
$ExampleListString = $key . "#-#" . $value;
}
}
if ($this->Debug) {
echo "processed!\n";
}
//PhraseList processing
$PhraseListString = "";
if ($this->Debug) {
echo "working on PhraseList...";
}
foreach ($this->PhraseList as $key => $value) {
$temp = implode("#=#", $value);
if (strlen($PhraseListString) > 0) {
$PhraseListString = $PhraseListString . "#+#" . $key . "#-#" . $temp;
} else {
$PhraseListString = $key . "#-#" . $temp;
}
}
if ($this->Debug) {
echo "processed!\n";
}
if ($error) {
SetValueString($this->id, "");
echo "Error while processing data - nothing written!\n";
} else {
$Content = $CommandListString . "#*#" . $FeedbackListString . "#*#" . $ExampleListString . "#*#" . $PhraseListString;
$Content = $this->convertForOutput($Content);
SetValueString($this->InstanceID, $Content);
echo "Data successful written\n";
if (IPS_ModuleExists("{44D8BE09-743E-484F-A64D-154C4235BE94}")) {
ips4WNS_sendRawNotification(0, null, "ips4Windows#CortanaRefresh");
}
}
}
示例15: SendEnData
/**
* Forward data to EnergyDev instances
* Create one if needed
* @param array $data
* @param string $caps
*/
private function SendEnData($data, $caps)
{
//parsing was OK, start distributing
$this->debug(__FUNCTION__, 'Prepare');
$class = $data['Class'];
$id = $data['Id'];
$typ = $data['Typ'];
$found = false;
$instID = 0;
$instances = IPS_GetInstanceListByModuleID($this->module_interfaces['EnergyDev']);
foreach ($instances as $instID) {
$I = IPS_GetInstance($instID);
$iid = (string) IPS_GetProperty($instID, 'DeviceID');
$ityp = (string) IPS_GetProperty($instID, 'Typ');
$iclass = (string) IPS_GetProperty($instID, 'Class');
if ($I['ConnectionID'] == $this->InstanceID) {
//my child
if ($iid == $id && $iclass == $class && $ityp == $typ) {
$this->debug(__FUNCTION__, 'Use existing ID:' . $instID);
$found = true;
break;
}
//if destdevice
}
//if
}
//for
if (!$found) {
//no free instance available, have to create a new one
if ($this->ReadPropertyBoolean('AutoCreate') == true) {
//new instance needed
$this->debug(__FUNCTION__, 'CREATE NEW Device');
$instID = $this->CreateENDevice($data, $caps);
$found = true;
} else {
$this->debug(__FUNCTION__, 'Creating Device ID ' . $id . ' disabled by Property AutoCreate');
IPS_LogMessage($class, 'Creating Device ID ' . $id . ' disabled by Property AutoCreate');
}
//if autocreate
}
//if found
//drop counterfactor from data
if (isset($data['CounterFactor'])) {
unset($data['CounterFactor']);
}
if ($found && $instID > 0) {
//send record to children
$json = json_encode(array("DataID" => $this->module_interfaces['EN-RX'], "DeviceID" => $data['Id'], "Typ" => $data['Typ'], "Class" => $class, "ENData" => $data));
$this->debug(__FUNCTION__, $json);
@$this->SendDataToChildren($json);
$datum = date('Y-m-d H:i:s', time());
$vid = @$this->GetIDForIdent('LastUpdate');
if ($vid) {
SetValueString($vid, $datum);
}
}
//found
}