// SetData sets data by pathes
SetData sets data by pathes
// SetData sets data by pathes
func (adapter *TelemetryEmulatorAdapter) SetData(data map[string]interface{}) (err error) {
	sendData, err := convertVisFormatToData(data)
	if err != nil {
		return err
	}
	path, err := url.Parse("attributes/")
	if err != nil {
		return err
	}
	address := adapter.sensorURL.ResolveReference(path).String()
	log.WithField("url", address).Debugf("Set data to sensor emulator: %s", string(sendData))
	res, err := http.Post(address, "application/json", bytes.NewReader(sendData))
	if err != nil {
		return err
	}
	if res.StatusCode != 201 {
		return errors.New(res.Status)
	}
	return adapter.baseAdapter.SetData(data)
}
func ( adapter * TelemetryEmulatorAdapter ) SetData ( data map [ string ] interface { } ) ( err error ) { sendData , err := convertVisFormatToData ( data ) if err != nil { return err } path , err := url . Parse ( " " ) if err != nil { return err } address := adapter . sensorURL . ResolveReference ( path ) . String ( ) log . WithField ( " " , address ) . Debugf ( " " , string ( sendData ) ) res , err := http . Post ( address , " " , bytes . NewReader ( sendData ) ) if err != nil { return err } if res . StatusCode != 201 { return errors . New ( res . Status ) } return adapter . baseAdapter . SetData ( data ) }
SetData sets data by pathes
SetData sets data by pathes