You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, the app sends Buffer data. However, the write function tries to convert it to a string, causing a failure check. As a result, the data isn't sent to the Printer device.
Describe the solution you'd like
I suggest removing the check if let sending = String(data: data, encoding: self.encoding)
or implementing another check if the data is Buffer data.
I tried to remove the condition and it's working correctly.
func write(_ data:Data)->Bool{
if let sending =String(data: data, encoding:self.encoding){NSLog("(BluetoothDevice:writeToDevice) Writing %@ to device %@", sending, accessory.serialNumber)NSLog("(BluetoothDevice:writeToDevice) 2222")
outBuffer.append(data)writeDataToStream((session?.outputStream)!)}else{NSLog("(BluetoothDevice:writeToDevice) Writing false")return false
}return true
}
Additional context
Here is the buffer data we passed to write function
Feel free to open a PR, not sure what check you removed, since the "working" code you posted has the line/content that you mention you want to remove above. I'm not entirely sure why it was done that way, but it does look a little weird that I'm converting to the sending string but then never using that string.
Mobile Device Environment
Is your feature request related to a problem? Please describe.
Currently, the app sends Buffer data. However, the write function tries to convert it to a string, causing a failure check. As a result, the data isn't sent to the Printer device.
Describe the solution you'd like
I suggest removing the check
if let sending = String(data: data, encoding: self.encoding)
or implementing another check if the data is Buffer data.
I tried to remove the condition and it's working correctly.
Additional context
Here is the buffer data we passed to write function
The text was updated successfully, but these errors were encountered: