Lines Matching full:foo*
41 - Create the module/version interface directory by referring to the directory structure. The initial version is defined as `v1_0`, for example, `drivers/interface/foo/v1.0/`.
45 package ohos.hdi.foo.v1_0;
47 import ohos.hdi.foo.v1_0.IFooCallback;
48 import ohos.hdi.foo.v1_0.MyTypes;
53 GetData([out] struct FooInfo info);
60 package ohos.hdi.foo.v1_0;
62 enum FooType {
63 FOO_TYPE_ONE = 1,
64 FOO_TYPE_TWO,
67 struct FooInfo {
70 enum FooType type;
75 package ohos.hdi.foo.v1_0;
83 - Add the `BUILD.gn` file to the `drivers/interface/foo/v1.0/` directory. The file content is as follows:
86 hdi("foo") { # Target .so files (libfoo_client_v1.0.z.so and libfoo_stub_v1.0.z.so) to be generated.
87 package = "ohos.hdi.foo.v1_0" # Package name, which must match the .idl path.
88 module_name = "foo" # moduleName that determines the driver descriptor (struct HdfDriverEntry) in the driver file.
100 After the .idl files are compiled, intermediate code is generated in the `out/[product_name]/gen/drivers/interfaces/foo/v1_0` directory.
104 Implement the service interface based on the `foo_interface_service.h` file that is automatically generated, and compile the related source code to `FooService.z.so`.
110 namespace Foo {
113 class FooService: public IFoo { // Inherit from the interface class and implement the interface.
115 virtual ~FooService() {}
118 int32_t FooService::GetData(FooInfo& info) override;
119 int32_t FooService::SendCallbackObj(const sptr<IFooCallback>& cbObj) override;
123 } // namespace Foo
133 Hdi::Foo::V1_0::IFooInterface *FooInterfaceServiceConstruct();
135 void FooInterfaceServiceRelease(Hdi::Foo::V1_0::IFooInterface *obj);
144 The HDI services are published based on the user-mode Hardware Driver Foundation (HDF). Therefore, a driver entry needs to be implemented. The reference driver implementation code is generated in the **out** directory, for example, `out/gen/xxx/foo_interface_driver.cpp`. You can use this file or modify the file based on service requirements.
151 fooHost :: host {
152 hostName = "fooHost";
154 fooDevice :: device {
160 serviceName = "foo_service";
169 `//drivers/interface/foo/v1.0:libfoo_proxy_1.0"`
176 sptr<IFoo> foo = OHOS::HDI::Foo::V1_0::Foo::Get(); // Use the built-in static method of the Foo object to obtain the client instance of the service.
177 if (foo == nullptr) {
181 foo->Bar(); // Do interface call.
184 If a service has multiple instances, you can use the `Hdi::Foo::V1_0::Foo::GetInstance(const std::string& serviceName)` method to obtain the instance.