当前位置: 首页>>代码示例>>C++>>正文


C++ MtpDataPacket::getString方法代码示例

本文整理汇总了C++中MtpDataPacket::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ MtpDataPacket::getString方法的具体用法?C++ MtpDataPacket::getString怎么用?C++ MtpDataPacket::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MtpDataPacket的用法示例。


在下文中一共展示了MtpDataPacket::getString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: read

void MtpDeviceInfo::read(MtpDataPacket& packet) {
    MtpStringBuffer string;

    // read the device info
    mStandardVersion = packet.getUInt16();
    mVendorExtensionID = packet.getUInt32();
    mVendorExtensionVersion = packet.getUInt16();

    packet.getString(string);
    mVendorExtensionDesc = strdup((const char *)string);

    mFunctionalCode = packet.getUInt16();
    mOperations = packet.getAUInt16();
    mEvents = packet.getAUInt16();
    mDeviceProperties = packet.getAUInt16();
    mCaptureFormats = packet.getAUInt16();
    mPlaybackFormats = packet.getAUInt16();

    packet.getString(string);
    mManufacturer = strdup((const char *)string);
    packet.getString(string);
    mModel = strdup((const char *)string);
    packet.getString(string);
    mVersion = strdup((const char *)string);
    packet.getString(string);
    mSerial = strdup((const char *)string);
}
开发者ID:28vicky,项目名称:platform_frameworks_base,代码行数:27,代码来源:MtpDeviceInfo.cpp

示例2: read

bool MtpDeviceInfo::read(MtpDataPacket& packet) {
    MtpStringBuffer string;

    // read the device info
    if (!packet.getUInt16(mStandardVersion)) return false;
    if (!packet.getUInt32(mVendorExtensionID)) return false;
    if (!packet.getUInt16(mVendorExtensionVersion)) return false;

    if (!packet.getString(string)) return false;
    mVendorExtensionDesc = strdup((const char *)string);

    if (!packet.getUInt16(mFunctionalMode)) return false;
    mOperations = packet.getAUInt16();
    if (!mOperations) return false;
    mEvents = packet.getAUInt16();
    if (!mEvents) return false;
    mDeviceProperties = packet.getAUInt16();
    if (!mDeviceProperties) return false;
    mCaptureFormats = packet.getAUInt16();
    if (!mCaptureFormats) return false;
    mPlaybackFormats = packet.getAUInt16();
    if (!mCaptureFormats) return false;

    if (!packet.getString(string)) return false;
    mManufacturer = strdup((const char *)string);
    if (!packet.getString(string)) return false;
    mModel = strdup((const char *)string);
    if (!packet.getString(string)) return false;
    mVersion = strdup((const char *)string);
    if (!packet.getString(string)) return false;
    mSerial = strdup((const char *)string);

    return true;
}
开发者ID:webOS-ports,项目名称:mtp-server,代码行数:34,代码来源:MtpDeviceInfo.cpp

示例3: read

void MtpObjectInfo::read(MtpDataPacket& packet) {
    MtpStringBuffer string;
    time_t time;

    mStorageID = packet.getUInt32();
    mFormat = packet.getUInt16();
    mProtectionStatus = packet.getUInt16();
    mCompressedSize = packet.getUInt32();
    mThumbFormat = packet.getUInt16();
    mThumbCompressedSize = packet.getUInt32();
    mThumbPixWidth = packet.getUInt32();
    mThumbPixHeight = packet.getUInt32();
    mImagePixWidth = packet.getUInt32();
    mImagePixHeight = packet.getUInt32();
    mImagePixDepth = packet.getUInt32();
    mParent = packet.getUInt32();
    mAssociationType = packet.getUInt16();
    mAssociationDesc = packet.getUInt32();
    mSequenceNumber = packet.getUInt32();

    packet.getString(string);
    mName = strdup((const char *)string);

    packet.getString(string);
    if (parseDateTime((const char*)string, time))
        mDateCreated = time;

    packet.getString(string);
    if (parseDateTime((const char*)string, time))
        mDateModified = time;

    packet.getString(string);
    mKeywords = strdup((const char *)string);
}
开发者ID:Zenfone2-Dev,项目名称:Team-Win-Recovery-Project,代码行数:34,代码来源:MtpObjectInfo.cpp

