This interface is implemented by virtual serial port driver and represents a virtual serial port device opened by application. It is available as a global port object.
interface IPort {
// Methods
${provideReceivedData}(text: string, encoding?: ${Common.Encoding} | number): void;
${provideReceivedData#provideReceivedData1}(byte: number): void;
${provideReceivedData#provideReceivedData2}(bytes: number[] | Uint8Array | Uint16Array | Uint32Array | ArrayBuffer | DataView): void;
${provideReceivedData#provideReceivedData3}(sendAs: ${Port.WriteAs},
data: number[] | Uint8Array | Uint16Array | Uint32Array | ArrayBuffer | DataView,
bigEndian?: boolean): void;
${getSentData}(maxBytes?: number): Promise<Uint8Array>;
${setError}(errorCode: number): void;
${setEventMask}(mask: ${Port.EventMask}): void;
${clearEventMask}(): void;
}
// This interface is not available in managed environment
// This interface is not available in native environment
provideReceivedData(text: string, encoding?: ${Common.Encoding} | number): void;
// This method is not available in managed environment
// This method is not available in native environment
textencodingPut a given string into port's input queue. An optional encoding parameter, if specified, tells how the port should encode a passed string.
provideReceivedData(byte: number): void;
// This method is not available in managed environment
// This method is not available in native environment
bytePut a single byte into port's input queue.
provideReceivedData(bytes: number[] | Uint8Array | Uint16Array | Uint32Array | ArrayBuffer | DataView): void;
// This method is not available in managed environment
// This method is not available in native environment
bytesDataView object to put into port's input queue.Put a given data array into port's input queue.
provideReceivedData(sendAs: ${Port.WriteAs},
data: number[] | Uint8Array | Uint16Array | Uint32Array | ArrayBuffer | DataView,
bigEndian?: boolean): void;
// This method is not available in managed environment
// This method is not available in native environment
sendAsdataDataView object to put into port's input queue. sendAs parameter is used to interpret and possibly convert the passed data array.bigEndiansendAs parameter describes multi-byte sequence, treat is as little-endian (bigEndian equals false or omitted) or as big-endian (bigEndian equals true).Put a given data array into port's input queue.
getSentData(maxBytes?: number): Promise<Uint8Array>;
// This method is not available in managed environment
// This method is not available in native environment
maxBytesA promise that is resolved with a copy of the data from the output queue.
Request the data that have been put into the port's output queue by the application. This method must be used by a device script utilizing a pull model.
setError(errorCode: number): void;
// This method is not available in managed environment
// This method is not available in native environment
errorCodeSet the port into the error state. Any pending read sent by application is immediately completed with a passed error code.
setEventMask(mask: ${Port.EventMask}): void;
// This method is not available in managed environment
// This method is not available in native environment
maskSet the port event mask.
clearEventMask(): void;
// This method is not available in managed environment
// This method is not available in native environment
Clear the port event mask.