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
The current implementation lacks the functionality to retrieve the list of supported user properties.
My suggestion is to add 2 new structures GenericUserPropertiesGet and GenericUserPropertiesStatus, described in Mesh Models documentation, sections 3.2.8.1 and 3.2.8.2 respectively.
The implementation could look something like this:
publicclassGenericUserPropertiesGet extends ApplicationMessage {
private static finalStringTAG=GenericUserPropertiesGet.class.getSimpleName();
private static final int OP_CODE=ApplicationMessageOpCodes.GENERIC_USER_PROPERTIES_GET;
/** * Constructs GenericLevelGet message. * * @param appKey {@link ApplicationKey} key for this message * @throws IllegalArgumentException if any illegal arguments are passed*/publicGenericUserPropertiesGet(@NonNull finalApplicationKey appKey) throws IllegalArgumentException {
super(appKey);
assembleMessageParameters();
}
@Override
public int getOpCode() {
returnOP_CODE;
}
@Override
void assembleMessageParameters() {
mAid =SecureUtils.calculateK4(mAppKey.getKey());
}
}
and
publicclassGenericUserPropertiesStatus extends ApplicationStatusMessage implements Parcelable {
privatefinal int opCode;
privateArrayList<Short> propertyIds;
private static finalCreator<GenericUserPropertiesStatus> CREATOR= new Creator<GenericUserPropertiesStatus>() {
@Override
publicGenericUserPropertiesStatus createFromParcel(Parcelin) {
finalAccessMessage message =in.readParcelable(AccessMessage.class.getClassLoader());
//noinspection ConstantConditionsreturn new GenericUserPropertiesStatus(message);
}
@Override
publicGenericUserPropertiesStatus[] newArray(int size) {
return new GenericUserPropertiesStatus[size];
}
};
publicGenericUserPropertiesStatus(@NonNull finalAccessMessage message) {
super(message);
this.opCode = message.getOpCode();
this.mMessage = message;
this.mParameters = message.getParameters();
parseStatusParameters();
}
@Override
void parseStatusParameters() {
BitReader bitReader = new BitReader(mParameters);
propertyIds = new ArrayList<Short>(mParameters.length /2);
for(int i =0; i < mParameters.length; i +=2) {
int firstPropertyByte = bitReader.getBits(8);
int secondPropertyByte = bitReader.getBits(8);
propertyIds.add((short) (secondPropertyByte <<8 | firstPropertyByte));
}
}
@Override
public int getOpCode() {
return opCode;
}
@Override
public int describeContents() {
return0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
finalAccessMessage message = (AccessMessage) mMessage;
dest.writeParcelable(message, flags);
}
publicArrayList<Short> getPropertyIds() {
return propertyIds;
}
}
The text was updated successfully, but these errors were encountered:
Also, a slight change needs to be made in DefaultNoOperationMessageState, we need to handle a new single byte opCode inside of parseAccessMessage method
The current implementation lacks the functionality to retrieve the list of supported user properties.
My suggestion is to add 2 new structures
GenericUserPropertiesGet
andGenericUserPropertiesStatus
, described in Mesh Models documentation, sections 3.2.8.1 and 3.2.8.2 respectively.The implementation could look something like this:
and
The text was updated successfully, but these errors were encountered: