You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
implemented native type parsing without wrapping types
The response bit in the Tag field is ignored due the fact there is no known need to take care on this.
Ths lib is in early stage.
Usage
There are multiple user levels (NO_AUTH => USER ... => ADMIN => E3DC_ROOT). For most cases NO_AUTH and USER level access is enough.Therefore before sending a request towards you E3DC system we need to authenticate first.
Every requests towards RSCP system consists of a rscp::Frame (container) with multiple rscp::Item with the later holding the tags and data.
Login and First Frame
RSCP_KEY is the password you define on your S10 screen in Settings => Personalize => User Profile +> local.user RSCP_USER is is the username (i.e. email ) in your S10 portal. RSCP_PASSWORD is the password in your S10 portal
use rscp::GetItem;letmut c = rscp::Client::new("RSCP_KEY","RSCP_USER".to_string(),"RSCP_PASSWORD".to_string());match c.connect("energy.storage.local",None){Ok(_) =>(),Err(err) =>{panic!("Unable to connect: {:?}", err);}}letmut info_frame = rscp::Frame::new();info_frame.push_item(rscp::Item{tag: rscp::tags::INFO::SERIAL_NUMBER.into(),data:None});info_frame.push_item(rscp::Item{tag: rscp::tags::INFO::MAC_ADDRESS.into(),data:None});info_frame.push_item(rscp::Item{tag: rscp::tags::INFO::SW_RELEASE.into(),data:None});match c.send_receive_frame(&info_frame){Ok(result_frame) =>{println!("{}", result_frame.get_item_data::<String>(rscp::tags::INFO::SERIAL_NUMBER.into()).unwrap());},Err(err) =>{warn!("Unable send: {:?}", err);}}c.disconnect().unwrap();
Compose Battery Information Request
Similarly to the official example of the rscp call to request battery information, we can also define a containered request. TheBAT::DATA tag defines that the following tagsshould be evaluated to receive some data about the battery.
Be careful which tag you use in your requests because some tags set values instead of getting them. The official example app documentation and excel table provide necessary informationto distinguish between these tags.
The structure of tags in this project is similar to the documentation of tags but not necessarily to the tags in the official example app.For Example this official tag:#define TAG_BAT_INDEX 0x03040001 corresponds to project tag:
rscp::tags::BAT::INDEX:
BAT = 0x03,
INDEX = 0x040001,
The advantage lies in the reuse of tag names and therefore in readability of code.