parent
b141867b87
commit
4585d3f4a2
@ -1,5 +1,5 @@
|
||||
package go_library
|
||||
|
||||
func Version() string {
|
||||
return "1.0.132"
|
||||
return "1.0.133"
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
package caiyunapp
|
||||
|
||||
// GetRealtimeUltravioletDesc 紫外线 https://docs.caiyunapp.com/docs/tables/lifeindex
|
||||
func GetRealtimeUltravioletDesc(ultraviolet float64) string {
|
||||
if ultraviolet <= 0 {
|
||||
return "无"
|
||||
} else if ultraviolet <= 1 {
|
||||
return "很弱"
|
||||
} else if ultraviolet <= 2 {
|
||||
return "很弱"
|
||||
} else if ultraviolet <= 3 {
|
||||
return "弱"
|
||||
} else if ultraviolet <= 4 {
|
||||
return "弱"
|
||||
} else if ultraviolet <= 5 {
|
||||
return "中等"
|
||||
} else if ultraviolet <= 6 {
|
||||
return "中等"
|
||||
} else if ultraviolet <= 7 {
|
||||
return "强"
|
||||
} else if ultraviolet <= 8 {
|
||||
return "强"
|
||||
} else if ultraviolet <= 9 {
|
||||
return "强"
|
||||
} else if ultraviolet <= 10 {
|
||||
return "很强"
|
||||
} else if ultraviolet <= 11 {
|
||||
return "极强"
|
||||
}
|
||||
return "无"
|
||||
}
|
||||
|
||||
// GetDailyUltravioletDesc 紫外线 https://docs.caiyunapp.com/docs/tables/lifeindex
|
||||
func GetDailyUltravioletDesc(ultraviolet string) string {
|
||||
if ultraviolet <= "1" {
|
||||
return "最弱"
|
||||
} else if ultraviolet <= "2" {
|
||||
return "弱"
|
||||
} else if ultraviolet <= "3" {
|
||||
return "中等"
|
||||
} else if ultraviolet <= "4" {
|
||||
return "强"
|
||||
} else if ultraviolet <= "5" {
|
||||
return "很强"
|
||||
}
|
||||
return "无"
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build aix || solaris
|
||||
// +build aix solaris
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// ioctl itself should not be exposed directly, but additional get/set
|
||||
// functions for specific types are permissible.
|
||||
|
||||
// IoctlSetInt performs an ioctl operation which sets an integer value
|
||||
// on fd, using the specified request number.
|
||||
func IoctlSetInt(fd int, req int, value int) error {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
// IoctlSetPointerInt performs an ioctl operation which sets an
|
||||
// integer value on fd, using the specified request number. The ioctl
|
||||
// argument is called with a pointer to the integer value, rather than
|
||||
// passing the integer value directly.
|
||||
func IoctlSetPointerInt(fd int, req int, value int) error {
|
||||
v := int32(value)
|
||||
return ioctlPtr(fd, req, unsafe.Pointer(&v))
|
||||
}
|
||||
|
||||
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
||||
//
|
||||
// To change fd's window size, the req argument should be TIOCSWINSZ.
|
||||
func IoctlSetWinsize(fd int, req int, value *Winsize) error {
|
||||
// TODO: if we get the chance, remove the req parameter and
|
||||
// hardcode TIOCSWINSZ.
|
||||
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||
}
|
||||
|
||||
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
||||
//
|
||||
// The req value will usually be TCSETA or TIOCSETA.
|
||||
func IoctlSetTermios(fd int, req int, value *Termios) error {
|
||||
// TODO: if we get the chance, remove the req parameter.
|
||||
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||
}
|
||||
|
||||
// IoctlGetInt performs an ioctl operation which gets an integer value
|
||||
// from fd, using the specified request number.
|
||||
//
|
||||
// A few ioctl requests use the return value as an output parameter;
|
||||
// for those, IoctlRetInt should be used instead of this function.
|
||||
func IoctlGetInt(fd int, req int) (int, error) {
|
||||
var value int
|
||||
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||
return value, err
|
||||
}
|
||||
|
||||
func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
|
||||
var value Winsize
|
||||
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlGetTermios(fd int, req int) (*Termios, error) {
|
||||
var value Termios
|
||||
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||
return &value, err
|
||||
}
|
Loading…
Reference in new issue