We are attempting to port a Go application to the WP77 target. The use of custom compile tools (mkapp, etc.) complicates the use of cgo. To at least get something working I am leaning towards the approach shown in a prior thread. In this thread, the Go code is able to interact with a legato defined API once the Protocol ID is resolved (all other information can be gathered prior to runtime).
If I am trying to interact with a predefined service API (unlike the prior thread that defines a new printer API), how can I resolve the Protocol ID and Name at runtime?
I have gotten cgo working so just going to go that route.
Compile Commands
. /opt/swi/SWI9X06Y_03.00.13.00/environment-setup-armv7a-neon-poky-linux-gnueabi
go generate ./
CC=$CC GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 go build ./legatoutil.go
mkapp -w /tmp/pabuild -t wp77xx ./legatoutil.adef
cgo Header
This needs to be in one file in the package calling legato libraries. It can probably also be cleaned up by using the LEGATO_ROOT environment variable.
// Disable the sandbox security to make things a little easier.
sandboxed: false
// Put the cross-compiled legacy program in the app's bin directory.
// [x] = make it executable.
bundles:
{
file:
{
[x] $CURDIR/legatoutil /bin/legatoutil
}
}
extern:
{
requires:
{
le_mdc = $LEGATO_ROOT/interfaces/modemServices/le_mdc.api
}
}
bindings:
{
*.le_mdc -> modemService.le_mdc
}