| Index: pkg/dartino_agent/lib/messages.dart
|
| diff --git a/pkg/fletch_agent/lib/messages.dart b/pkg/dartino_agent/lib/messages.dart
|
| similarity index 91%
|
| rename from pkg/fletch_agent/lib/messages.dart
|
| rename to pkg/dartino_agent/lib/messages.dart
|
| index e1a1946b8f6cc57bdca99abebbac9aafea9c1355..e41a8015f2df9bd4451af72c863d174be76363f9 100644
|
| --- a/pkg/fletch_agent/lib/messages.dart
|
| +++ b/pkg/dartino_agent/lib/messages.dart
|
| @@ -2,7 +2,7 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE.md file.
|
|
|
| -/// This comment describes the Fletch Agent's request and reply message format.
|
| +/// This comment describes the Dartino Agent's request and reply message format.
|
| ///
|
| /// Message requests all start with the following header:
|
| ///
|
| @@ -48,7 +48,7 @@
|
| /// Each payload is always preceded by the corresponding header.
|
| ///
|
| /// START_VM:
|
| -/// Start a new Fletch VM and return the vm's id and port on which it is
|
| +/// Start a new Dartino VM and return the vm's id and port on which it is
|
| /// listening.
|
| /// Request Payload:
|
| /// None.
|
| @@ -73,7 +73,7 @@
|
| /// None.
|
| ///
|
| /// LIST_VMS:
|
| -/// This command lists the currently running Fletch VMs.
|
| +/// This command lists the currently running Dartino VMs.
|
| /// Request Payload:
|
| /// None.
|
| /// Reply Payload on success:
|
| @@ -90,7 +90,7 @@
|
| /// None.
|
| ///
|
| /// UPGRADE_VM:
|
| -/// This command is used to update the Fletch VM binary on the device.
|
| +/// This command is used to update the Dartino VM binary on the device.
|
| /// Request Payload:
|
| /// ... the vm binary bytes
|
| ///
|
| @@ -99,26 +99,26 @@
|
| /// Reply Payload on failure:
|
| /// None.
|
|
|
| -library fletch_agent.messages;
|
| +library dartino_agent.messages;
|
|
|
| import 'dart:convert' show ASCII;
|
| import 'dart:typed_data';
|
|
|
| -/// Current Fletch Agent version
|
| +/// Current Dartino Agent version
|
| const int AGENT_VERSION = 1;
|
|
|
| /// Default agent port
|
| const int AGENT_DEFAULT_PORT = 12121;
|
|
|
| /// Temporary path for the agent package used during upgrade.
|
| -const String PACKAGE_FILE_NAME = '/tmp/fletch-agent.deb';
|
| +const String PACKAGE_FILE_NAME = '/tmp/dartino-agent.deb';
|
|
|
| class RequestHeader {
|
| static const int START_VM = 0;
|
| static const int STOP_VM = 1;
|
| static const int LIST_VMS = 2;
|
| static const int UPGRADE_AGENT = 3;
|
| - static const int FLETCH_VERSION = 4;
|
| + static const int DARTINO_VERSION = 4;
|
| static const int SIGNAL_VM = 5;
|
|
|
| // Wire size (bytes) of the RequestHeader.
|
| @@ -299,28 +299,28 @@ class UpgradeAgentRequest extends RequestHeader {
|
| }
|
| }
|
|
|
| -class FletchVersionRequest extends RequestHeader {
|
| - FletchVersionRequest()
|
| - : super(RequestHeader.FLETCH_VERSION);
|
| +class DartinoVersionRequest extends RequestHeader {
|
| + DartinoVersionRequest()
|
| + : super(RequestHeader.DARTINO_VERSION);
|
|
|
| - FletchVersionRequest.withHeader(RequestHeader header)
|
| + DartinoVersionRequest.withHeader(RequestHeader header)
|
| : super(
|
| - RequestHeader.FLETCH_VERSION,
|
| + RequestHeader.DARTINO_VERSION,
|
| version: header.version,
|
| id: header.id,
|
| reserved: header.reserved);
|
|
|
| - factory FletchVersionRequest.fromBuffer(ByteBuffer buffer) {
|
| + factory DartinoVersionRequest.fromBuffer(ByteBuffer buffer) {
|
| var header = new RequestHeader.fromBuffer(buffer);
|
| - if (header.command != RequestHeader.FLETCH_VERSION ||
|
| + if (header.command != RequestHeader.DARTINO_VERSION ||
|
| header.payloadLength != 0) {
|
| throw new MessageDecodeException(
|
| - 'Invalid FletchVersionRequest: ${buffer.asUint8List()}');
|
| + 'Invalid DartinoVersionRequest: ${buffer.asUint8List()}');
|
| }
|
| - return new FletchVersionRequest.withHeader(header);
|
| + return new DartinoVersionRequest.withHeader(header);
|
| }
|
|
|
| - // A FletchVersionRequest has no payload so just use parent's toBuffer method.
|
| + // A DartinoVersionRequest has no payload so just use parent's toBuffer method.
|
| }
|
|
|
| class SignalVmRequest extends RequestHeader {
|
| @@ -514,19 +514,19 @@ class UpgradeAgentReply extends ReplyHeader {
|
| // The UPGRADE_AGENT reply has no payload, so leverage parent's toBuffer method.
|
| }
|
|
|
| -class FletchVersionReply extends ReplyHeader {
|
| - final String fletchVersion;
|
| +class DartinoVersionReply extends ReplyHeader {
|
| + final String dartinoVersion;
|
|
|
| - FletchVersionReply(int id, int result, {String version})
|
| + DartinoVersionReply(int id, int result, {String version})
|
| : super(id, result, payloadLength: version != null ? version.length : 0),
|
| - fletchVersion = version {
|
| + dartinoVersion = version {
|
| if (result == ReplyHeader.SUCCESS && version == null) {
|
| throw new MessageEncodeException(
|
| - "Missing version for FletchVersionReply.");
|
| + "Missing version for DartinoVersionReply.");
|
| }
|
| }
|
|
|
| - factory FletchVersionReply.fromBuffer(ByteBuffer buffer) {
|
| + factory DartinoVersionReply.fromBuffer(ByteBuffer buffer) {
|
| var header = new ReplyHeader.fromBuffer(buffer);
|
| String version;
|
| if (header.result == ReplyHeader.SUCCESS) {
|
| @@ -534,22 +534,22 @@ class FletchVersionReply extends ReplyHeader {
|
| if (payloadLength == 0 ||
|
| buffer.lengthInBytes < ReplyHeader.HEADER_SIZE + payloadLength) {
|
| throw new MessageDecodeException(
|
| - "Invalid FletchVersionReply: ${buffer.asUint8List()}");
|
| + "Invalid DartinoVersionReply: ${buffer.asUint8List()}");
|
| }
|
| version = ASCII.decode(buffer.asUint8List(ReplyHeader.HEADER_SIZE));
|
| }
|
| - return new FletchVersionReply(header.id, header.result, version: version);
|
| + return new DartinoVersionReply(header.id, header.result, version: version);
|
| }
|
|
|
| ByteBuffer toBuffer() {
|
| ByteBuffer buffer;
|
| if (result == ReplyHeader.SUCCESS) {
|
| Uint8List message = new Uint8List(
|
| - ReplyHeader.HEADER_SIZE + fletchVersion.length);
|
| + ReplyHeader.HEADER_SIZE + dartinoVersion.length);
|
| _writeHeader(message.buffer);
|
| - List<int> encodedVersion = ASCII.encode(fletchVersion);
|
| + List<int> encodedVersion = ASCII.encode(dartinoVersion);
|
| assert(encodedVersion != null);
|
| - assert(fletchVersion.length == encodedVersion.length);
|
| + assert(dartinoVersion.length == encodedVersion.length);
|
| message.setRange(
|
| ReplyHeader.HEADER_SIZE,
|
| ReplyHeader.HEADER_SIZE + encodedVersion.length,
|
|
|