Beispiel #1
0
func (nc *NmCommand) GetIcon() image.Image {
	str, err := nc.ap.Strength()
	if err != nil {
		return images.WifiDC
	}

	flags, err := nc.ap.Flags()
	if err != nil {
		flags = 0
	}

	if (flags & 1) == 1 {
		img := image.NewRGBA(image.Rect(0, 0, 16, 16))

		draw.Draw(img, image.Rect(0, 0, 16, 16), images.WifiStrengthImage(str), image.Point{0, 0}, draw.Over)
		draw.Draw(img, image.Rect(0, 0, 16, 16), images.WifiEnc, image.Point{0, 0}, draw.Over)

		return img
	}

	return images.WifiStrengthImage(str)
}
Beispiel #2
0
func (icon *SbNmWifi) Icon() image.Image {
	active, err := icon.Dev.GetActive()
	if err != nil {
		return images.WifiDC
	}

	if active == nil {
		return images.WifiDC
	}

	str, err := active.Strength()
	if err != nil {
		str = 0
	}

	return images.WifiStrengthImage(str)
}