App-OpenHAP

 view release on metacpan or  search on metacpan

lib/App/OpenHAP/Host.pm  view on Meta::CPAN

	$self->{engine}->add_accessory($accessory);

	return;
}

sub is_paired ($self)
{
	return $self->{engine}->is_paired;
}

sub update_config_number ($self)
{
	return $self->{engine}->update_config_number;
}

# $self->mdns_txt_string:
#	The TXT records of the engine, in the format that mdnsd
#	publishes.
sub mdns_txt_string ($self)
{
	return Fugu::Mdnsd::format_txt(

lib/Protocol/HAP/Server.pm  view on Meta::CPAN

sub get_config_number ($self)
{
	return $self->{store}->get_config_number;
}

# $self->update_config_number:
#	Increment c# when the accessory database changed since the
#	last run (HAP-mDNS.md §3.1). The host calls this after
#	device loading. It compares a digest of the accessory
#	structure against the stored one.
sub update_config_number ($self)
{
	my @parts;
	for my $accessory ( $self->{bridge}->get_all_accessories ) {
		push @parts, "a$accessory->{aid}";
		for my $service ( $accessory->get_services ) {
			push @parts,
			    "s$service->{iid}:" . $service->to_json->{type};
			for my $char ( $service->get_characteristics ) {
				push @parts,
				      "c$char->{iid}:"

t/openhap/host.t  view on Meta::CPAN


# Test mDNS re-advertisement on pairing change ([HAP-mDNS §8]). The
# engine calls on_pairing_changed; the host publishes.
{
    package MockMDNS;

    sub new($class) { bless { updates => [], published => 1 }, $class }

    sub is_published($self) { return $self->{published} }

    sub update_txt($self, %args)
    {
        push @{ $self->{updates} }, $args{txt};
        return 1;
    }

    sub error($self) { return }

    package main;

    my $temp_dir = tempdir(CLEANUP => 1);



( run in 1.983 second using v1.01-cache-2.11-cpan-364913b4093 )