     private func sendData(data: NSData) throws {
         try establishConnection()
         
+        printing = true
+        
         let totalDataSize = data.length
         let dataSentToPrinter = malloc(totalDataSize)
         data.getBytes(dataSentToPrinter, length: data.length)

        
        free(dataSentToPrinter)
        
        closeConnection()
    }

    private func establishConnection() throws {
        status = .Connecting
        var connected = false
        for _ in 0..<3 {
            connected = openPort()
            if connected {
                status = .Connected
                break
            }
            sleep(3)
        }
        if !connected {
            status = .Disconnected
            throw PrintingError.EstablishingConnection
        }
    }
    
    private func closeConnection() {

            delegate?.printer(self, didChangeStatus: status)
        }
    }
    public var printing: Bool
    
    public var portName: String {
        return portInfo.portName
