// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. [ { "namespace": "experimental.serial", "nodoc": true, "functions": [ { "name": "open", "type": "function", "description": "Opens a connection to the given serial port.", "parameters": [ { "name": "port", "type": "string", "description": "The name of the serial port to open." }, { "name": "callback", "type": "function", "description": "Called when the connection has been opened.", "parameters": [ { "type": "object", "name": "serialInfo", "properties": { "connectionId": { "type": "integer", "description": "The id of the opened connection." } } } ] } ] }, { "name": "close", "type": "function", "description": "Closes an open connection.", "parameters": [ { "name": "connectionId", "type": "integer", "minimum": 1, "description": "The id of the opened connection." }, { "name": "callback", "type": "function", "description": "Called when the connection has been closed.", "parameters": [ { "type": "boolean", "name": "result", "description": "True if the connection was successfully closed." } ] } ] }, { "name": "read", "type": "function", "description": "Reads a byte from the given connection.", "parameters": [ { "name": "connectionId", "type": "integer", "minimum": 1, "description": "The id of the connection." }, { "name": "callback", "type": "function", "description": "Called when the byte has been read or the read blocked.", "parameters": [ { "type": "object", "name": "readInfo", "properties": { "bytesRead": { "type": "integer", "description": "The number of bytes received, or a negative number if an error occurred." }, "message": { "type": "string", "description": "The data received. Warning: will probably become a blob or other appropriate binary-friendly type." } } } ] } ] }, { "name": "write", "type": "function", "description": "Writes a string to the given connection.", "parameters": [ { "name": "connectionId", "type": "integer", "minimum": 1, "description": "The id of the connection." }, { "name": "data", "type": "string", "description": "The string to write." }, { "name": "callback", "type": "function", "description": "Called when the string has been written.", "parameters": [ { "type": "object", "name": "writeInfo", "properties": { "bytesWritten": { "type": "integer", "description": "The number of bytes written." } } } ] } ] } ] } ]