| 285 | } |
| 286 | |
| 287 | export class AndroidSocket extends ChannelOwner<channels.AndroidSocketChannel> implements api.AndroidSocket { |
| 288 | static from(androidDevice: channels.AndroidSocketChannel): AndroidSocket { |
| 289 | return (androidDevice as any)._object; |
| 290 | } |
| 291 | |
| 292 | constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.AndroidSocketInitializer) { |
| 293 | super(parent, type, guid, initializer); |
| 294 | this._channel.on('data', ({ data }) => this.emit(Events.AndroidSocket.Data, data)); |
| 295 | this._channel.on('close', () => this.emit(Events.AndroidSocket.Close)); |
| 296 | } |
| 297 | |
| 298 | async write(data: Buffer): Promise<void> { |
| 299 | await this._channel.write({ data }); |
| 300 | } |
| 301 | |
| 302 | async close(): Promise<void> { |
| 303 | await this._channel.close(); |
| 304 | } |
| 305 | |
| 306 | async [Symbol.asyncDispose]() { |
| 307 | await this.close(); |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | async function loadFile(platform: Platform, file: string | Buffer): Promise<Buffer> { |
| 312 | if (isString(file)) |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…