2024-02-09 15:11:10 -08:00
|
|
|
# Generated Service API
|
|
|
|
|
2024-12-03 17:01:55 +01:00
|
|
|
Binder generates a trait for each interface definition.
|
2024-02-09 15:11:10 -08:00
|
|
|
|
|
|
|
_birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl_:
|
|
|
|
|
|
|
|
```java
|
|
|
|
{{#include ../birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl:IBirthdayService}}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2024-12-03 17:01:55 +01:00
|
|
|
_out/soong/.intermediates/.../birthdayservice/IBirthdayService.rs_:
|
|
|
|
|
|
|
|
<!-- The example below is a cleaned up and simplified version of the real code. -->
|
2024-02-09 15:11:10 -08:00
|
|
|
|
|
|
|
```rust,ignore
|
|
|
|
trait IBirthdayService {
|
|
|
|
fn wishHappyBirthday(&self, name: &str, years: i32) -> binder::Result<String>;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Your service will need to implement this trait, and your client will use this
|
|
|
|
trait to talk to the service.
|
|
|
|
|
|
|
|
<details>
|
|
|
|
|
|
|
|
- Point out how the generated function signature, specifically the argument and
|
|
|
|
return types, correspond the interface definition.
|
|
|
|
- `String` for an argument results in a different Rust type than `String` as a
|
|
|
|
return type.
|
|
|
|
|
|
|
|
</details>
|