darwin.d.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { BindingPortInterface } from '.';
  2. import { BindingInterface, OpenOptions, PortStatus, SetOptions, UpdateOptions } from '@serialport/bindings-interface';
  3. import { Poller } from './poller';
  4. export interface DarwinOpenOptions extends OpenOptions {
  5. /** Defaults to none */
  6. parity?: 'none' | 'even' | 'odd';
  7. /** see [`man termios`](http://linux.die.net/man/3/termios) defaults to 1 */
  8. vmin?: number;
  9. /** see [`man termios`](http://linux.die.net/man/3/termios) defaults to 0 */
  10. vtime?: number;
  11. }
  12. export type DarwinBindingInterface = BindingInterface<DarwinPortBinding, DarwinOpenOptions>;
  13. export declare const DarwinBinding: DarwinBindingInterface;
  14. /**
  15. * The Darwin binding layer for OSX
  16. */
  17. export declare class DarwinPortBinding implements BindingPortInterface {
  18. readonly openOptions: Required<DarwinOpenOptions>;
  19. readonly poller: Poller;
  20. private writeOperation;
  21. fd: null | number;
  22. constructor(fd: number, options: Required<DarwinOpenOptions>);
  23. get isOpen(): boolean;
  24. close(): Promise<void>;
  25. read(buffer: Buffer, offset: number, length: number): Promise<{
  26. buffer: Buffer;
  27. bytesRead: number;
  28. }>;
  29. write(buffer: Buffer): Promise<void>;
  30. update(options: UpdateOptions): Promise<void>;
  31. set(options: SetOptions): Promise<void>;
  32. get(): Promise<PortStatus>;
  33. getBaudRate(): Promise<{
  34. baudRate: number;
  35. }>;
  36. flush(): Promise<void>;
  37. drain(): Promise<void>;
  38. }