本文整理匯總了Java中org.opendmtp.codes.CommandErrors類的典型用法代碼示例。如果您正苦於以下問題:Java CommandErrors類的具體用法?Java CommandErrors怎麽用?Java CommandErrors使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CommandErrors類屬於org.opendmtp.codes包,在下文中一共展示了CommandErrors類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleError
import org.opendmtp.codes.CommandErrors; //導入依賴的package包/類
public void handleError(int errCode, byte errData[])
{
/* display error info */
// The value of 'errCode' is defined in OpenDMTP 'ClientErrors.java'
// TODO: should delegate to an OpenDMTP server module (ie ClientErrors.java)
// to display the full error description.
String ec = StringTools.toHexString(errCode,16);
String ed = StringTools.toHexString(errData);
if (errCode == ClientErrors.ERROR_COMMAND_INVALID) {
Print.logError("Client Command Unsupported: 0x" + ec + " - " + ed);
} else
if (errCode == ClientErrors.ERROR_COMMAND_ERROR) {
Payload ped = new Payload(errData);
long propKey = ped.readULong(2,-1L);
long cmdErr = ped.readULong(2,-1L);
if (cmdErr == CommandErrors.COMMAND_OK) {
Print.logError("Client Command OK: 0x" + ec + " - " + ed);
} else
if (cmdErr == CommandErrors.COMMAND_OK_ACK) {
Print.logError("Client Command ACK: 0x" + ec + " - " + ed);
} else {
Print.logError("Client Command Error: 0x" + ec + " - " + ed);
}
} else {
Print.logError("Client Error: 0x" + ec + " - " + ed);
}
/* save error information */
try {
Diagnostic.saveError(this.device, errCode, errData);
} catch (DBException dbe) {
Print.logException("Saving Property value", dbe);
}
}