<commit_before>/*
 * TI Voxel Lib component.
 *
 * Copyright (c) 2014 Texas Instruments Inc.
 */

#include <ToFCameraFactory.h>
#include <Logger.h>

#include <Voxel14Camera.h>
#include <HaddockCDKCamera.h>
#include <VoxelDCamera.h>
#include <TintinCDKCamera.h>

namespace Voxel
{
  
namespace TI
{
  

ToFCameraFactory::ToFCameraFactory(const String &name): DepthCameraFactory(name)
{
  _addSupportedDevices({
    DevicePtr(new USBDevice(VOXEL_14_VENDOR_ID, VOXEL_14_PRODUCT_ID1, "")),
    DevicePtr(new USBDevice(VOXEL_14_VENDOR_ID, VOXEL_14_PRODUCT_ID2, "")),
    DevicePtr(new USBDevice(HADDOCK_CDK_VENDOR_ID, HADDOCK_CDK_PRODUCT_ID1, "")),
    DevicePtr(new USBDevice(VOXEL_D_VENDOR_ID, VOXEL_D_PRODUCT_ID1, "")),
    DevicePtr(new USBDevice(VOXEL_D_VENDOR_ID, VOXEL_D_PRODUCT_ID2, "")),
    DevicePtr(new USBDevice(TINTIN_CDK_VENDOR_ID, TINTIN_CDK_PRODUCT_ID1, "")),
    DevicePtr(new USBDevice(TINTIN_CDK_VENDOR_ID, TINTIN_CDK_PRODUCT_UVC, "")),
  });
}

DepthCameraPtr ToFCameraFactory::getDepthCamera(DevicePtr device)
{
  if(device->interfaceID() == Device::USB)
  {
    USBDevice &d = (USBDevice &)*device;
    
    if(d.vendorID() == VOXEL_14_VENDOR_ID && (d.productID() == VOXEL_14_PRODUCT_ID1  || d.productID() == VOXEL_14_PRODUCT_ID2))
    {
      return DepthCameraPtr(new Voxel14Camera(device));
    }
    else if(d.vendorID() == HADDOCK_CDK_VENDOR_ID && (d.productID() == HADDOCK_CDK_PRODUCT_ID1))
    {
      return DepthCameraPtr(new HaddockCDKCamera(device));
    }
    {
      return DepthCameraPtr(new VoxelDCamera(device));
    }
    else if(d.vendorID() == TINTIN_CDK_VENDOR_ID && (d.productID() == TINTIN_CDK_PRODUCT_ID1  || d.productID() == TINTIN_CDK_PRODUCT_UVC))
    {
      return DepthCameraPtr(new TintinCDKCamera(device));
    }
  }
  
  return 0;
}

bool ToFCameraFactory::getChannels(Device &device, Vector<int> &channels)
{
  channels.resize(1);
  channels[0] = 0; // This supports only one channel for all supported devices
  return true;
}

Vector<GeneratorIDType> ToFCameraFactory::getSupportedGeneratorTypes()
{<commit_msg>ToFCameraFactory: build fix<commit_after>/*
 * TI Voxel Lib component.
 *
 * Copyright (c) 2014 Texas Instruments Inc.
 */

#include <ToFCameraFactory.h>
#include <Logger.h>

#include <Voxel14Camera.h>
#include <HaddockCDKCamera.h>
#include <VoxelDCamera.h>
#include <TintinCDKCamera.h>

namespace Voxel
{
  
namespace TI
{
  

ToFCameraFactory::ToFCameraFactory(const String &name): DepthCameraFactory(name)
{
  _addSupportedDevices({
    DevicePtr(new USBDevice(VOXEL_14_VENDOR_ID, VOXEL_14_PRODUCT_ID1, "")),
    DevicePtr(new USBDevice(VOXEL_14_VENDOR_ID, VOXEL_14_PRODUCT_ID2, "")),
    DevicePtr(new USBDevice(HADDOCK_CDK_VENDOR_ID, HADDOCK_CDK_PRODUCT_ID1, "")),
    DevicePtr(new USBDevice(VOXEL_D_VENDOR_ID, VOXEL_D_PRODUCT_ID1, "")),
    DevicePtr(new USBDevice(VOXEL_D_VENDOR_ID, VOXEL_D_PRODUCT_ID2, "")),
    DevicePtr(new USBDevice(TINTIN_CDK_VENDOR_ID, TINTIN_CDK_PRODUCT_ID1, "")),
    DevicePtr(new USBDevice(TINTIN_CDK_VENDOR_ID, TINTIN_CDK_PRODUCT_UVC, "")),
  });
}

DepthCameraPtr ToFCameraFactory::getDepthCamera(DevicePtr device)
{
  if(device->interfaceID() == Device::USB)
  {
    USBDevice &d = (USBDevice &)*device;
    
    if(d.vendorID() == VOXEL_14_VENDOR_ID && (d.productID() == VOXEL_14_PRODUCT_ID1  || d.productID() == VOXEL_14_PRODUCT_ID2))
    {
      return DepthCameraPtr(new Voxel14Camera(device));
    }
    else if(d.vendorID() == HADDOCK_CDK_VENDOR_ID && (d.productID() == HADDOCK_CDK_PRODUCT_ID1))
    {
      return DepthCameraPtr(new HaddockCDKCamera(device));
    }
	else if(d.vendorID() == VOXEL_D_VENDOR_ID && (d.productID() == VOXEL_D_PRODUCT_ID1  || d.productID() == VOXEL_D_PRODUCT_ID2))
    {
      return DepthCameraPtr(new VoxelDCamera(device));
    }
    else if(d.vendorID() == TINTIN_CDK_VENDOR_ID && (d.productID() == TINTIN_CDK_PRODUCT_ID1  || d.productID() == TINTIN_CDK_PRODUCT_UVC))
    {
      return DepthCameraPtr(new TintinCDKCamera(device));
    }
  }
  
  return 0;
}

bool ToFCameraFactory::getChannels(Device &device, Vector<int> &channels)
{
  channels.resize(1);
  channels[0] = 0; // This supports only one channel for all supported devices
  return true;
}

Vector<GeneratorIDType> ToFCameraFactory::getSupportedGeneratorTypes()
{
{'fraction_non_alphanumeric': 0.1288961799859386, 'fraction_numerical': 0.01734239512538083, 'mean_word_length': 5.294985250737463, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1773664', 'n_tokens_mistral': 1740, 'n_tokens_neox': 1754, 'n_words': 239}