Beispiel #1
0
func handleClientChange(testserver *dcams.Manifest) {
	log.Println("handleClientChange", testserver)
	for {
		mMsg, err := testserver.Resource("springInput").Read()

		//log.Println("handleClientChange:", mMsg)

		if err != nil {
			continue
		}
		err = testserver.Resource("springInput").Write("echo" + mMsg)
		if err != nil {
			continue
		}

		var Msg Location
		if err := json.Unmarshal([]byte(mMsg), &Msg); err != nil {
			//ignore things that arent Messages marshalled as json
			continue
		}
		publish <- Msg
	}
}
Beispiel #2
0
func upstreamRequests(testserver *dcams.Manifest) {
	log.Println("upstreamRequests", testserver)
	for {
		mMsg, err := testserver.Resource("springInput").Read()

		//log.Println("upstreamRequests:", mMsg)

		if err != nil {
			continue
		}
		err = testserver.Resource("springInput").Write("echo" + mMsg)
		if err != nil {
			continue
		}

		var Msg NodeState
		if err := json.Unmarshal([]byte(mMsg), &Msg); err != nil {
			//ignore things that arent Messages marshalled as json
			continue
		}
		changerequests <- Msg
	}
}
Beispiel #3
0
func eventRequester(d *dcams.Manifest) {
	for {
		select {
		case e := <-ClientEvents:
			mmsg, err := json.Marshal(e)
			if err != nil {
				log.Println("eventRequester() Bad Data", err)
				continue
			}

			err = d.Resource("springInput").Write(string(mmsg))
			if err != nil {
				log.Println("eventRequester() REQ fail", err)
				continue
			}

			_, err = d.Resource("springInput").Read()
			if err != nil {
				log.Println("eventRequester() server REP fail", err)
				continue
			}
		}
	}
}