| // 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 banjo.examples.passcallback; |
| |
| using zx; |
| |
| type Point = struct { |
| x int64; |
| y int64; |
| }; |
| |
| type Direction = strict enum : uint8 { |
| UP = 1; |
| DOWN = 2; |
| LEFT = 3; |
| RIGHT = 4; |
| }; |
| |
| type Action = strict enum : uint32 { |
| START = 0x1; |
| STOP = 0x2; |
| }; |
| |
| @transport("Banjo") |
| @banjo_layout("ddk-callback") |
| protocol ActionNotify { |
| Callback(struct { |
| p Point; |
| d Direction; |
| }) -> (); |
| }; |
| |
| @transport("Banjo") |
| @banjo_layout("ddk-protocol") |
| protocol ActionProtocol { |
| RegisterCallback(resource struct { |
| id uint32; |
| cb client_end:ActionNotify; |
| }) -> (struct { |
| s zx.status; |
| }); |
| GetCallback(struct { |
| id uint32; |
| }) -> (resource struct { |
| s zx.status; |
| cb client_end:ActionNotify; |
| }); |
| }; |