This is an example of setting up a responder written in Perl

Please note this example uses the Perl module Gryphon.pm.


#!/usr/bin/perl -w 

use strict; 
BEGIN { 
    sub _WINDOWS_ () {1}; 
    require 'gmsg.ph'; 
    require 'gdev.ph'; 
} 
use Gryphon; 

my ($handle, $result, $reply, $respid); 

# 
# Connect to and register with the Gryphon at address 192.168.1.1 
# 
$handle = Gryphon->new (addr => '198.168.1.1'); 
die "$@\n" unless $handle; 

# 
# Set the default Command destination and destination channel 
# 
$handle->cmdDefault (gcDest => (&SD_RESP), gcDestChan => 1); 

# 
# Create the filter portion of the Add Response command 
# 
$handle->filterBlock (offset => 1, type => &FILTER_DATA_TYPE_HEADER, 
      pattern => '23', operator => &VALUE_EQ); 

# 
# Create the response portion of the Add Response command 
# 
$handle->responseBlock ( 
      gcDest => (&SD_CARD), gcDestChan => 1, hdrBits => 11, 
      hdr => '0102', data => '5a'); 

# 
# Combine the above fragments, send the resulting Add Response 
# message to the Gryphon and wait for the response 
# 
($result, $reply) = $handle->cmdSend (cmd => (&CMD_MSGRESP_ADD), 
      data => [&FILTER_FLAG_INACTIVE, 0, &FR_RESP_AFTER_EVENT, 0]); 

$respid = 0; 
$respid = unpack 'C', $reply if $result == 0; 
print "Got resp ID $respid\n"; 

# 
# Activate the response, but don't bother looking at the response 
# 
$handle->cmdSend (cmd => &CMD_MSGRESP_MODIFY, 
      data => [$respid, &ACTIVATE_FILTER]); 

# 
# Set the loopback off 
# 
$handle->cmdSend (cmd => &CMD_CARD_TX_LOOP_OFF, gcDest => &SD_CARD); 

This document was obtained from:

Dearborn Group, Inc.
(248) 488-2080
dg@dgtech.com
http://www.dgtech.com

Copyright © 2003 Dearborn Group Inc.