Exemple #1
0
        internal pxcmStatus SetupCaptureDevice(PXCMCapture.DeviceInfo devinfo)
        {
            if(SenseSession == null)
            {
                this.SenseSession = new RSSDKContext();
            }

            if(SenseSession.sm.QueryCaptureManager().QueryCapture() != null)
            {
                SenseSession.capture = SenseSession.sm.QueryCaptureManager().capture;
                SenseSession.Status = pxcmStatus.PXCM_STATUS_NO_ERROR;
            }
            else
            {
                PXCMSession.ImplDesc desc = new PXCMSession.ImplDesc();
                desc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR;
                desc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE;
                desc.iuid = devinfo.duid;
                desc.cuids[0] = PXCMCapture.CUID;
                SenseSession.Status = SenseSession.Session.CreateImpl<PXCMCapture>(desc, out SenseSession.capture);
            }

            if (SenseSession.Status == pxcmStatus.PXCM_STATUS_NO_ERROR)
            {
                FLogger.Log(LogType.Debug, "RSSDK: Capture created.");

                if(SenseSession.cm.QueryDevice() != null)
                {
                    SenseSession.device = SenseSession.cm.QueryDevice();
                }
                else
                {
                    SenseSession.device = SenseSession.capture.CreateDevice(FDeviceInfo[0].didx);

                    if(SenseSession.device == null) return pxcmStatus.PXCM_STATUS_INIT_FAILED;
                    else FLogger.Log(LogType.Debug, "RSSDK: Device created.");
                }

                //if(!this.SenseSession.StreamProfilesInitialized)
                {
                    this.SenseSession.StreamProfilesInitialized = InitStreamProfiles(this.SenseSession.device);

                    if(!this.SenseSession.StreamProfilesInitialized) return pxcmStatus.PXCM_STATUS_DATA_NOT_INITIALIZED;
                    else FLogger.Log(LogType.Debug, "RSSDK: Device profiles Initialized.");
                }

                this.SenseSession.cm.FilterByDeviceInfo(FDeviceInfo[0]);

                FLogger.Log(LogType.Debug, "RSSDK: Device ready for configuration.");
                return pxcmStatus.PXCM_STATUS_NO_ERROR;
            }
            else
            {
                FLogger.Log(LogType.Debug, "RSSDK: Can not create capture.");
                return pxcmStatus.PXCM_STATUS_INIT_FAILED;
            }
        }
Exemple #2
0
 public void OnImportsSatisfied()
 {
     this.SenseSession = new RSSDKContext();
     FLogger.Log(LogType.Debug, "RSSDK: Context created.");
 }
