package pcb

import (
	"fmt"
	"math/rand"
	"th7/data/pcb"
	"time"
)

type DummyAdapter struct {
	table pcb.Table
}

func NewDummyAdapter() (*DummyAdapter, error) {
	rand.Seed(time.Now().UnixNano())
	return &DummyAdapter{}, nil
}

func (d *DummyAdapter) Deinit() error {
	fmt.Println("dummy pcb adapter deinit")
	return nil
}

func (d *DummyAdapter) UpdateTable() {
	d.table.Pivdd = 5.0
	d.table.Vadj = 0.9
	d.table.Vref = 3.6
}

func (d *DummyAdapter) GetTable() pcb.Table {
	return d.table
}

func (d *DummyAdapter) ReadChannel(id int, gain float64) float64 {
	return -9000.0 * rand.Float64()
}

func (d *DummyAdapter) ReadPCBTemp() float64 {
	return 25.0
}