當前位置: 首頁>>代碼示例>>Java>>正文


Java StarIOPort類代碼示例

本文整理匯總了Java中com.starmicronics.stario.StarIOPort的典型用法代碼示例。如果您正苦於以下問題:Java StarIOPort類的具體用法?Java StarIOPort怎麽用?Java StarIOPort使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StarIOPort類屬於com.starmicronics.stario包,在下文中一共展示了StarIOPort類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFirstPrinter

import com.starmicronics.stario.StarIOPort; //導入依賴的package包/類
/**
 * Using the portNameSearch parameter, this method searches for the first printer that corresponds to the
 * search
 * @param portNameSearch the name of the printer to search (example BT: or TCP:xxx.xxx.xxx.xxx)
 * @return
 */
public static String getFirstPrinter(String portNameSearch) {
    String portName = "";
    List<PortInfo> portList;
    try {
        portList  = StarIOPort.searchPrinter(portNameSearch);

        for (PortInfo portInfo : portList) {
            portName = portInfo.getPortName();
            break;
        }
    } catch (StarIOPortException e) {
        e.printStackTrace();
    }
    return portName;
}
 
開發者ID:vshjxyz,項目名稱:StarIOAdapter,代碼行數:22,代碼來源:PrinterFunctions.java

示例2: disconnect

import com.starmicronics.stario.StarIOPort; //導入依賴的package包/類
static synchronized void disconnect() {
    if (mPopManager != null && mPopManager.port != null) {
        try {
            StarIOPort.releasePort(mPopManager.port);
        } catch (StarIOPortException e) {
            e.printStackTrace();
        }
    }
    mPopManager = null;
}
 
開發者ID:ScilCoop,項目名稱:pasteque-android,代碼行數:11,代碼來源:MPopManager.java

示例3: searchPrinterEntry

import com.starmicronics.stario.StarIOPort; //導入依賴的package包/類
public static MPopEntries searchPrinterEntry() {
    MPopEntries mPopEntries = new MPopEntries();
    try {
        ArrayList<PortInfo> ports = StarIOPort.searchPrinter("BT:");
        for (PortInfo each: ports) {
            mPopEntries.add(each.getPortName(), each.getMacAddress());
        }
    } catch (StarIOPortException e) {
        e.printStackTrace();
    }
    return mPopEntries;
}
 
開發者ID:ScilCoop,項目名稱:pasteque-android,代碼行數:13,代碼來源:MPopPort.java

示例4: sendCommands

import com.starmicronics.stario.StarIOPort; //導入依賴的package包/類
static Result sendCommands(byte[] commands, StarIOPort port) {
        Result result = Result.ErrorUnknown;

        try {
            if (port == null) {
                result = Result.ErrorOpenPort;
                return result;
            }

//          // When using an USB interface, you may need to send the following data.
//          byte[] dummy = {0x00};
//          port.writePort(dummy, 0, dummy.length);

            StarPrinterStatus status;

            result = Result.ErrorWritePort;
            status = port.retreiveStatus();

            if (status.rawLength == 0) {
                throw new StarIOPortException("A printer is offline");
            }

            result = Result.ErrorWritePort;
            port.writePort(commands, 0, commands.length);

            result = Result.ErrorWritePort;
            status = port.retreiveStatus();

            if (status.rawLength == 0) {
                throw new StarIOPortException("A printer is offline");
            }

            result = Result.Success;
        }
        catch (StarIOPortException e) {
            // Nothing
        }

        return result;
    }
 
開發者ID:ScilCoop,項目名稱:pasteque-android,代碼行數:41,代碼來源:MPopCommunication.java

示例5: getPort

import com.starmicronics.stario.StarIOPort; //導入依賴的package包/類
static StarIOPort getPort(String portName) throws StarIOPortException {
    return getPort(portName, null, timeout, Pasteque.getAppContext());
}
 
開發者ID:ScilCoop,項目名稱:pasteque-android,代碼行數:4,代碼來源:MPopPort.java


注:本文中的com.starmicronics.stario.StarIOPort類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。