#[non_exhaustive]pub enum StatusCode {
Success,
NotImplemented,
InvalidParameter,
InvalidAddress,
WriteProtect,
BadAlignment,
AccessDenied,
Busy,
InvalidHeader,
WrongConfig,
GenericError,
}Expand description
Status codes shared by the GVCP and GenCP acknowledgement tables.
Only the codes both protocols define, under the same name and meaning,
live here: 0x0000, 0x8001–0x8007, 0x800E, 0x800F and 0x8FFF.
Elsewhere the tables diverge, and at 0x800B they actively disagree —
GVCP calls it NO_MSG (deprecated), GenCP calls it MSG_TIMEOUT — so
each transport decodes its acknowledgements with a status type of its own
that wraps this one: viva_gige::GigeStatus and viva_u3v::U3vStatus
(ADR-0020).
There is no Unknown here: StatusCode::from_raw returns None for a
code outside the shared core, and the transport’s own type names it or
keeps it as unknown.
Values corroborated by Wireshark’s GVCP dissector
(epan/dissectors/packet-gvcp.c, GEV_STATUS_*) and aravis
(arvgvcpprivate.h, arvgvspprivate.h, arvuvcpprivate.h), which agree
with each other.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Success
Command completed successfully.
NotImplemented
The requested command is not implemented by the device.
InvalidParameter
One of the command parameters was invalid or out of range.
InvalidAddress
The requested address does not exist on the device.
WriteProtect
Attempt to write to a read-only register.
A permanent condition: retrying cannot make it succeed.
BadAlignment
The access was not aligned as the underlying technology requires.
AccessDenied
Attempt to read a non-readable, or write a non-writable, register.
Distinct from StatusCode::WriteProtect: the register accepts
writes in principle but the device is refusing this one, typically
because a GenApi lock is engaged or control privilege is not held.
Busy
The device is busy and the command may succeed if retried.
The only status in this table worth a retry.
InvalidHeader
The command’s header is invalid: its fields, or its length against the bytes that arrived.
WrongConfig
The device’s current configuration does not allow the command. Deprecated in GigE Vision.
GenericError
The device reported a generic error with nothing more specific.
Implementations§
Source§impl StatusCode
impl StatusCode
Sourcepub const fn from_raw(raw: u16) -> Option<Self>
pub const fn from_raw(raw: u16) -> Option<Self>
The shared meaning of a raw status, or None for a code outside the
shared core — one a transport defines, or one nobody does.
Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
The specification’s name for this code, for diagnostics.
Sourcepub const fn is_retryable(self) -> bool
pub const fn is_retryable(self) -> bool
Whether retrying the command could plausibly succeed.
True only for StatusCode::Busy. Notably not WriteProtect or
AccessDenied, which are refusals rather than congestion.
Trait Implementations§
Source§impl Clone for StatusCode
impl Clone for StatusCode
impl Copy for StatusCode
Source§impl Debug for StatusCode
impl Debug for StatusCode
Source§impl Display for StatusCode
Prints the specification name and the raw hex value.
impl Display for StatusCode
Prints the specification name and the raw hex value.
Both halves matter: the name is what makes an error actionable, and the
raw value is what lets a reporter match it against a capture. A bare
decimal — which is what {:?} on the old Unknown(32774) produced —
sent a user to the issue tracker in #45 unable to tell us anything.