| // Copyright 2018 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 banjo.examples.callback; |
| |
| using banjo.examples.callback2; |
| using zx; |
| |
| type Point = struct { |
| x int32; |
| y int32; |
| }; |
| |
| type Direction = strict enum : uint32 { |
| Up = 0; |
| Down = 1; |
| Left = 2; |
| Right = 3; |
| }; |
| |
| @transport("Banjo") |
| @banjo_layout("ddk-callback") |
| protocol Draw { |
| Callback(struct { |
| p Point; |
| d Direction; |
| }) -> (); |
| }; |
| |
| @transport("Banjo") |
| @banjo_layout("ddk-protocol") |
| protocol Drawing { |
| RegisterCallback(resource struct { |
| cb client_end:Draw; |
| }) -> (); |
| DeregisterCallback() -> (); |
| RegisterCallback2(resource struct { |
| cb client_end:banjo.examples.callback2.DrawCallback; |
| }) -> (); |
| DrawLots(resource struct { |
| commands zx.handle:VMO; |
| }) -> (struct { |
| result int32; |
| p Point; |
| }); |
| DrawArray(struct { |
| points array<Point, 4>; |
| }) -> (struct { |
| rv zx.status; |
| }); |
| Describe(struct { |
| one string:64; |
| }) -> (struct { |
| two string:128; |
| }); |
| }; |