Compare commits
2 Commits
v0.0.7
...
gatt_local
| Author | SHA1 | Date | |
|---|---|---|---|
| e36f0b4f66 | |||
| b7d8d4376d |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,3 @@
|
|||||||
/itd
|
/itd
|
||||||
/itgui
|
/itgui
|
||||||
/version.txt
|
/version.txt
|
||||||
dist/
|
|
||||||
|
|||||||
111
.goreleaser.yaml
111
.goreleaser.yaml
@@ -1,111 +0,0 @@
|
|||||||
# This is an example .goreleaser.yml file with some sensible defaults.
|
|
||||||
# Make sure to check the documentation at https://goreleaser.com
|
|
||||||
before:
|
|
||||||
hooks:
|
|
||||||
# You may remove this if you don't use go modules.
|
|
||||||
- go mod tidy
|
|
||||||
builds:
|
|
||||||
- id: itd
|
|
||||||
env:
|
|
||||||
- CGO_ENABLED=0
|
|
||||||
binary: itd
|
|
||||||
goos:
|
|
||||||
- linux
|
|
||||||
goarch:
|
|
||||||
- 386
|
|
||||||
- amd64
|
|
||||||
- arm
|
|
||||||
- arm64
|
|
||||||
- id: itctl
|
|
||||||
env:
|
|
||||||
- CGO_ENABLED=0
|
|
||||||
main: ./cmd/itctl
|
|
||||||
binary: itctl
|
|
||||||
goos:
|
|
||||||
- linux
|
|
||||||
goarch:
|
|
||||||
- 386
|
|
||||||
- amd64
|
|
||||||
- arm
|
|
||||||
- arm64
|
|
||||||
archives:
|
|
||||||
- replacements:
|
|
||||||
386: i386
|
|
||||||
amd64: x86_64
|
|
||||||
arm64: aarch64
|
|
||||||
files:
|
|
||||||
- LICENSE
|
|
||||||
- README.md
|
|
||||||
- itd.toml
|
|
||||||
- itd.service
|
|
||||||
nfpms:
|
|
||||||
- id: itd
|
|
||||||
file_name_template: '{{.PackageName}}-{{.Version}}-{{.Os}}-{{.Arch}}'
|
|
||||||
description: "Companion daemon for the InfiniTime firmware on the PineTime smartwatch"
|
|
||||||
replacements:
|
|
||||||
386: i386
|
|
||||||
amd64: x86_64
|
|
||||||
arm64: aarch64
|
|
||||||
homepage: 'https://gitea.arsenm.dev/Arsen6331/itd'
|
|
||||||
maintainer: 'Arsen Musyaelyan <arsen@arsenm.dev>'
|
|
||||||
license: GPLv3
|
|
||||||
formats:
|
|
||||||
- apk
|
|
||||||
- deb
|
|
||||||
- rpm
|
|
||||||
dependencies:
|
|
||||||
- dbus
|
|
||||||
- bluez
|
|
||||||
- pulseaudio-utils
|
|
||||||
contents:
|
|
||||||
- src: itd.toml
|
|
||||||
dst: /etc/itd.toml
|
|
||||||
type: "config|noreplace"
|
|
||||||
- src: itd.service
|
|
||||||
dst: /usr/lib/systemd/user/itd.service
|
|
||||||
aurs:
|
|
||||||
- name: itd-bin
|
|
||||||
homepage: 'https://gitea.arsenm.dev/Arsen6331/itd'
|
|
||||||
description: "Companion daemon for the InfiniTime firmware on the PineTime smartwatch"
|
|
||||||
maintainers:
|
|
||||||
- 'Arsen Musyaelyan <arsen@arsenm.dev>'
|
|
||||||
license: GPLv3
|
|
||||||
private_key: '{{ .Env.AUR_KEY }}'
|
|
||||||
git_url: 'ssh://aur@aur.archlinux.org/itd-bin.git'
|
|
||||||
provides:
|
|
||||||
- itd
|
|
||||||
- itctl
|
|
||||||
conflicts:
|
|
||||||
- itd
|
|
||||||
- itctl
|
|
||||||
depends:
|
|
||||||
- dbus
|
|
||||||
- bluez
|
|
||||||
- libpulse
|
|
||||||
package: |-
|
|
||||||
# binaries
|
|
||||||
install -Dm755 "./itd" "${pkgdir}/usr/bin/itd"
|
|
||||||
install -Dm755 "./itctl" "${pkgdir}/usr/bin/itctl"
|
|
||||||
|
|
||||||
# service
|
|
||||||
install -Dm644 "./itd.service" ${pkgdir}/usr/lib/systemd/user/itd.service
|
|
||||||
|
|
||||||
# config
|
|
||||||
install -Dm644 "./itd.toml" ${pkgdir}/etc/itd.toml
|
|
||||||
|
|
||||||
# license
|
|
||||||
install -Dm644 "./LICENSE" "${pkgdir}/usr/share/licenses/itd/LICENSE"
|
|
||||||
release:
|
|
||||||
gitea:
|
|
||||||
owner: Arsen6331
|
|
||||||
name: itd
|
|
||||||
gitea_urls:
|
|
||||||
api: 'https://gitea.arsenm.dev/api/v1/'
|
|
||||||
download: 'https://gitea.arsenm.dev'
|
|
||||||
skip_tls_verify: false
|
|
||||||
checksum:
|
|
||||||
name_template: 'checksums.txt'
|
|
||||||
snapshot:
|
|
||||||
name_template: "{{ incpatch .Version }}-next"
|
|
||||||
changelog:
|
|
||||||
sort: asc
|
|
||||||
4
Makefile
4
Makefile
@@ -4,8 +4,8 @@ SERVICE_PREFIX = $(DESTDIR)$(PREFIX)/lib/systemd/user
|
|||||||
CFG_PREFIX = $(DESTDIR)/etc
|
CFG_PREFIX = $(DESTDIR)/etc
|
||||||
|
|
||||||
all: version.txt
|
all: version.txt
|
||||||
go build
|
go build $(GOFLAGS)
|
||||||
go build ./cmd/itctl
|
go build ./cmd/itctl $(GOFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f itctl
|
rm -f itctl
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
`itd` is a daemon that uses my infinitime [library](https://go.arsenm.dev/infinitime) to interact with the [PineTime](https://www.pine64.org/pinetime/) running [InfiniTime](https://infinitime.io).
|
`itd` is a daemon that uses my infinitime [library](https://go.arsenm.dev/infinitime) to interact with the [PineTime](https://www.pine64.org/pinetime/) running [InfiniTime](https://infinitime.io).
|
||||||
|
|
||||||
[](https://ci.appveyor.com/project/moussaelianarsen/itd-7t6ko)
|
[](https://ci.appveyor.com/project/moussaelianarsen/itd)
|
||||||
[](https://minio.arsenm.dev/minio/itd/)
|
[](https://minio.arsenm.dev/minio/itd/)
|
||||||
[](https://aur.archlinux.org/packages/itd-git/)
|
[](https://aur.archlinux.org/packages/itd-git/)
|
||||||
|
|
||||||
@@ -105,22 +105,12 @@ Use "itctl [command] --help" for more information about a command.
|
|||||||
|
|
||||||
### `itgui`
|
### `itgui`
|
||||||
|
|
||||||
In `cmd/itgui`, there is a gui frontend to the socket of `itd`. It uses the [Fyne library](https://fyne.io/) for Go.
|
In `cmd/itgui`, there is a gui frontend to the socket of `itd`. It uses the [fyne library](https://fyne.io/) for Go. It can be compiled by running:
|
||||||
|
|
||||||
#### Compilation
|
|
||||||
|
|
||||||
Before compiling, certain prerequisites must be installed. These are listed on the following page: https://developer.fyne.io/started/#prerequisites
|
|
||||||
|
|
||||||
It can be compiled by running:
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
go build ./cmd/itgui
|
go build ./cmd/itgui
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Cross-compilation
|
|
||||||
|
|
||||||
Due to the use of OpenGL, cross-compilation of `itgui` isn't as simple as that of `itd` and `itctl`. The following guide from the Fyne website should work for `itgui`: https://developer.fyne.io/started/cross-compiling.
|
|
||||||
|
|
||||||
#### Screenshots
|
#### Screenshots
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@@ -25,17 +24,8 @@ func main() {
|
|||||||
syscall.SIGTERM,
|
syscall.SIGTERM,
|
||||||
)
|
)
|
||||||
|
|
||||||
// This goroutine ensures that itctl will exit
|
|
||||||
// at most 200ms after the user sends SIGINT/SIGTERM.
|
|
||||||
go func() {
|
|
||||||
<-ctx.Done()
|
|
||||||
time.Sleep(200*time.Millisecond)
|
|
||||||
os.Exit(0)
|
|
||||||
}()
|
|
||||||
|
|
||||||
app := cli.App{
|
app := cli.App{
|
||||||
Name: "itctl",
|
Name: "itctl",
|
||||||
HideHelpCommand: true,
|
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "socket-path",
|
Name: "socket-path",
|
||||||
@@ -45,12 +35,6 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Commands: []*cli.Command{
|
Commands: []*cli.Command{
|
||||||
{
|
|
||||||
Name: "help",
|
|
||||||
ArgsUsage: "<command>",
|
|
||||||
Usage: "Display help screen for a command",
|
|
||||||
Action: helpCmd,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "filesystem",
|
Name: "filesystem",
|
||||||
Aliases: []string{"fs"},
|
Aliases: []string{"fs"},
|
||||||
@@ -245,13 +229,11 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Before: func(c *cli.Context) error {
|
Before: func(c *cli.Context) error {
|
||||||
if !isHelpCmd() {
|
newClient, err := api.New(c.String("socket-path"))
|
||||||
newClient, err := api.New(c.String("socket-path"))
|
if err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
client = newClient
|
|
||||||
}
|
}
|
||||||
|
client = newClient
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
After: func(*cli.Context) error {
|
After: func(*cli.Context) error {
|
||||||
@@ -267,21 +249,3 @@ func main() {
|
|||||||
log.Fatal().Err(err).Msg("Error while running app")
|
log.Fatal().Err(err).Msg("Error while running app")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func helpCmd(c *cli.Context) error {
|
|
||||||
cmdArgs := append([]string{os.Args[0]}, c.Args().Slice()...)
|
|
||||||
cmdArgs = append(cmdArgs, "-h")
|
|
||||||
return c.App.RunContext(c.Context, cmdArgs)
|
|
||||||
}
|
|
||||||
|
|
||||||
func isHelpCmd() bool {
|
|
||||||
if len(os.Args) == 1 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
for _, arg := range os.Args {
|
|
||||||
if arg == "-h" || arg == "help" {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
4
go.mod
4
go.mod
@@ -15,7 +15,7 @@ require (
|
|||||||
github.com/mozillazg/go-pinyin v0.19.0
|
github.com/mozillazg/go-pinyin v0.19.0
|
||||||
github.com/rs/zerolog v1.26.1
|
github.com/rs/zerolog v1.26.1
|
||||||
github.com/urfave/cli/v2 v2.3.0
|
github.com/urfave/cli/v2 v2.3.0
|
||||||
go.arsenm.dev/infinitime v0.0.0-20220819210252-d199fba93c2f
|
go.arsenm.dev/infinitime v0.0.0-20220511202257-9ed74726c478
|
||||||
go.arsenm.dev/lrpc v0.0.0-20220513001344-3bcc01fdb6a0
|
go.arsenm.dev/lrpc v0.0.0-20220513001344-3bcc01fdb6a0
|
||||||
golang.org/x/text v0.3.7
|
golang.org/x/text v0.3.7
|
||||||
modernc.org/sqlite v1.17.2
|
modernc.org/sqlite v1.17.2
|
||||||
@@ -42,7 +42,7 @@ require (
|
|||||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||||
github.com/muka/go-bluetooth v0.0.0-20220819140550-1d8857e3b268 // indirect
|
github.com/muka/go-bluetooth v0.0.0-20220219050759-674a63b8741a // indirect
|
||||||
github.com/pelletier/go-toml v1.9.3 // indirect
|
github.com/pelletier/go-toml v1.9.3 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
|
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
|
||||||
|
|||||||
8
go.sum
8
go.sum
@@ -301,8 +301,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
|
|||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
github.com/mozillazg/go-pinyin v0.19.0 h1:p+J8/kjJ558KPvVGYLvqBhxf8jbZA2exSLCs2uUVN8c=
|
github.com/mozillazg/go-pinyin v0.19.0 h1:p+J8/kjJ558KPvVGYLvqBhxf8jbZA2exSLCs2uUVN8c=
|
||||||
github.com/mozillazg/go-pinyin v0.19.0/go.mod h1:iR4EnMMRXkfpFVV5FMi4FNB6wGq9NV6uDWbUuPhP4Yc=
|
github.com/mozillazg/go-pinyin v0.19.0/go.mod h1:iR4EnMMRXkfpFVV5FMi4FNB6wGq9NV6uDWbUuPhP4Yc=
|
||||||
github.com/muka/go-bluetooth v0.0.0-20220819140550-1d8857e3b268 h1:kOnq7TfaAO2Vc/MHxPqFIXe00y1qBxJAvhctXdko6vo=
|
github.com/muka/go-bluetooth v0.0.0-20220219050759-674a63b8741a h1:fnzS9RRQW8B5AgNCxkN0vJ/AoX+Xfqk3sAYon3iVrzA=
|
||||||
github.com/muka/go-bluetooth v0.0.0-20220819140550-1d8857e3b268/go.mod h1:dMCjicU6vRBk34dqOmIZm0aod6gUwZXOXzBROqGous0=
|
github.com/muka/go-bluetooth v0.0.0-20220219050759-674a63b8741a/go.mod h1:dMCjicU6vRBk34dqOmIZm0aod6gUwZXOXzBROqGous0=
|
||||||
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
|
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
|
||||||
github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
|
github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||||
@@ -396,8 +396,8 @@ github.com/yuin/goldmark v1.3.8/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
|
|||||||
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
github.com/yuin/goldmark v1.4.4 h1:zNWRjYUW32G9KirMXYHQHVNFkXvMI7LpgNW2AgYAoIs=
|
github.com/yuin/goldmark v1.4.4 h1:zNWRjYUW32G9KirMXYHQHVNFkXvMI7LpgNW2AgYAoIs=
|
||||||
github.com/yuin/goldmark v1.4.4/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
|
github.com/yuin/goldmark v1.4.4/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
|
||||||
go.arsenm.dev/infinitime v0.0.0-20220819210252-d199fba93c2f h1:Np0ZNlgVC5D9NOilN14HJ1mSXM8vl2LYGfK0fZOYUbY=
|
go.arsenm.dev/infinitime v0.0.0-20220511202257-9ed74726c478 h1:HO+fteXuSnnT7po1PhGJK6nk8qMAGN2RqDaVP4sRN8g=
|
||||||
go.arsenm.dev/infinitime v0.0.0-20220819210252-d199fba93c2f/go.mod h1:K3NJ6fyPv5qqHUedB3MccKOE0whJMJZ80l/yTzzTrgc=
|
go.arsenm.dev/infinitime v0.0.0-20220511202257-9ed74726c478/go.mod h1:1cBQ3fp6QlRbSqu9kEBAHsVThINj31FtqHIYVsQ7wgg=
|
||||||
go.arsenm.dev/lrpc v0.0.0-20220513001344-3bcc01fdb6a0 h1:1K96g1eww+77GeGchwMhd0NTrs7Mk/Hc3M3ItW5NbG4=
|
go.arsenm.dev/lrpc v0.0.0-20220513001344-3bcc01fdb6a0 h1:1K96g1eww+77GeGchwMhd0NTrs7Mk/Hc3M3ItW5NbG4=
|
||||||
go.arsenm.dev/lrpc v0.0.0-20220513001344-3bcc01fdb6a0/go.mod h1:goK9z735lfXmqlDxu9qN7FS8t0HJHN3PjyDtCToUY4w=
|
go.arsenm.dev/lrpc v0.0.0-20220513001344-3bcc01fdb6a0/go.mod h1:goK9z735lfXmqlDxu9qN7FS8t0HJHN3PjyDtCToUY4w=
|
||||||
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
||||||
|
|||||||
Reference in New Issue
Block a user