blob: 38b6173a888a36256b805fada0536caf44689eb3 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.device.lifecycle.test;
using zx;
closed protocol TestDevice {
/// Adds a child device and returns a unique |id| for the created device.
/// |complete_init| specifies whether the init hook should be replied to immediately,
/// or completed later by the caller with |CompleteChildInit|.
strict AddChild(struct {
init_complete bool;
init_status zx.Status;
}) -> (struct {
child_id uint64;
}) error zx.Status;
/// Removes the child device of the given |id|.
strict RemoveChild(struct {
child_id uint64;
}) -> () error zx.Status;
/// Asynchronously removes a child device.
/// The remove must be completed with CompleteUnbind.
strict AsyncRemoveChild(struct {
child_id uint64;
}) -> () error zx.Status;
/// Replies to the child init hook.
/// Returns an error if the child has no pending init.
strict CompleteChildInit(struct {
child_id uint64;
}) -> () error zx.Status;
/// Registers the client for device lifecycle events.
strict SubscribeToLifecycle(resource struct {
client server_end:Lifecycle;
}) -> () error zx.Status;
/// Finishes an unbind started by AsyncRemoveChild.
strict CompleteUnbind(struct {
child_id uint64;
}) -> () error zx.Status;
};
closed protocol Lifecycle {
/// Sent when the ChildPreRelease hook is called.
strict -> OnChildPreRelease(struct {
child_id uint64;
});
};