本文整理汇总了PHP中COM::GetErrorDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::GetErrorDescription方法的具体用法?PHP COM::GetErrorDescription怎么用?PHP COM::GetErrorDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COM
的用法示例。
在下文中一共展示了COM::GetErrorDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCheckComtool
function actionCheckComtool()
{
if (class_exists('COM')) {
try {
$objComport = new COM("ActiveXperts.Comport");
$objComport->Logfile = "C:\\PhpSerialLog.txt";
$objComport->Device = "COM1";
$objComport->Baudrate = 9600;
$objComport->ComTimeout = 1000;
$objComport->Open();
print '<br>Check errros of COMport tool using (trying to connect with COM1)';
if ($objComport->LastError != 0) {
if ($objComport->LastError >= 1000 && $objComport->LastError <= 1999) {
print '<br>LICENSING ERROR!!!';
} else {
print '<br>no licensing errors, some errors with com-port connection';
}
$ErrorNum = $objComport->LastError;
$ErrorDes = $objComport->GetErrorDescription($ErrorNum);
echo "<br><br>Error sending commands: #{$ErrorNum} ({$ErrorDes}).";
}
} catch (Exception $e) {
print_r($e->getMessage());
}
$objComport->Close();
} else {
print "Class for work with COM ports is not available";
}
}
示例2: while
echo "<BR>";
}
echo "Sending 'ATI'...<BR>";
echo "<BR>";
$objComport->WriteString("ATI");
while ($objComport->LastError == 0) {
echo $objComport->ReadString();
echo "<BR>";
}
echo "Sending 'AT&C0'...<BR>";
echo "<BR>";
$objComport->WriteString("AT&C0");
while ($objComport->LastError == 0) {
echo $objComport->ReadString();
echo "<BR>";
}
} else {
$ErrorNum = $objComport->LastError;
$ErrorDes = $objComport->GetErrorDescription($ErrorNum);
echo "Error sending commands: #{$ErrorNum} ({$ErrorDes}).";
}
echo "Ready.";
$objComport->Close();
?>
<br>
<br>
<hr size="1" color="#707070">
<font size="1" face="Verdana">This demo uses ActiveXperts Serial Port Component</font>
</body>
</html>