@@ -16,14 +16,21 @@ pub(crate) enum OdpService {
1616 Debug = 0x0A ,
1717}
1818
19+ #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
20+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
21+ pub ( crate ) enum MctpError {
22+ // The endpoint ID does not correspond to a known service
23+ UnknownEndpointId ,
24+ }
25+
1926impl TryFrom < comms:: EndpointID > for OdpService {
2027 type Error = MctpError ;
2128 fn try_from ( endpoint_id : comms:: EndpointID ) -> Result < Self , MctpError > {
2229 match endpoint_id {
2330 comms:: EndpointID :: Internal ( comms:: Internal :: Battery ) => Ok ( OdpService :: Battery ) ,
2431 comms:: EndpointID :: Internal ( comms:: Internal :: Thermal ) => Ok ( OdpService :: Thermal ) ,
2532 comms:: EndpointID :: Internal ( comms:: Internal :: Debug ) => Ok ( OdpService :: Debug ) ,
26- _ => Err ( MctpError :: InvalidDestinationEndpoint ) ,
33+ _ => Err ( MctpError :: UnknownEndpointId ) ,
2734 }
2835 }
2936}
@@ -233,28 +240,6 @@ pub(crate) fn try_route_request_to_comms(
233240 }
234241}
235242
236- #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
237- #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
238- pub ( crate ) enum MctpError {
239- // TODO most of these are unused now - figure out if that should be the case, and if it is, prune this down to just the used ones.
240- // /// Header is not at least 9 bytes long.
241- // InvalidHeaderSize,
242- // /// Wrong destination address.
243- // WrongDestinationAddr,
244- // /// Invalid command code.
245- // InvalidCommandCode,
246- // /// Invalid byte count, encoded byte count does not match MCTP message length.
247- // InvalidByteCount,
248- // /// Invalid header version. Should be 1.
249- // InvalidHeaderVersion,
250- /// Invalid destination endpoint
251- InvalidDestinationEndpoint ,
252- // /// Invalid source endpoint.
253- // InvalidSourceEndpoint,
254- // /// Multi message not supported.
255- // InvalidFlags,
256- }
257-
258243bitfield ! {
259244 /// Raw bitfield of possible port status events
260245 #[ derive( Copy , Clone , PartialEq , Eq ) ]
0 commit comments