示例#1
0
func main() {

	initVars()

	StartMQTT()

	wg.Add(1)

	conn = network.GetUCastConn(ucastAddr)

	inverters := invs.New()
	go newLoginChannelHandler()
	go newInverterChannelHanndler()
	go network.StartListener(conn, submitNewInverter)

	go network.InverterFinder(conn, mcastAddr)
	go network.StartBcastListener(bcastAddr)

	go inverters.StartPoller()

	wg.Wait()
	wg.Done()
}
示例#2
0
var done chan int
var wg sync.WaitGroup

//
var mcastAddr *net.UDPAddr
var bcastAddr *net.UDPAddr
var ucastAddr *net.UDPAddr
var conn *net.UDPConn

var appSUSyID int = AppSUSyID
var appSerial []byte = getSerial()

var mqs *MQTTSettings

var inverters *invs.Inverters = invs.New()

//
//
//
func initVars() {

	done = make(chan int)

	resolvAddrs()

	password := flag.String("password", "0000", "Inverter password")
	groupType := flag.String("grouptype", "USER", "'USER' or 'INSTALLER'")
	server := flag.String("server", "tcp://notify.erkkila.org:1883", "The MQTT server to connect to")
	topic := flag.String("topic", "smapoller", "The chat room to enter. default 'smapoller'")
	name := flag.String("name", "pee", "Username to be displayed")