X-Git-Url: http://git.rot13.org/?p=perl-cwmp.git;a=blobdiff_plain;f=lib%2FCWMP%2FMethods.pm;h=3a2aa68acb5d5280f5773d0129cd069b474dc8d1;hp=585dcebfe4bfc57cb291b5d7e8939ac420a26b0a;hb=ab3c8b6b75a3c7fb9ddc5a0c474fb1aa7269bc83;hpb=35e5be71b934e7bd7898d3e86ea42e1592c7cfb8 diff --git a/lib/CWMP/Methods.pm b/lib/CWMP/Methods.pm index 585dceb..3a2aa68 100644 --- a/lib/CWMP/Methods.pm +++ b/lib/CWMP/Methods.pm @@ -51,17 +51,16 @@ sub xml { confess "no state?" unless ($state); confess "no body closure" unless ( $closure ); - confess "no ID in state ", dump( $state ) unless ( $state->{ID} ); - #warn "state used to generate xml = ", dump( $state ) if $self->debug; my $X = XML::Generator->new(':pretty'); + my @header; + push( @header, $X->ID( $cwmp, { mustUnderstand => 1 }, $state->{ID} )) if $state->{ID}; + push( @header, $X->NoMoreRequests( $cwmp, $state->{NoMoreRequests} || 0 )); + return $X->Envelope( $soap, { 'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" }, - $X->Header( $soap, - $X->ID( $cwmp, { mustUnderstand => 1 }, $state->{ID} ), - $X->NoMoreRequests( $cwmp, $state->{NoMoreRequests} || 0 ), - ), + $X->Header( $soap, @header ), $X->Body( $soap, $closure->( $X, $state ) ), ); } @@ -78,7 +77,7 @@ sub GetRPCMethods { my ( $self, $state ) = @_; $self->xml( $state, sub { my ( $X, $state ) = @_; - $X->GetRPCMethods(); + $X->GetRPCMethods( $cwmp, '' ); }); }; @@ -111,16 +110,15 @@ sub SetParameterValues { my ( $X, $state ) = @_; $X->SetParameterValues( $cwmp, - $X->ParameterList( $cwmp, - $X->ParameterNames( $cwmp, - map { - $X->ParameterValueStruct( $cwmp, - $X->Name( $cwmp, $_ ), - $X->Value( $cwmp, $params->{$_} ) - ) - } sort keys %$params - ) - ) + $X->ParameterList( [], + map { + $X->ParameterValueStruct( [], + $X->Name( [], $_ ), + $X->Value( [], $params->{$_} ) + ) + } sort keys %$params + ), + $X->ParameterKey( '' ), ); }); } @@ -219,6 +217,20 @@ sub Reboot { }); } +=head2 FactoryReset + + $method->FactoryReset( $state ); + +=cut + +sub FactoryReset { + my ( $self, $state ) = @_; + $self->xml( $state, sub { + my ( $X, $state ) = @_; + $X->FactoryReset(); + }); +} + =head1 Server methods