Skip to content

Commit

Permalink
Merge pull request #281 from observerly/chore/align/formatting
Browse files Browse the repository at this point in the history
chore: Align formatting across all .go files.
  • Loading branch information
michealroberts authored Jul 13, 2023
2 parents e1c6cbb + 1c65fcc commit 483395d
Show file tree
Hide file tree
Showing 11 changed files with 822 additions and 822 deletions.
100 changes: 50 additions & 50 deletions pkg/alpacago/alpaca.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ func NewAlpacaAPI(clientId uint32, secure bool, domain string, ip string, port i
}

/*
getQueryString()
getQueryString()
Many ASCOM methods require parameter values. All methods
that use the HTTP GET verb should include parameters as
query string name-value pairs.
Many ASCOM methods require parameter values. All methods
that use the HTTP GET verb should include parameters as
query string name-value pairs.
*/
func (a *ASCOMAlpacaAPIClient) getQueryString() string {
return fmt.Sprintf("ClientID=%d&ClientTransactionID=%d", a.ClientId, a.TransactionId)
}

/*
getEndpoint()
getEndpoint()
Alpaca Device API URLs are of the form http(s)://host:port/path
where path comprises "/api/v1/" followed by one of the ASCOM
method from https://ascom-standards.org/api/
Alpaca Device API URLs are of the form http(s)://host:port/path
where path comprises "/api/v1/" followed by one of the ASCOM
method from https://ascom-standards.org/api/
*/
func (a *ASCOMAlpacaAPIClient) getEndpoint(deviceType string, deviceNumber uint, method string) string {
return fmt.Sprintf("%s/api/v1/%s/%d/%s", a.UrlBase, deviceType, deviceNumber, method)
Expand All @@ -81,9 +81,9 @@ type stringResponse struct {
}

/*
GetStringResponse()
GetStringResponse()
Global public method to work with calls returning stringResponse
Global public method to work with calls returning stringResponse
*/
func (a *ASCOMAlpacaAPIClient) GetStringResponse(deviceType string, deviceNumber uint, method string) (string, error) {
// Build the ASCOM endpoint:
Expand Down Expand Up @@ -117,9 +117,9 @@ type stringlistResponse struct {
}

/*
GetStringListResponse()
GetStringListResponse()
Global public method to work with calls returning stringListResponse
Global public method to work with calls returning stringListResponse
*/
func (a *ASCOMAlpacaAPIClient) GetStringListResponse(deviceType string, deviceNumber uint, method string) ([]string, error) {
// Build the ASCOM endpoint:
Expand Down Expand Up @@ -152,9 +152,9 @@ type booleanResponse struct {
}

/*
GetBooleanResponse()
GetBooleanResponse()
Global public method to work with calls returning booleanResponse
Global public method to work with calls returning booleanResponse
*/
func (a *ASCOMAlpacaAPIClient) GetBooleanResponse(deviceType string, deviceNumber uint, method string) (bool, error) {
// Build the ASCOM endpoint:
Expand Down Expand Up @@ -187,9 +187,9 @@ type float64Response struct {
}

/*
GetFloat64Response()
GetFloat64Response()
Global public method to work with calls returning float64Response
Global public method to work with calls returning float64Response
*/
func (a *ASCOMAlpacaAPIClient) GetFloat64Response(deviceType string, deviceNumber uint, method string) (float64, error) {
// Build the ASCOM endpoint:
Expand Down Expand Up @@ -222,9 +222,9 @@ type int32Response struct {
}

/*
GetInt32Response()
GetInt32Response()
Global public method to work with calls returning int32Response
Global public method to work with calls returning int32Response
*/
func (a *ASCOMAlpacaAPIClient) GetInt32Response(deviceType string, deviceNumber uint, method string) (int32, error) {
// Build the ASCOM endpoint:
Expand Down Expand Up @@ -257,9 +257,9 @@ type uint32listResponse struct {
}

/*
GetInt32ListResponse()
GetInt32ListResponse()
Global public method to work with calls returning int32listResponse
Global public method to work with calls returning int32listResponse
*/
func (a *ASCOMAlpacaAPIClient) GetUInt32ListResponse(deviceType string, deviceNumber uint, method string) ([]uint32, error) {
// Build the ASCOM endpoint:
Expand Down Expand Up @@ -293,9 +293,9 @@ type uint32Rank2ArrayResponse struct {
}

/*
GetUInt32RankArrayResponse()
GetUInt32RankArrayResponse()
Global public method to work with calls returning a uint32Rank2ArrayResponse
Global public method to work with calls returning a uint32Rank2ArrayResponse
*/
func (a *ASCOMAlpacaAPIClient) GetUInt32Rank2ArrayResponse(deviceType string, deviceNumber uint, method string) ([][]uint32, uint32, error) {
// Build the ASCOM endpoint:
Expand Down Expand Up @@ -355,76 +355,76 @@ func (a *ASCOMAlpacaAPIClient) Put(deviceType string, deviceNumber uint, method
}

/*
IsConnected() common method to all ASCOM Alpaca compliant devices
IsConnected() common method to all ASCOM Alpaca compliant devices
@returns the connection status of the device
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__connected
@returns the connection status of the device
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__connected
*/
func (a *ASCOMAlpacaAPIClient) IsConnected(deviceType string, deviceNumber uint) (bool, error) {
return a.GetBooleanResponse(deviceType, deviceNumber, "connected")
}

/*
GetDescription() common method to all ASCOM Alpaca compliant devices
GetDescription() common method to all ASCOM Alpaca compliant devices
@returns the description of the device
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__description
@returns the description of the device
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__description
*/
func (a *ASCOMAlpacaAPIClient) GetDescription(deviceType string, deviceNumber uint) (string, error) {
return a.GetStringResponse(deviceType, deviceNumber, "description")
}

/*
GetDriverInfo() common method to all ASCOM Alpaca compliant devices
GetDriverInfo() common method to all ASCOM Alpaca compliant devices
@returns the description of the driver
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__driverinfo
@returns the description of the driver
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__driverinfo
*/
func (a *ASCOMAlpacaAPIClient) GetDriverInfo(deviceType string, deviceNumber uint) (string, error) {
return a.GetStringResponse(deviceType, deviceNumber, "driverinfo")
}

/*
GetDriverVersion() common method to all ASCOM Alpaca compliant devices
GetDriverVersion() common method to all ASCOM Alpaca compliant devices
@returns a string containing only the major and minor version of the driver.
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__driverversion
@returns a string containing only the major and minor version of the driver.
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__driverversion
*/
func (a *ASCOMAlpacaAPIClient) GetDriverVersion(deviceType string, deviceNumber uint) (string, error) {
return a.GetStringResponse(deviceType, deviceNumber, "driverversion")
}

/*
GetInterfaceVersion() common method to all ASCOM Alpaca compliant devices
@returns the version of the ASCOM device interface contract to which
this device complies. Only one interface version is current at a
moment in time and all new devices should be built to the latest
interface version. Applications can choose which device interface
versions they support and it is in their interest to support previous
versions as well as the current version to ensure thay can use the
largest number of devices.
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__interfaceversion
GetInterfaceVersion() common method to all ASCOM Alpaca compliant devices
@returns the version of the ASCOM device interface contract to which
this device complies. Only one interface version is current at a
moment in time and all new devices should be built to the latest
interface version. Applications can choose which device interface
versions they support and it is in their interest to support previous
versions as well as the current version to ensure thay can use the
largest number of devices.
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__interfaceversion
*/
func (a *ASCOMAlpacaAPIClient) GetInterfaceVersion(deviceType string, deviceNumber uint) (int32, error) {
return a.GetInt32Response(deviceType, deviceNumber, "interfaceversion")
}

/*
GetName() common method to all ASCOM Alpaca compliant devices
GetName() common method to all ASCOM Alpaca compliant devices
@returns the name of the device
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__name
@returns the name of the device
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__name
*/
func (a *ASCOMAlpacaAPIClient) GetName(deviceType string, deviceNumber uint) (string, error) {
return a.GetStringResponse(deviceType, deviceNumber, "name")
}

/*
GetSupportedActions() common method to all ASCOM Alpaca compliant devices
GetSupportedActions() common method to all ASCOM Alpaca compliant devices
@returns the list of action names supported by this driver.
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__supportedactions
@returns the list of action names supported by this driver.
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__supportedactions
*/
func (a *ASCOMAlpacaAPIClient) GetSupportedActions(deviceType string, deviceNumber uint) ([]string, error) {
return a.GetStringListResponse(deviceType, deviceNumber, "supportedactions")
Expand Down
72 changes: 36 additions & 36 deletions pkg/alpacago/calibrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ func NewCoverCalibrator(clientId uint32, secure bool, domain string, ip string,
}

/*
IsConnected() common method to all ASCOM Alpaca compliant devices
IsConnected() common method to all ASCOM Alpaca compliant devices
@returns the connected state of the device
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__connected
@returns the connected state of the device
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__connected
*/
func (c *CoverCalibrator) IsConnected() (bool, error) {
return c.Alpaca.GetBooleanResponse("covercalibrator", c.DeviceNumber, "connected")
}

/*
SetConnected() common method to all ASCOM Alpaca compliant devices
SetConnected() common method to all ASCOM Alpaca compliant devices
@param connected bool (set True to connect to the device hardware, set false to disconnect from the device hardware)
@returns the connected state of the device
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/put__device_type___device_number__connected
@param connected bool (set True to connect to the device hardware, set false to disconnect from the device hardware)
@returns the connected state of the device
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/put__device_type___device_number__connected
*/
func (c *CoverCalibrator) SetConnected(connected bool) error {
c.Alpaca.TransactionId++
Expand All @@ -83,54 +83,54 @@ func (c *CoverCalibrator) SetConnected(connected bool) error {
}

/*
GetBrightness()
GetBrightness()
@returns the current calibrator brightness in the range 0 (completely off) to MaxBrightness (fully on)
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/get_covercalibrator__device_number__brightness
@returns the current calibrator brightness in the range 0 (completely off) to MaxBrightness (fully on)
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/get_covercalibrator__device_number__brightness
*/
func (c *CoverCalibrator) GetBrightness() (float64, error) {
return c.Alpaca.GetFloat64Response("covercalibrator", c.DeviceNumber, "brightness")
}

/*
GetStatus()
GetStatus()
@returns the state of the calibration device, if present, otherwise returns "NotPresent". The calibrator state mode is specified as an integer value from the CalibratorStatus Enum.
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__calibratorstate
@see https://ascom-standards.org/Help/Platform/html/T_ASCOM_DeviceInterface_CalibratorStatus.htm
@returns the state of the calibration device, if present, otherwise returns "NotPresent". The calibrator state mode is specified as an integer value from the CalibratorStatus Enum.
@see https://ascom-standards.org/api/#/ASCOM%20Methods%20Common%20To%20All%20Devices/get__device_type___device_number__calibratorstate
@see https://ascom-standards.org/Help/Platform/html/T_ASCOM_DeviceInterface_CalibratorStatus.htm
*/
func (c *CoverCalibrator) GetStatus() (CalibratorState, error) {
status, err := c.Alpaca.GetInt32Response("covercalibrator", c.DeviceNumber, "calibratorstate")
return CalibratorState(status), err
}

/*
GetCoverStatus()
GetCoverStatus()
@returns the state of the device cover, if present, otherwise returns "NotPresent". The cover state mode is specified as an integer value from the CoverStatus Enum.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/get_covercalibrator__device_number__coverstate
@see https://ascom-standards.org/Help/Platform/html/T_ASCOM_DeviceInterface_CoverStatus.htm
@returns the state of the device cover, if present, otherwise returns "NotPresent". The cover state mode is specified as an integer value from the CoverStatus Enum.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/get_covercalibrator__device_number__coverstate
@see https://ascom-standards.org/Help/Platform/html/T_ASCOM_DeviceInterface_CoverStatus.htm
*/
func (c *CoverCalibrator) GetCoverStatus() (CoverState, error) {
status, err := c.Alpaca.GetInt32Response("covercalibrator", c.DeviceNumber, "coverstate")
return CoverState(status), err
}

/*
GetMaxBrightness()
GetMaxBrightness()
@returns the brightness value that makes the calibrator deliver its maximum illumination.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/get_covercalibrator__device_number__maxbrightness
@returns the brightness value that makes the calibrator deliver its maximum illumination.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/get_covercalibrator__device_number__maxbrightness
*/
func (c *CoverCalibrator) GetMaxBrightness() (int32, error) {
return c.Alpaca.GetInt32Response("covercalibrator", c.DeviceNumber, "maxbrightness")
}

/*
SetCalibratorOn()
SetCalibratorOn()
@returns and error, or nil, if nil the calibrator on if the device has calibration capability.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/put_covercalibrator__device_number__calibratoron
@returns and error, or nil, if nil the calibrator on if the device has calibration capability.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/put_covercalibrator__device_number__calibratoron
*/
func (c *CoverCalibrator) SetCalibratorOn(brightness int32) error {
c.Alpaca.TransactionId++
Expand All @@ -146,10 +146,10 @@ func (c *CoverCalibrator) SetCalibratorOn(brightness int32) error {
}

/*
SetCalibratorOff()
SetCalibratorOff()
@turns the calibrator off if the device has calibration capability.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/put_covercalibrator__device_number__calibratoroff
@turns the calibrator off if the device has calibration capability.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/put_covercalibrator__device_number__calibratoroff
*/
func (c *CoverCalibrator) SetCalibratorOff() error {
c.Alpaca.TransactionId++
Expand All @@ -163,10 +163,10 @@ func (c *CoverCalibrator) SetCalibratorOff() error {
}

/*
CloseCover()
CloseCover()
@returns and error, or nil, if nil initiates cover closing if a cover is present.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/put_covercalibrator__device_number__closecover
@returns and error, or nil, if nil initiates cover closing if a cover is present.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/put_covercalibrator__device_number__closecover
*/
func (c *CoverCalibrator) CloseCover() error {
c.Alpaca.TransactionId++
Expand All @@ -180,10 +180,10 @@ func (c *CoverCalibrator) CloseCover() error {
}

/*
HaltCover()
HaltCover()
@returns and error, or nil, if nil stops any cover movement that may be in progress if a cover is present and cover movement can be interrupted.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/put_covercalibrator__device_number__haltcover
@returns and error, or nil, if nil stops any cover movement that may be in progress if a cover is present and cover movement can be interrupted.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/put_covercalibrator__device_number__haltcover
*/
func (c *CoverCalibrator) HaltCover() error {
c.Alpaca.TransactionId++
Expand All @@ -197,10 +197,10 @@ func (c *CoverCalibrator) HaltCover() error {
}

/*
OpenCover()
OpenCover()
@returns and error, or nil, if nil initiates cover opening if a cover is present.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/put_covercalibrator__device_number__opencover
@returns and error, or nil, if nil initiates cover opening if a cover is present.
@see https://ascom-standards.org/api/#/CoverCalibrator%20Specific%20Methods/put_covercalibrator__device_number__opencover
*/
func (c *CoverCalibrator) OpenCover() error {
c.Alpaca.TransactionId++
Expand Down
Loading

0 comments on commit 483395d

Please sign in to comment.