当前位置: 首页>>代码示例>>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;未经允许,请勿转载。