#include "SDCardManager.h"

SDCardManager::SDCardManager()
{
}

double SDCardManager::getSize(const SizeUnit sizeUnit)
{
  long numberOf512ByteChunks = cardSize();
  long unit = 0;
  double result = 0;
  
  switch(sizeUnit)
  {
    case KBIT:
      result = (double)numberOf512ByteChunks/2.0*8;
      break;
    case KBYTE:
      result = (double)numberOf512ByteChunks/2.0;
      break;
    case MBIT:
      result = (double)numberOf512ByteChunks/2.0/1024.0*8;
      break;
    case MBYTE:
      result = (double)numberOf512ByteChunks/2.0/1024.0;
      break;
    case GBIT:
      result = (double)numberOf512ByteChunks/2.0/1024.0/1024.0*8;
      break;
    case GBYTE:
      result = (double)numberOf512ByteChunks/2.0/1024.0/1024.0;
      break;
    default:
      result = (double)numberOf512ByteChunks/2.0/1024.0/1024.0;
  }

  return result;
}