示例4: setObjectPropertyValue

MtpResponseCode MyMtpDatabase::setObjectPropertyValue(MtpObjectHandle handle,
                                            MtpObjectProperty property,
                                            MtpDataPacket& packet) {
    int         type;

    if (!getObjectPropertyInfo(property, type))
        return MTP_RESPONSE_OBJECT_PROP_NOT_SUPPORTED;

    JNIEnv* env = AndroidRuntime::getJNIEnv();
    jlong longValue = 0;
    jstring stringValue = NULL;

    switch (type) {
        case MTP_TYPE_INT8:
            longValue = packet.getInt8();
            break;
        case MTP_TYPE_UINT8:
            longValue = packet.getUInt8();
            break;
        case MTP_TYPE_INT16:
            longValue = packet.getInt16();
            break;
        case MTP_TYPE_UINT16:
            longValue = packet.getUInt16();
            break;
        case MTP_TYPE_INT32:
            longValue = packet.getInt32();
            break;
        case MTP_TYPE_UINT32:
            longValue = packet.getUInt32();
            break;
        case MTP_TYPE_INT64:
            longValue = packet.getInt64();
            break;
        case MTP_TYPE_UINT64:
            longValue = packet.getUInt64();
            break;
        case MTP_TYPE_STR:
        {
            MtpStringBuffer buffer;
            packet.getString(buffer);
            stringValue = env->NewStringUTF((const char *)buffer);
            break;
         }
        default:
            ALOGE("unsupported type in setObjectPropertyValue\n");
            return MTP_RESPONSE_INVALID_OBJECT_PROP_FORMAT;
    }

    jint result = env->CallIntMethod(mDatabase, method_setObjectProperty,
                (jint)handle, (jint)property, longValue, stringValue);
    if (stringValue)
        env->DeleteLocalRef(stringValue);

    checkAndClearExceptionFromCallback(env, __FUNCTION__);
    return result;
}
开发者ID:21day,项目名称:platform_frameworks_base,代码行数:57,代码来源:android_mtp_MtpDatabase.cpp

示例5: readValue

bool MtpProperty::readValue(MtpDataPacket& packet, MtpPropertyValue& value) {
    MtpStringBuffer stringBuffer;

    switch (mType) {
        case MTP_TYPE_INT8:
        case MTP_TYPE_AINT8:
            if (!packet.getInt8(value.u.i8)) return false;
            break;
        case MTP_TYPE_UINT8:
        case MTP_TYPE_AUINT8:
            if (!packet.getUInt8(value.u.u8)) return false;
            break;
        case MTP_TYPE_INT16:
        case MTP_TYPE_AINT16:
            if (!packet.getInt16(value.u.i16)) return false;
            break;
        case MTP_TYPE_UINT16:
        case MTP_TYPE_AUINT16:
            if (!packet.getUInt16(value.u.u16)) return false;
            break;
        case MTP_TYPE_INT32:
        case MTP_TYPE_AINT32:
            if (!packet.getInt32(value.u.i32)) return false;
            break;
        case MTP_TYPE_UINT32:
        case MTP_TYPE_AUINT32:
            if (!packet.getUInt32(value.u.u32)) return false;
            break;
        case MTP_TYPE_INT64:
        case MTP_TYPE_AINT64:
            if (!packet.getInt64(value.u.i64)) return false;
            break;
        case MTP_TYPE_UINT64:
        case MTP_TYPE_AUINT64:
            if (!packet.getUInt64(value.u.u64)) return false;
            break;
        case MTP_TYPE_INT128:
        case MTP_TYPE_AINT128:
            if (!packet.getInt128(value.u.i128)) return false;
            break;
        case MTP_TYPE_UINT128:
        case MTP_TYPE_AUINT128:
            if (!packet.getUInt128(value.u.u128)) return false;
            break;
        case MTP_TYPE_STR:
            if (!packet.getString(stringBuffer)) return false;
            value.str = strdup(stringBuffer);
            break;
        default:
            ALOGE("unknown type %04X in MtpProperty::readValue", mType);
            return false;
    }
    return true;
}
开发者ID:AOSP-JF,项目名称:platform_frameworks_av,代码行数:54,代码来源:MtpProperty.cpp

