MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / stop

Method stop

src/libfreenect2.cpp:987–1028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

985}
986
987bool Freenect2DeviceImpl::stop()
988{
989 LOG_INFO << "stopping...";
990
991 if(state_ != Streaming)
992 {
993 LOG_INFO << "already stopped, doing nothing";
994 return false;
995 }
996
997 if (rgb_transfer_pool_.enabled())
998 {
999 LOG_INFO << "canceling rgb transfers...";
1000 rgb_transfer_pool_.disableSubmission();
1001 rgb_transfer_pool_.cancel();
1002 }
1003
1004 if (ir_transfer_pool_.enabled())
1005 {
1006 LOG_INFO << "canceling depth transfers...";
1007 ir_transfer_pool_.disableSubmission();
1008 ir_transfer_pool_.cancel();
1009 }
1010
1011 if (usb_control_.setIrInterfaceState(UsbControl::Disabled) != UsbControl::Success) return false;
1012
1013 CommandTransaction::Result result;
1014 if (!command_tx_.execute(SetModeEnabledWith0x00640064Command(nextCommandSeq()), result)) return false;
1015 if (!command_tx_.execute(SetModeDisabledCommand(nextCommandSeq()), result)) return false;
1016 if (!command_tx_.execute(StopCommand(nextCommandSeq()), result)) return false;
1017 if (!command_tx_.execute(SetStreamDisabledCommand(nextCommandSeq()), result)) return false;
1018 if (!command_tx_.execute(SetModeEnabledCommand(nextCommandSeq()), result)) return false;
1019 if (!command_tx_.execute(SetModeDisabledCommand(nextCommandSeq()), result)) return false;
1020 if (!command_tx_.execute(SetModeEnabledCommand(nextCommandSeq()), result)) return false;
1021 if (!command_tx_.execute(SetModeDisabledCommand(nextCommandSeq()), result)) return false;
1022
1023 if (usb_control_.setVideoTransferFunctionState(UsbControl::Disabled) != UsbControl::Success) return false;
1024
1025 state_ = Open;
1026 LOG_INFO << "stopped";
1027 return true;
1028}
1029
1030bool Freenect2DeviceImpl::close()
1031{

Callers 1

~Freenect2ImplMethod · 0.45

Calls 7

enabledMethod · 0.80
disableSubmissionMethod · 0.80
cancelMethod · 0.80
setIrInterfaceStateMethod · 0.80
joinMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected