Add inWaiting Property

This commit is contained in:
Piv
2020-07-07 22:48:17 +09:30
parent 9799f402e7
commit 496a62549f

View File

@@ -165,6 +165,11 @@ public enum BaudRate {
}
#endif
#if os(OSX)
// Darwin doesn't provide this
private let FIONREAD: UInt = 0x541B
#endif
public enum DataBitsSize {
case bits5
case bits6
@@ -384,6 +389,12 @@ public class SerialPort {
}
}
}
public var inWaiting: Int? {
get{
return Int(ioctl(fileDescriptor!, FIONREAD))
}
}
}
// MARK: Receiving