这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Structure extends AbstractMessagePart implements DataModelElement {

/**
* Describes the Structure state; see the Away Guide for more information.
*
*
* @see <a href="https://developer.nest.com/documentation/cloud/structure-guide">Structure state</a>
* @see <a href="https://developer.nest.com/documentation/cloud/away-guide">Away Guide</a>
* @see <a href="https://developer.nest.com/documentation/cloud/api-overview#away">API Overview</a>
Expand Down Expand Up @@ -287,35 +287,41 @@ public void setEta(ETA eta) {
}

/**
* This method creates maps to device objects, using the list of device IDs that were unmarshalled from JSON.
* This method creates maps to device objects, using the list of device IDs that were deserialized from JSON.
*/
@Override
public void sync(DataModel dataModel) {
// Build named-based maps from ID-based maps
this.thermostats_by_name = new HashMap<String, Thermostat>();
if (this.thermostat_id_list != null) {
for (String id : this.thermostat_id_list) {
Thermostat th = dataModel.getDevices().getThermostats_by_id().get(id);
if (th != null) {
this.thermostats_by_name.put(th.getName(), th);
if (dataModel.getDevices() != null && dataModel.getDevices().getThermostats_by_id() != null) {
Thermostat th = dataModel.getDevices().getThermostats_by_id().get(id);
if (th != null) {
this.thermostats_by_name.put(th.getName(), th);
}
}
}
}
this.smoke_co_alarms_by_name = new HashMap<String, SmokeCOAlarm>();
if (this.smoke_co_alarm_id_list != null) {
for (String id : this.smoke_co_alarm_id_list) {
SmokeCOAlarm sm = dataModel.getDevices().getSmoke_co_alarms_by_id().get(id);
if (sm != null) {
this.smoke_co_alarms_by_name.put(sm.getName(), sm);
if (dataModel.getDevices() != null && dataModel.getDevices().getSmoke_co_alarms_by_id() != null) {
SmokeCOAlarm sm = dataModel.getDevices().getSmoke_co_alarms_by_id().get(id);
if (sm != null) {
this.smoke_co_alarms_by_name.put(sm.getName(), sm);
}
}
}
}
this.cameras_by_name = new HashMap<String, Camera>();
if (this.camera_id_list != null) {
for (String id : this.camera_id_list) {
Camera cam = dataModel.getDevices().getCameras_by_id().get(id);
if (cam != null) {
this.cameras_by_name.put(cam.getName(), cam);
if (dataModel.getDevices() != null && dataModel.getDevices().getCameras_by_id() != null) {
Camera cam = dataModel.getDevices().getCameras_by_id().get(id);
if (cam != null) {
this.cameras_by_name.put(cam.getName(), cam);
}
}
}
}
Expand Down