Exemple #3
0
        internal string createContext(PXCMCapture.DeviceInfo devInfo)
        {
            string Status = "RSSDK: Configuring...\n\r";
               		if(!this.SenseSession.Configured)
            {
               			if(SenseSession == null) this.SenseSession = new RSSDKContext();

                if(SetupCaptureDevice(devInfo) == pxcmStatus.PXCM_STATUS_NO_ERROR)
                {
                    Status += "RSSDK: Device created\n\r";
                    Status += "RSSDK: Setup streams\n\r";
                    Status += SetupStreams();
                    if(this.SenseSession.Status != pxcmStatus.PXCM_STATUS_NO_ERROR) Status += "RSSDK: Can not setup streams\n\r";

                    Status += "RSSDK: Setup modules\n\r";
                    /****************************************************************************************************
                     * setup modules
                     ***************************************************************************************************/
                    if(FEnableHand[0])
                    {
                        SenseSession.Status = SenseSession.sm.EnableHand();
                        if(SenseSession.Status != pxcmStatus.PXCM_STATUS_NO_ERROR) FLogger.Log(LogType.Debug, "RSSDK(Error): Can not enable the hand tracker");
                        {
                            SenseSession.handAnalysis = SenseSession.sm.QueryHand();
                            if(SenseSession.handAnalysis == null) FLogger.Log(LogType.Debug, "RSSDK(Error): Can not initialize the hand analysis module");
                        }
               			}

                    if(FEnableBlob[0])
                    {
                        SenseSession.Status = SenseSession.sm.EnableBlob();
                        if(SenseSession.Status != pxcmStatus.PXCM_STATUS_NO_ERROR) FLogger.Log(LogType.Debug, "RSSDK(Error): Can not enable the blob tracker");
                        {
                            SenseSession.blobModule = SenseSession.sm.QueryBlob();
                            if(SenseSession.blobModule == null) FLogger.Log(LogType.Debug, "RSSDK(Error): Can not initialize the blob analysis module");
                        }
                    }

                    if(this.SenseSession.frameready_cb == null)
                    {
                        this.SenseSession.frameready_cb = new PXCMSenseManager.Handler();
                        this.SenseSession.frameready_cb.onNewSample = this.SenseSession.OnNewSample;
                        //this.SenseSession.frameready_cb.onConnect = this.SenseSession.OnConnect;
                        //this.SenseSession.frameready_cb.onStatus = this.SenseSession.OnStatus;
                        //this.SenseSession.frameready_cb.onModuleSetProfile = this.SenseSession.OnModuleSetProfile;
                        this.SenseSession.frameready_cb.onModuleProcessedFrame = this.SenseSession.OnModuleProcessFrame;
                    }

                    if(FFilename[0] != "") SenseSession.sm.captureManager.SetFileName(FFilename[0], FRecord[0]);

                    this.SenseSession.cm.SetRealtime(FRealtime[0]);
                    Status += "RSSDK: Init...";
                    this.SenseSession.Status = this.SenseSession.sm.Init(this.SenseSession.frameready_cb);

                    if(SenseSession.Status == pxcmStatus.PXCM_STATUS_NO_ERROR)
                    {

                        FLogger.Log(LogType.Debug,"done.");
                        //Thread.Sleep(100);
                        this.SenseSession.Configured = true;
                        Status += "done.\n\r";

                    }
                    else FLogger.Log(LogType.Debug, "RSSDK: Can not Configured context!");
                }
            }
               		return Status;
        }
Exemple #4
0
        internal string createContext(PXCMCapture.DeviceInfo devInfo)
        {
            string Status = "RSSDK: Configuring...\n\r";
               		if(!this.SenseSession.Configured)
            {
               			if(SenseSession == null) this.SenseSession = new RSSDKContext();

                if(SetupCaptureDevice(devInfo) == pxcmStatus.PXCM_STATUS_NO_ERROR)
                {
                    Status += "RSSDK: Device created\n\r";

                    Status += SetupStreams();
                    if(this.SenseSession.Status != pxcmStatus.PXCM_STATUS_NO_ERROR) Status += "RSSDK: Can not setup streams\n\r";

                    if(this.SenseSession.frameready_cb == null)
                    {
                        this.SenseSession.frameready_cb = new PXCMSenseManager.Handler();
                        this.SenseSession.frameready_cb.onNewSample = this.SenseSession.OnNewSample;
                        //this.SenseSession.frameready_cb.onConnect = this.SenseSession.OnConnect;
                        //this.SenseSession.frameready_cb.onStatus = this.SenseSession.OnStatus;
                        //this.SenseSession.frameready_cb.onModuleSetProfile = this.SenseSession.OnModuleSetProfile;
                        //this.SenseSession.frameready_cb.onModuleProcessedFrame = this.SenseSession.OnModuleProcessFrame;
                    }

                    this.SenseSession.cm.SetRealtime(FRealtime[0]);
                    Status += "RSSDK: Init...\n\r";
                    this.SenseSession.Status = this.SenseSession.sm.Init(this.SenseSession.frameready_cb);
                    if(SenseSession.Status == pxcmStatus.PXCM_STATUS_NO_ERROR)
                    {

                        FLogger.Log(LogType.Debug,"RSSDK: Init with handler done.");
                        //Thread.Sleep(100);
                        this.SenseSession.Configured = true;
                        Status += "RSSDK: Configured.\n\r";
                    }
                    else FLogger.Log(LogType.Debug, "RSSDK: Can not Configured context!");
                }
            }
               		return Status;
        }