Skip to content

Golang library and example command line tool for SEKONIC spectrometers remote control.

License

Notifications You must be signed in to change notification settings

akares/skreader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

skreader

Test Go code Lint Go code

Golang library and example command line tool for SEKONIC spectrometers remote control.

Based on original C# SDK for Windows from SEKONIC.

Sekonic C-7000

Supported (tested) models

  • Sekonic C-700
  • Sekonic C-800
  • Sekonic C-800-U (US Version. Basically the same as C-800)
  • Sekonic C-7000 (supports extended measurement configuration: FOV and Exposure Time)

Supported (tested) platforms

  • Darwin
  • Windows
  • Linux

Known limitations

Currently only ambient measuring mode is supported.

TM-30, SSI and TLCI measurements are available for Sekonic C-7000 with FW version > 25 but parsing of these fields is not implemented yet.

Usage

Install USB driver

Default implementation uses gousb wrapper for the libusb library.

You must have libusb-1.0 installed on your target system to be able to communicate with USB devices.

Installation for different platforms is covered in gousb documentation.

If you use Linux, you probably already have it. If you use Mac ot Windows and was using USB devices that needed custom driver, you also probably have it.

Alternatively you can provide custom USB implementation with simple interface close to io.Reader. See the default gousb based implementation for reference.

Install Go

You need Go programming language to be installed first.

See the Go's Download and install page for installation instructions for different OS.

On MacOS just use Homebrew:

homebrew install go

Run example measurement program usung Go

Run as command line tool

  1. Connect your device.

  2. Run one measurement:

go run ./cmd/skread measure -s
  1. Get info about other available options:
go run ./cmd/skread --help
go run ./cmd/skread measure --help

Go will take care of dependencies when running this script for the first time.

Run as HTTP server

The example program can be also run as a web server:

go run ./cmd/skread webserver

By default it will start HTTP server on port 8080 and will be exposed to all network interfaces (i.e. accesible to anybody from the LAN):

🚀 HTTP server started at http://0.0.0.0:8080
Press ctrl+c to stop.

Then you can access it via browser or curl:

curl "http://0.0.0.0:8080/measure?name=My%20Measuremente&note=Don't%20Panic"

To test it without connecting the device, you can use fake flag:

curl "http://0.0.0.0:8080/measure?fake=1"

Build standalone program executable (if needed)

go build ./cmd/skread

This will create binary executable file named skread in the same directory.

Run the executable:

./skread --help

Now you can run this file on any other machine with the same OS and architecture as the one you built it with. But remeber about USB driver dependency mentioned earlier, it is needed for program to run.

Create your own measurement program (if needed)

Note: the cmd/skread/main.go is just an example of the library usage. If more specific funtionality is needed, you always can create your own Go program and import the library in the same way as example does. Go will fetch it automatically.

Example:

  1. Create your project dir:
mkdir my_skreader && cd my_skreader
  1. Initialise Go module named my_skreader and add skreader library as an external dependency:
go mod init my_skreader
go get github.com/akares/skreader
  1. Download main.go example file there (or create manually):
curl -OL https://raw.githubusercontent.com/akares/skreader/main/cmd/skread/main.go
  1. Run:
go run . --help
  1. Modify the program according to your needs.

  2. Build standalone executable (if needed):

go build -o my_skreader ./main.go
./my_skreader --help

You will still need to take care of the USB driver dependency mentioned earlier.

Library API

See the skread command implementation for details.

Contribution

  1. Use gofmt
  2. Ensure unit tests are okay: go test ./...
  3. Ensure Go linter finds no errors: golangci-lint run .

License

This project is licensed under the terms of the MIT license.

Legal notices

All product names, logos, and brands are property of their respective owners. All company, product and service names used in this package are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.

  • SEKONIC is a registered trademark of SEKONIC CORPORATION.
  • Google is a registered trademark of Google LLC.
  • Windows is a registered trademark of Microsoft Corporation.
  • Linux is the registered trademark of Linus Torvalds.

About

Golang library and example command line tool for SEKONIC spectrometers remote control.

Resources

License

Stars

Watchers

Forks