/*----------------------------------------------------------------------------*/
void pcl::SoftKineticDevice::onNodeDisconnected(Device device, Device::NodeRemovedData data)
{
  // if (data.node.is<AudioNode>() && (data.node.as<AudioNode>() == g_anode))
  //     g_anode.unset();
  if (data.node.is<ColorNode>() && (data.node.as<ColorNode>() == g_cnode))
      g_cnode.unset();
  if (data.node.is<DepthNode>() && (data.node.as<DepthNode>() == g_dnode))
      g_dnode.unset();
  printf("Node disconnected\n");
}
/*----------------------------------------------------------------------------*/
void SoftKineticCamera::onNodeDisconnected(Device device, Device::NodeRemovedData data)
{
	if (data.node.is<AudioNode>() && (data.node.as<AudioNode>() == m_anode))
		m_anode.unset();
	if (data.node.is<ColorNode>() && (data.node.as<ColorNode>() == m_cnode))
		m_cnode.unset();
	if (data.node.is<DepthNode>() && (data.node.as<DepthNode>() == m_dnode))
		m_dnode.unset();
	printf("Node disconnected\n");
}
void
pcl::SoftKineticDevice::close ()
{
  //pp_.Close ();
  if (context_.isSet())
  {
    context_.quit();
    skrun_thread_.join();

    context_.stopNodes();

    if (g_cnode.isSet()) { context_.unregisterNode(g_cnode); g_cnode.unset(); }
    if (g_dnode.isSet()) { context_.unregisterNode(g_dnode); g_dnode.unset(); }
    //if (g_anode.isSet()) context_.unregisterNode(g_anode);

    if (g_pProjHelper) {
      delete g_pProjHelper;
      g_pProjHelper = NULL;
    }

    context_.unset();
  }
}