github.com/binkynet/BinkyNet@v1.12.1-0.20240421190447-da4e34c20be0/apis/v1/types_getters.go (about) 1 // Copyright 2020 Ewout Prangsma 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 // Author Ewout Prangsma 16 // 17 18 package v1 19 20 // GetAddress returns the address of the object in a safe manor 21 func (s *Loc) GetAddress() ObjectAddress { 22 if s == nil { 23 return "" 24 } 25 return s.Address 26 } 27 28 // GetAddress returns the address of the object in a safe manor 29 func (s *Sensor) GetAddress() ObjectAddress { 30 if s == nil { 31 return "" 32 } 33 return s.Address 34 } 35 36 // GetAddress returns the address of the object in a safe manor 37 func (s *Output) GetAddress() ObjectAddress { 38 if s == nil { 39 return "" 40 } 41 return s.Address 42 } 43 44 // GetAddress returns the address of the object in a safe manor 45 func (s *Switch) GetAddress() ObjectAddress { 46 if s == nil { 47 return "" 48 } 49 return s.Address 50 } 51 52 // GetId returns the id of the object in a safe manor 53 func (s *Device) GetId() DeviceID { 54 if s == nil { 55 return "" 56 } 57 return s.Id 58 } 59 60 // GetType returns the type of the object in a safe manor 61 func (s *Device) GetType() DeviceType { 62 if s == nil { 63 return "" 64 } 65 return s.Type 66 } 67 68 // GetId returns the id of the object in a safe manor 69 func (s *Object) GetId() ObjectID { 70 if s == nil { 71 return "" 72 } 73 return s.Id 74 } 75 76 // GetType returns the type of the object in a safe manor 77 func (s *Object) GetType() ObjectType { 78 if s == nil { 79 return "" 80 } 81 return s.Type 82 } 83 84 // GetKey returns the key of the object in a safe manor 85 func (s *Connection) GetKey() ConnectionName { 86 if s == nil { 87 return "" 88 } 89 return s.Key 90 } 91 92 // GetDeviceId returns the device-id of the object in a safe manor 93 func (s *DevicePin) GetDeviceId() DeviceID { 94 if s == nil { 95 return "" 96 } 97 return s.DeviceId 98 } 99 100 // GetDeviceIndex returns the index of the object in a safe manor 101 func (s *DevicePin) GetDeviceIndex() DeviceIndex { 102 if s == nil { 103 return 0 104 } 105 return s.Index 106 }