chromedp/cdp/systeminfo/systeminfo.go
Kenneth Shaw b5032069e3 Fixing race issues
- Refactored chromedp-gen and cdp code so that Execute no longer returns
  a channel
- Fixing potential race problems in handler
- Eliminated some dead code
- Updated examples to include new logging parameters
2017-02-14 17:15:53 +07:00

50 lines
1.9 KiB
Go

// Package systeminfo provides the Chrome Debugging Protocol
// commands, types, and events for the SystemInfo domain.
//
// The SystemInfo domain defines methods and events for querying low-level
// system information.
//
// Generated by the chromedp-gen command.
package systeminfo
// AUTOGENERATED. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// GetInfoParams returns information about the system.
type GetInfoParams struct{}
// GetInfo returns information about the system.
func GetInfo() *GetInfoParams {
return &GetInfoParams{}
}
// GetInfoReturns return values.
type GetInfoReturns struct {
Gpu *GPUInfo `json:"gpu,omitempty"` // Information about the GPUs on the system.
ModelName string `json:"modelName,omitempty"` // A platform-dependent description of the model of the machine. On Mac OS, this is, for example, 'MacBookPro'. Will be the empty string if not supported.
ModelVersion string `json:"modelVersion,omitempty"` // A platform-dependent description of the version of the machine. On Mac OS, this is, for example, '10.1'. Will be the empty string if not supported.
}
// Do executes SystemInfo.getInfo against the provided context and
// target handler.
//
// returns:
// gpu - Information about the GPUs on the system.
// modelName - A platform-dependent description of the model of the machine. On Mac OS, this is, for example, 'MacBookPro'. Will be the empty string if not supported.
// modelVersion - A platform-dependent description of the version of the machine. On Mac OS, this is, for example, '10.1'. Will be the empty string if not supported.
func (p *GetInfoParams) Do(ctxt context.Context, h cdp.Handler) (gpu *GPUInfo, modelName string, modelVersion string, err error) {
// execute
var res GetInfoReturns
err = h.Execute(ctxt, cdp.CommandSystemInfoGetInfo, nil, &res)
if err != nil {
return nil, "", "", err
}
return res.Gpu, res.ModelName, res.ModelVersion, nil
}