expose ratio table to web
This commit is contained in:
parent
376727840c
commit
737ae78c34
@ -1,5 +1,6 @@
|
||||
package core
|
||||
|
||||
// NOT IN USE
|
||||
import (
|
||||
"th7/data/core"
|
||||
"th7/ports"
|
||||
|
@ -79,3 +79,8 @@ func (t *TH7Adapter) GetPivdd() float64 {
|
||||
|
||||
return t.table.Pivdd
|
||||
}
|
||||
|
||||
// Ratio table
|
||||
func (t *TH7Adapter) GetRatio() core.Ratio {
|
||||
return t.table
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ports
|
||||
|
||||
import "th7/data/core"
|
||||
import (
|
||||
"th7/data/core"
|
||||
)
|
||||
|
||||
type CorePort interface {
|
||||
GetChannel(int) (core.Channel, error)
|
||||
@ -8,4 +10,5 @@ type CorePort interface {
|
||||
GetVref() float64
|
||||
GetVadj() float64
|
||||
GetPivdd() float64
|
||||
GetRatio() core.Ratio
|
||||
}
|
||||
|
@ -16,6 +16,11 @@ type GinAdapter struct {
|
||||
|
||||
func (g GinAdapter) registerEndpoints() {
|
||||
|
||||
g.router.GET("/ratio", func(c *gin.Context) {
|
||||
table := g.corePort.GetRatio()
|
||||
c.JSON(http.StatusOK, table)
|
||||
})
|
||||
|
||||
g.router.GET("/channels", func(c *gin.Context) {
|
||||
channels := g.corePort.GetChannels()
|
||||
c.JSON(http.StatusOK, channels)
|
||||
|
Loading…
Reference in New Issue
Block a user