summaryrefslogtreecommitdiffstats
path: root/recipes-core/packagegroups/packagegroup-agl-image-ivi.bbappend
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-02-23 02:02:59 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-03-15 19:29:21 +0000
commitc8165b474fe2f456334e135ec1ebd41f4906336c (patch)
treebdd9165e81d5ad5a1b8222038e02ec3ef40e1166 /recipes-core/packagegroups/packagegroup-agl-image-ivi.bbappend
parent61603255c139216149f71a63426e2bdffc819609 (diff)
recipes-demo-hmi: libqtappfw: update SRCREV
* libqtappfw: network: add invalidPassphrase signal * libqtappfw: message: add replyStatus/requestData methods * libqtappfw: network: sort WiFI model by SSID * libqtappfw: network: add remove() method for removal of services * libqtappfw: mediaplayer: update loop command parameter * libqtappfw: mediaplayer: send empty artist + album data * libqtappfw: mediaplayer: update loop command parameter Bug-AGL: SPEC-2181 Change-Id: I3f58bd4dab1d769a81fa83e8a3d476576e200605 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'recipes-core/packagegroups/packagegroup-agl-image-ivi.bbappend')
0 files changed, 0 insertions, 0 deletions
ht .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * Copyright (C) 2017-2018 "IoT.bzh"
 * Author Sebastien Douheret <sebastien@iot.bzh>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package xdsconfig

import (
	"errors"
	"net"

	"gerrit.automotivelinux.org/gerrit/src/xds/xds-server/lib/xsapiv1"
)

// NewBuilderConfig creates a new BuilderConfig instance
func NewBuilderConfig(stID string) (xsapiv1.BuilderConfig, error) {
	// Do we really need it ? may be not accessible from client side
	ip, err := getLocalIP()
	if err != nil {
		return xsapiv1.BuilderConfig{}, err
	}

	b := xsapiv1.BuilderConfig{
		IP:          ip, // TODO currently not used
		Port:        "", // TODO currently not used
		SyncThingID: stID,
	}
	return b, nil
}

/*** Private ***/

func getLocalIP() (string, error) {
	addrs, err := net.InterfaceAddrs()
	if err != nil {
		return "", err
	}
	for _, address := range addrs {
		// check the address type and if it is not a loopback the display it
		if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
			if ipnet.IP.To4() != nil {
				return ipnet.IP.String(), nil
			}
		}
	}
	return "", errors.New("Cannot determined local IP")
}