diff --git a/core/dummy.go b/core/dummy.go index 03705a4..d4704ed 100644 --- a/core/dummy.go +++ b/core/dummy.go @@ -1,5 +1,6 @@ package core +// NOT IN USE import ( "th7/data/core" "th7/ports" diff --git a/core/th7/th7.go b/core/th7/th7.go index 99eb928..40a2a2e 100644 --- a/core/th7/th7.go +++ b/core/th7/th7.go @@ -79,3 +79,8 @@ func (t *TH7Adapter) GetPivdd() float64 { return t.table.Pivdd } + +// Ratio table +func (t *TH7Adapter) GetRatio() core.Ratio { + return t.table +} diff --git a/ports/core.go b/ports/core.go index 4912acd..3a54942 100644 --- a/ports/core.go +++ b/ports/core.go @@ -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 } diff --git a/web/gin.go b/web/gin.go index bbe4be8..3704575 100644 --- a/web/gin.go +++ b/web/gin.go @@ -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)