10:40:06 | 00000 | WARNING | ScriptEngine | Ergebnis für ScriptID #32123: <br />
<b>Warning</b>: Parameter type of ID does not match in <b>/usr/share/symcon/scripts/ObjIDsIPS.ind.inc.php</b> on line <b>233</b><br />
Bluetooth_Scanner.ips.php: Time-Out von Semaphore BluAktiv ()
Lief bisher problemlos (ohne das string-casting, aber auch damit nicht):
function SetIPSsem ($Sem, $Repeat = 100) {
global $_IPS;
settype ($Sem, "string");
$i = 10;
do {
$i ++; // nothing
if ($i > $Repeat)
die (IPS_GetScriptFile ($_IPS['SELF']) . ': Time-Out von Semaphore ' . $Sem . " (" . IPS_GetLocation ((string) $Sem) . ")");
} while (IPS_SemaphoreEnter ((string)$Sem, $i) != true);
}
Fehlermeldung kommt wahrscheinlich wg. dem geänderten Verhalten von IPS: „Zahlen als String nicht erlaubt“
ABER: obwohl in der Ansicht ‚PHP Informationen‘ nichts aufgeführt wird, ist seit gestern abend ein Semaphor gesetzt:
Test
<?
// Test_Semaphoren.ips.php
if (IPS_SemaphoreEnter ('BluAktiv', 1000)) {
print("
Ablauf: BluAktiv gesetzt");
if (IPS_SemaphoreEnter ('BluAktiv', 10)) {
print("
Fehler: BluAktiv doppelt gesetzt");
} else {
print("
Ablauf: BluAktiv abgewiesen, weil bereits gesetzt");
} // Ende Semaphore-Kreis2
IPS_SemaphoreLeave ('BluAktiv'); // und freigeben
print("
Ablauf: BluAktiv zurückgesetzt");
if (IPS_SemaphoreEnter ('BluAktiv', 10)) {
print("
Ablauf: BluAktiv wiederholt gesetzt");
} else {
print("
Ablauf: BluAktiv abgewiesen, weil bereits zum 2ten mal gesetzt");
} // Ende Semaphore-Kreis2
IPS_SemaphoreLeave ('BluAktiv'); // und freigeben
print("
Ablauf: BluAktiv wieder zurückgesetzt");
} else {
print("
Fehler: BluAktiv fremdgesetzt");
} // Ende Semaphore-Kreis1
?>
bringt
Fehler: BluAktiv fremdgesetzt
Wäre das Semaphor nicht gesetzt, wäre das Ergebnis:
Ablauf: BluAktiv gesetzt
Ablauf: BluAktiv abgewiesen, weil bereits gesetzt
Ablauf: BluAktiv zurückgesetzt
Ablauf: BluAktiv wiederholt gesetzt
Ablauf: BluAktiv wieder zurückgesetzt