Lines Matching defs:packet

126 bool MtpProperty::read(MtpDataPacket& packet) {
129 if (!packet.getUInt16(mCode)) return false;
131 if (!packet.getUInt16(mType)) return false;
132 if (!packet.getUInt8(temp8)) return false;
145 mDefaultArrayValues = readArrayValues(packet, mDefaultArrayLength);
148 mCurrentArrayValues = readArrayValues(packet, mCurrentArrayLength);
153 if (!readValue(packet, mDefaultValue)) return false;
155 if (!readValue(packet, mCurrentValue)) return false;
159 if (!packet.getUInt32(mGroupCode)) return false;
161 if (!packet.getUInt8(mFormFlag)) return false;
164 if (!readValue(packet, mMinimumValue)) return false;
165 if (!readValue(packet, mMaximumValue)) return false;
166 if (!readValue(packet, mStepSize)) return false;
168 if (!packet.getUInt16(mEnumLength)) return false;
171 if (!readValue(packet, mEnumValues[i])) return false;
178 void MtpProperty::write(MtpDataPacket& packet) {
181 packet.putUInt16(mCode);
182 packet.putUInt16(mType);
183 packet.putUInt8(mWriteable ? 1 : 0);
196 writeArrayValues(packet, mDefaultArrayValues, mDefaultArrayLength);
198 writeArrayValues(packet, mCurrentArrayValues, mCurrentArrayLength);
201 writeValue(packet, mDefaultValue);
203 writeValue(packet, mCurrentValue);
206 packet.putUInt32(mGroupCode);
207 packet.putUInt8(mFormFlag);
209 writeValue(packet, mMinimumValue);
210 writeValue(packet, mMaximumValue);
211 writeValue(packet, mStepSize);
213 packet.putUInt16(mEnumLength);
215 writeValue(packet, mEnumValues[i]);
239 void MtpProperty::setCurrentValue(MtpDataPacket& packet) {
242 readValue(packet, mCurrentValue);
429 bool MtpProperty::readValue(MtpDataPacket& packet, MtpPropertyValue& value) {
435 if (!packet.getInt8(value.u.i8)) return false;
439 if (!packet.getUInt8(value.u.u8)) return false;
443 if (!packet.getInt16(value.u.i16)) return false;
447 if (!packet.getUInt16(value.u.u16)) return false;
451 if (!packet.getInt32(value.u.i32)) return false;
455 if (!packet.getUInt32(value.u.u32)) return false;
459 if (!packet.getInt64(value.u.i64)) return false;
463 if (!packet.getUInt64(value.u.u64)) return false;
467 if (!packet.getInt128(value.u.i128)) return false;
471 if (!packet.getUInt128(value.u.u128)) return false;
474 if (!packet.getString(stringBuffer)) return false;
484 void MtpProperty::writeValue(MtpDataPacket& packet, MtpPropertyValue& value) {
490 packet.putInt8(value.u.i8);
494 packet.putUInt8(value.u.u8);
498 packet.putInt16(value.u.i16);
502 packet.putUInt16(value.u.u16);
506 packet.putInt32(value.u.i32);
510 packet.putUInt32(value.u.u32);
514 packet.putInt64(value.u.i64);
518 packet.putUInt64(value.u.u64);
522 packet.putInt128(value.u.i128);
526 packet.putUInt128(value.u.u128);
530 packet.putString(value.str);
532 packet.putEmptyString();
539 MtpPropertyValue* MtpProperty::readArrayValues(MtpDataPacket& packet, uint32_t& length) {
540 if (!packet.getUInt32(length)) return NULL;
552 if (!readValue(packet, result[i])) {
559 void MtpProperty::writeArrayValues(MtpDataPacket& packet, MtpPropertyValue* values, uint32_t length) {
560 packet.putUInt32(length);
562 writeValue(packet, values[i]);