mirror of https://bitbucket.org/ausocean/av.git
added testing file and began write implementation
This commit is contained in:
parent
0c6d9d0132
commit
7da2097cf9
|
@ -61,6 +61,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gocv.io/x/gocv"
|
||||||
"gopkg.in/natefinch/lumberjack.v2"
|
"gopkg.in/natefinch/lumberjack.v2"
|
||||||
|
|
||||||
"bitbucket.org/ausocean/av/container/mts"
|
"bitbucket.org/ausocean/av/container/mts"
|
||||||
|
@ -104,7 +105,7 @@ const (
|
||||||
profilePath = "rv.prof"
|
profilePath = "rv.prof"
|
||||||
pkg = "rv: "
|
pkg = "rv: "
|
||||||
runPreDelay = 20 * time.Second
|
runPreDelay = 20 * time.Second
|
||||||
turbidity
|
turbidityDelay = 60 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
// Software define pin values.
|
// Software define pin values.
|
||||||
|
@ -125,17 +126,25 @@ type turbidityProbe struct {
|
||||||
// TODO(Russell): complete this implementation of Write.
|
// TODO(Russell): complete this implementation of Write.
|
||||||
func (tp *turbidityProbe) Write(p []byte) (int, error) {
|
func (tp *turbidityProbe) Write(p []byte) (int, error) {
|
||||||
|
|
||||||
ticker := time.NewTicker(500 * time.Millisecond)
|
ticker := time.NewTicker(turbidityDelay)
|
||||||
|
const (
|
||||||
|
rows = 2464
|
||||||
|
cols = 3280
|
||||||
|
)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
|
mat, err := gocv.NewMatFromBytes(rows, cols, gocv.MatTypeCV8U, p) // IMDecode may also work
|
||||||
// Implementation here
|
if err != nil {
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
mat.GetUCharAt(0, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
|
||||||
|
ts := new(turbidityProbe)
|
||||||
|
|
||||||
|
frame := make([]byte, 10)
|
||||||
|
|
||||||
|
size, err := ts.Write(frame)
|
||||||
|
|
||||||
|
fmt.Println(size)
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
NAME
|
||||||
|
audio_OSX.go
|
||||||
|
|
||||||
|
AUTHORS
|
||||||
|
Russell Stanley <russell@ausocean.org>
|
||||||
|
|
||||||
|
LICENSE
|
||||||
|
revid is Copyright (C) 2021 the Australian Ocean Lab (AusOcean)
|
||||||
|
|
||||||
|
It is free software: you can redistribute it and/or modify them
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
It is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
in gpl.txt. If not, see http://www.gnu.org/licenses.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package revid
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (r *Revid) setupAudio() error {
|
||||||
|
return errors.New("audio not implemented on OSX")
|
||||||
|
}
|
Loading…
Reference in New Issue