chromedp/cdp/systeminfo/systeminfo.go

52 lines
2.2 KiB
Go
Raw Normal View History

2017-01-24 15:09:23 +00:00
// Package systeminfo provides the Chrome Debugging Protocol
// commands, types, and events for the SystemInfo domain.
2017-01-24 15:09:23 +00:00
//
// The SystemInfo domain defines methods and events for querying low-level
// system information.
//
// Generated by the chromedp-gen command.
package systeminfo
// Code generated by chromedp-gen. DO NOT EDIT.
2017-01-24 15:09:23 +00:00
import (
"context"
2017-01-26 07:28:34 +00:00
cdp "github.com/knq/chromedp/cdp"
2017-01-24 15:09:23 +00:00
)
// 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.
2017-05-19 01:09:21 +00:00
CommandLine string `json:"commandLine,omitempty"` // The command line string used to launch the browser. Will be the empty string if not supported.
2017-01-24 15:09:23 +00:00
}
// Do executes SystemInfo.getInfo against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// 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.
2017-05-19 01:09:21 +00:00
// commandLine - The command line string used to launch the browser. Will be the empty string if not supported.
func (p *GetInfoParams) Do(ctxt context.Context, h cdp.Handler) (gpu *GPUInfo, modelName string, modelVersion string, commandLine string, err error) {
2017-01-24 15:09:23 +00:00
// execute
var res GetInfoReturns
err = h.Execute(ctxt, cdp.CommandSystemInfoGetInfo, nil, &res)
if err != nil {
2017-05-19 01:09:21 +00:00
return nil, "", "", "", err
2017-01-24 15:09:23 +00:00
}
2017-05-19 01:09:21 +00:00
return res.Gpu, res.ModelName, res.ModelVersion, res.CommandLine, nil
2017-01-24 15:09:23 +00:00
}