- if status == native_bt.MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN:
- cs_type = bt2.clock_snapshot._ClockSnapshot
- assert snapshot_ptr is not None
- return cs_type._create_from_ptr_and_get_ref(snapshot_ptr, self._ptr,
- self._get_ref, self._put_ref)
- elif status == native_bt.MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN:
- return bt2.clock_snapshot._UnknownClockSnapshot()
- elif status == native_bt.MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE:
- return bt2.clock_snapshot._InfiniteClockSnapshot()
- else:
- raise bt2.Error('cannot borrow default clock snapshot from message')
-
- def _default_clock_snapshot(self, value):
- if type(value) is _StreamActivityMessageUnknownClockSnapshot:
- self._set_default_clock_snapshot_state(self._ptr, native_bt.MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN)
- elif type(value) is _StreamActivityMessageInfiniteClockSnapshot:
- self._set_default_clock_snapshot_state(self._ptr, native_bt.MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE)
- else:
- assert utils._is_uint64(value)
- self._set_default_clock_snapshot(self._ptr, value)