Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.
/ go-wpd Public archive

Window Portable Device binding for Go language.

License

Notifications You must be signed in to change notification settings

rlj1202/go-wpd

Repository files navigation

go-wpd

GoDoc Go Report Card Build status

Window Portable Device binding for Go language.

Examples

Enumerate devices

gowpd.Initialize()

mng, err := gowpd.CreatePortableDeviceManager()
if err != nil {
    panic(err)
}

deviceIDs, err := mng.GetDevices()
if err != nil {
    panic(err)
}

for i, deviceID := range deviceIDs {
    friendlyName, err := mng.GetDeviceFriendlyName(deviceID)
    if err != nil {
        panic(err)
    }
    manufacturer, err := mng.GetDeviceManufacturer(deviceID)
    if err != nil {
        panic(err)
    }
    description, err := mng.GetDeviceDescription(deviceID)
    if err != nil {
        panic(err)
    }

    log.Printf("[%d]:\n", i)
    log.Printf("\tName:         %s\n", friendlyName)
    log.Printf("\tManufacturer: %s\n", manufacturer)
    log.Printf("\tDescription:  %s\n", description)

    gowpd.FreeDeviceID(deviceID)
}

gowpd.Uninitialize()

About

Window Portable Device binding for Go language.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published