Add inWaiting Property
This commit is contained in:
@@ -165,6 +165,11 @@ public enum BaudRate {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if os(OSX)
|
||||||
|
// Darwin doesn't provide this
|
||||||
|
private let FIONREAD: UInt = 0x541B
|
||||||
|
#endif
|
||||||
|
|
||||||
public enum DataBitsSize {
|
public enum DataBitsSize {
|
||||||
case bits5
|
case bits5
|
||||||
case bits6
|
case bits6
|
||||||
@@ -384,6 +389,12 @@ public class SerialPort {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var inWaiting: Int? {
|
||||||
|
get{
|
||||||
|
return Int(ioctl(fileDescriptor!, FIONREAD))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Receiving
|
// MARK: Receiving
|
||||||
|
|||||||
Reference in New Issue
Block a user