示例6: readValue

void MtpProperty::readValue(MtpDataPacket& packet, MtpPropertyValue& value) {
    MtpStringBuffer stringBuffer;

    switch (mType) {
        case MTP_TYPE_INT8:
        case MTP_TYPE_AINT8:
            value.u.i8 = packet.getInt8();
            break;
        case MTP_TYPE_UINT8:
        case MTP_TYPE_AUINT8:
            value.u.u8 = packet.getUInt8();
            break;
        case MTP_TYPE_INT16:
        case MTP_TYPE_AINT16:
            value.u.i16 = packet.getInt16();
            break;
        case MTP_TYPE_UINT16:
        case MTP_TYPE_AUINT16:
            value.u.u16 = packet.getUInt16();
            break;
        case MTP_TYPE_INT32:
        case MTP_TYPE_AINT32:
            value.u.i32 = packet.getInt32();
            break;
        case MTP_TYPE_UINT32:
        case MTP_TYPE_AUINT32:
            value.u.u32 = packet.getUInt32();
            break;
        case MTP_TYPE_INT64:
        case MTP_TYPE_AINT64:
            value.u.i64 = packet.getInt64();
            break;
        case MTP_TYPE_UINT64:
        case MTP_TYPE_AUINT64:
            value.u.u64 = packet.getUInt64();
            break;
        case MTP_TYPE_INT128:
        case MTP_TYPE_AINT128:
            packet.getInt128(value.u.i128);
            break;
        case MTP_TYPE_UINT128:
        case MTP_TYPE_AUINT128:
            packet.getUInt128(value.u.u128);
            break;
        case MTP_TYPE_STR:
            packet.getString(stringBuffer);
            value.str = strdup(stringBuffer);
            break;
        default:
            LOG(ERROR) << "unknown type "
                       << std::hex << mType << std::dec
                       << " in MtpProperty::readValue";
    }
}
开发者ID:KDE,项目名称:mtp-server,代码行数:54,代码来源:MtpProperty.cpp

示例7: newFileName

//virtual
MtpResponseCode
MozMtpDatabase::setObjectPropertyValue(MtpObjectHandle aHandle,
                                       MtpObjectProperty aProperty,
                                       MtpDataPacket& aPacket)
{
  MTP_LOG("Handle: 0x%08x Property: 0x%08x", aHandle, aProperty);

  // Only support file name change
  if (aProperty != MTP_PROPERTY_OBJECT_FILE_NAME) {
    MTP_ERR("property 0x%x not supported", aProperty);
    return  MTP_RESPONSE_OBJECT_PROP_NOT_SUPPORTED;
  }

  if (GetTypeOfObjectProp(aProperty) != MTP_TYPE_STR) {
    MTP_ERR("property type 0x%x not supported", GetTypeOfObjectProp(aProperty));
    return MTP_RESPONSE_GENERAL_ERROR;
  }

  RefPtr<DbEntry> entry = GetEntry(aHandle);
  if (!entry) {
    MTP_ERR("Invalid Handle: 0x%08x", aHandle);
    return MTP_RESPONSE_INVALID_OBJECT_HANDLE;
  }

  MtpStringBuffer buf;
  aPacket.getString(buf);

  nsDependentCString newFileName(buf);
  nsCString newFileFullPath(GetPathWithoutFileName(entry->mPath) + newFileName);

  if (PR_Rename(entry->mPath.get(), newFileFullPath.get()) != PR_SUCCESS) {
    MTP_ERR("Failed to rename '%s' to '%s'",
            entry->mPath.get(), newFileFullPath.get());
    return MTP_RESPONSE_GENERAL_ERROR;
  }

  MTP_LOG("renamed '%s' to '%s'", entry->mPath.get(), newFileFullPath.get());

  entry->mPath = newFileFullPath;
  entry->mObjectName = BaseName(entry->mPath);
  entry->mDisplayName = entry->mObjectName;

  return MTP_RESPONSE_OK;
}
开发者ID:johnjojo53,项目名称:gecko-dev,代码行数:45,代码来源:MozMtpDatabase.cpp


注:本文中的MtpDataPacket::getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。