Logo Search packages:      
Sourcecode: qlix version File versions  Download package

void MtpDevice::Initialize (  ) 

Initializes the MtpDevice and creates an internal tree structure for all MTP objects

Definition at line 90 of file MtpDevice.cpp.

References createObjectStructure(), and UpdateSpaceInformation().

{
  if (!_device)
    return;

  assert(_initialized== false);
  _initialized = true;
//  _progressFunc= NULL;
   _name = LIBMTP_Get_Friendlyname(_device);
   if (!_name)
     _name=strdup("MTP Device");

  _version = LIBMTP_Get_Deviceversion(_device);
  _syncPartner= LIBMTP_Get_Syncpartner(_device);
  _modelName = LIBMTP_Get_Modelname(_device);

  uint8_t max;
  uint8_t cur;
  int ret = LIBMTP_Get_Batterylevel(_device, &max, &cur); 

  if (ret != 0)
    _batteryLevelSupport = false; 

  _maxBatteryLevel     = max;
  _currentBatteryLevel = cur;
  ret = 0;


  uint16_t count = 0;
  uint16_t* types;
  ret = LIBMTP_Get_Supported_Filetypes(_device, &types, &count);
  if (ret == 0)
  {
    for (count_t i =0; i < count; i++)
    {
      char const* str;
      str = LIBMTP_Get_Filetype_Description( (LIBMTP_filetype_t)types[i] );
      string s(str);
      _supportedFileTypes.push_back(s);
    }
  }
  if (types)
    free(types);
  createObjectStructure();
  UpdateSpaceInformation();
}


Generated by  Doxygen 1.6.0   Back to index