NAME

Protocol::IR::Format::GC - Global Cache IR database JSON import

VERSION

version 1.0

SYNOPSIS

use Protocol::IR::Converter;

my $converter = Protocol::IR::Converter->new();

# Import a Global Cache IR database export (file path or JSON string)
my $codes = $converter->import_format('GCIR', 'gc-ir.json');
for my $code (@$codes) {
    print $code->alias . " (" . $code->protocol . ")\n";
}

# The wig entry point accepts the same export interchangeably
my $also = $converter->import_format('wig', 'gc-ir.json');

DESCRIPTION

Protocol::IR::Format::GC imports a Global Cache IR database JSON document (a commands list, each entry carrying a name and a raw pronto Pronto hex payload, plus opaque keycode/protocol strings). The payload is the same Pronto hex a HAIR wig carries, so the imported codes are identical to what import_format('wig', ...) would produce, and the wig importer accepts this shape automatically. Commands that carry no Pronto payload (a compact export may list buttons it never captured a signal for) are skipped rather than failing the import. Dies with a concrete reason if the JSON is malformed, a command is missing its name, or a payload cannot be decoded.

Import-only: the keycode/protocol strings are Global Cache's own naming, so the format is never exported.

METHODS

decode

my $codes = $class->decode($input, $registry);

Parses a GC file path or JSON string and returns an arrayref of Protocol::IR::Code objects, one per command with a Pronto payload, alias set from the command name and send_count set from the command's repeat count (the repeats field, falling back to the trailing :N of the keycode).

SUPPORT

Source code: https://github.com/bwarden/perl-protocol-ir

Bug reports and feature requests: https://github.com/bwarden/perl-protocol-ir/issues

AUTHOR

Brett T. Warden <bwarden@cpan.org>

COPYRIGHT AND LICENSE

Copyright (c) 2026 Brett T. Warden

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.