github.com/blueinnovationsgroup/can-go@v0.0.0-20230518195432-d0567cda0028/pkg/candevice/device_others.go (about)

     1  //go:build !linux || !go1.18
     2  
     3  package candevice
     4  
     5  import (
     6  	"fmt"
     7  	"runtime"
     8  )
     9  
    10  type NotSupportedError struct{}
    11  
    12  func (e NotSupportedError) Error() string {
    13  	return fmt.Sprintf("candevice is not supported on OS %s and runtime %s", runtime.GOOS, runtime.Version())
    14  }
    15  
    16  type Device struct{}
    17  
    18  func New(_ string) (*Device, error) {
    19  	return nil, NotSupportedError{}
    20  }
    21  
    22  func (d *Device) IsUp() (bool, error) {
    23  	return false, NotSupportedError{}
    24  }
    25  
    26  func (d *Device) SetUp() error {
    27  	return NotSupportedError{}
    28  }
    29  
    30  func (d *Device) SetDown() error {
    31  	return NotSupportedError{}
    32  }
    33  
    34  func (d *Device) Bitrate() (uint32, error) {
    35  	return 0, NotSupportedError{}
    36  }
    37  
    38  func (d *Device) SetBitrate(_ uint32) error {
    39  	return NotSupportedError{}
    40  }
    41  
    42  type Info struct{}
    43  
    44  func (d *Device) Info() (Info, error) {
    45  	return Info{}, NotSupportedError{}
    46  }