/**
* Adds a device to the user's list of devices if it is not yet added.
*/
public void addMyDevice(GoosciDeviceSpec.DeviceSpec device) {
GoosciUserMetadata.UserMetadata userMetadata = getUserMetadata();
if (userMetadata == null) {
return;
}
GoosciDeviceSpec.DeviceSpec[] myDevices = userMetadata.myDevices;
for (GoosciDeviceSpec.DeviceSpec myDevice : myDevices) {
if (MessageNano.messageNanoEquals(myDevice, device)) {
return;
}
}
GoosciDeviceSpec.DeviceSpec[] newSpecs = Arrays.copyOf(myDevices, myDevices.length + 1);
newSpecs[newSpecs.length - 1] = device;
userMetadata.myDevices = newSpecs;
// TODO: capture this pattern (read, null check, write) in a helper method?
startWriteTimer();
}
UserMetadataManager.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:science-journal
作者:
评论列表
文章目录