star-micronics / StarPRNT-SDK-iOS-Swift

StarPRNT SDK for iOS including libraries for supporting application development for Star printers.
https://www.star-m.jp/products/s_print/sdk/starprnt_sdk/manual/ios_swift/en/index.html
Other
41 stars 7 forks source link

Cash Drawer on Mpop #17

Closed raphaels17 closed 1 year ago

raphaels17 commented 2 years ago

Description

The cash drawer opens on the different model except the mPop . What am I missing for this specific model ? I have searched the entire sdk doc but found no specific instruction for it.

Your device where the bug occurs

Your printer

Your development environment

xcode

Additional context

here is the snippet of code func sendDataForCashDrawer (fullReconnect:Bool = false) -> Bool { `if !initializePrinterObject() { return false }

    if !self.cashDrawerOpenActiveHigh {
        return false
    }

    builder!.appendPeripheral(**SCBPeripheralChannel.no1**)

    builder!.endDocument()

    let commands = builder!.commands.copy() as! Data

    GlobalQueueManager.shared.serialQueue.async {
        _ = Communication.sendCommandsDoNotCheckCondition(commands,
                                       portName: self.portName,
                                       portSettings: self.portSettings,
                                       timeout: 10000, 
            completionHandler: { (result: Bool, title: String, message: String) in
                let formatter = DateFormatter()
                formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS "
                DispatchQueue.main.async {
                    if result {
                        //PrintMessageView.show(message: "Tiroir caisse ouvert !!!", theme: .success)
                    }else if !fullReconnect{
                        PrintMessageView.cashDrawerFailedToOpen(message: "\(title) : \(message)" , theme: .warning)
                    } else {
                        PrimaryPrinterService.shared.devicesDelegate =  self
                        PrimaryPrinterService.shared.startConnectionRoutine()
                        return 
                    }
                    self.initializePrinterObject()
                }
        })
    }
    return true
}`
gare-bear commented 2 years ago

@raphaels17 are you using the mPOP built-in cash drawer? or is your cash drawer connected to the secondary cash drawer port?

raphaels17 commented 2 years ago

Hi @gare-bear

Thanks for jumpi in in. I would say the option 1. and as an image is worth a thousand words ( hopefully). I have managed to get 2 pictures of the customer cash drawer https://help.hangers.io/attachments/token/CRDTboGSiiA9F443JOF9fYRRe/?name=IMG_0001.jpg https://help.hangers.io/attachments/token/e11ejOAglbn5RmKa3rWy7PyEe/?name=IMG_0002.jpg

gare-bear commented 2 years ago

@raphaels17 the built-in cash drawer should open using SCBPeripheralChannel.no1. If this code is working on other printers, then I'd suggest reaching out to the Star support team in your region to troubleshoot the cash drawer; it may be damaged.

bandit-ibayashi commented 1 year ago

This issue will be closed as there has been no movement for a long period of time. If you continue to experience similar issues, it would be appreciated if you could post another one.