-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
started outlining the things needed for a new component and controlle…
…r example
- Loading branch information
Showing
3 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
micronautpi4j-utils/src/docs/asciidoc/contribute/ExampleController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.opensourcewithslu.components.controllers; | ||
|
||
import com.opensourcewithslu.inputdevices.ExamplHelper; | ||
import com.opensourcewithslu.outputdevices.LEDHelper; | ||
import io.micronaut.http.annotation.Controller; | ||
import io.micronaut.http.annotation.Get; | ||
|
||
//tag::ex[] | ||
@Controller("/example") | ||
public class ExampleController { | ||
private final PushButtonHelper pushButtonHelper; | ||
|
||
|
||
public ExampleController(ExamplHelper exampleHelper) { | ||
this.exampleHelper = exampleHelper; | ||
} | ||
|
||
@Get("/init") | ||
public void initController(){ | ||
exampleHelper.addEventListener(e ->{ | ||
/*Some action */ | ||
}); | ||
} | ||
} | ||
//end::ex[] |
22 changes: 21 additions & 1 deletion
22
micronautpi4j-utils/src/docs/asciidoc/contribute/newComponent.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
=== How to Create a New Component | ||
[.text-right] | ||
https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/contribute/newComponent.adoc[Improve this doc] | ||
|
||
TODO: add info on how to add a new component | ||
|
||
TODO: add info on how to add a new component | ||
* controller | ||
** controls the component | ||
** `components\src\main\java\com\opensourcewithslu\components\controllers` | ||
include::exampleController.java[tag=ex] | ||
|
||
|
||
* helper | ||
** where all the actions are defined. | ||
** `micronautpi4j-utils\src\main\java\com\opensourcewithslu` | ||
* input versus output device | ||
** input devices main task is taking in information | ||
*** `micronautpi4j-utils\src\main\java\com\opensourcewithslu\inputdevices` | ||
** output devices display or output information | ||
*** `micronautpi4j-utils\src\main\java\com\opensourcewithslu\outputdevices` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters