@@ -30,6 +30,8 @@ impl_enum_type!(
3030 TestFooBaz => b"test.foo.baz"
3131 TestQuuxBar => b"test.quux.bar"
3232 TestQuuxBarBaz => b"test.quux.bar.baz"
33+ PsuInserted => b"hw.insert.power.power_shelf.psu"
34+ PsuRemoved => b"hw.remove.power.power_shelf.psu"
3335) ;
3436
3537impl AlertClass {
@@ -44,6 +46,8 @@ impl AlertClass {
4446 Self :: TestFooBaz => "test.foo.baz" ,
4547 Self :: TestQuuxBar => "test.quux.bar" ,
4648 Self :: TestQuuxBarBaz => "test.quux.bar.baz" ,
49+ Self :: PsuInserted => "hw.insert.power.power_shelf.psu" ,
50+ Self :: PsuRemoved => "hw.remove.power.power_shelf.psu" ,
4751 }
4852 }
4953
@@ -76,6 +80,12 @@ impl AlertClass {
7680 | Self :: TestQuuxBarBaz => {
7781 "This is a test of the emergency alert system"
7882 }
83+ Self :: PsuInserted => {
84+ "A power supply unit (PSU) has been inserted into the power shelf"
85+ }
86+ Self :: PsuRemoved => {
87+ "A power supply unit (PSU) has been removed from the power shelf"
88+ }
7989 }
8090 }
8191
@@ -84,6 +94,16 @@ impl AlertClass {
8494 <Self as strum:: VariantArray >:: VARIANTS ;
8595}
8696
97+ impl From < nexus_types:: fm:: AlertClass > for AlertClass {
98+ fn from ( input : nexus_types:: fm:: AlertClass ) -> Self {
99+ use nexus_types:: fm:: AlertClass as In ;
100+ match input {
101+ In :: PsuRemoved => Self :: PsuRemoved ,
102+ In :: PsuInserted => Self :: PsuInserted ,
103+ }
104+ }
105+ }
106+
87107impl fmt:: Display for AlertClass {
88108 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
89109 write ! ( f, "{}" , self . as_str( ) )
0 commit comments