:pserver:anonymous@intra.tektonica.com:/opt/cvs - gsmperl - Fri Dec 21 07:37 CET...
[gsmperl.git] / GSM / SMS / OTA / CLIicon.pm
1 package GSM::SMS::OTA::CLIicon;
2 use GSM::SMS::OTA::Bitmap;
3
4 require  Exporter;
5 @ISA = qw(Exporter);
6  
7 @EXPORT = qw(   OTACLIicon_makestream  
8                 OTACLIicon_PORT 
9                 OTACLIicon_fromb64
10                 OTACLIicon_fromfile
11                 ); 
12
13 $VERSION = '0.1';
14
15 use constant OTACLIicon_PORT => 5507;
16
17 sub OTACLIicon_fromb64 {
18         my ($b64, $format) = @_;
19
20         my $arr = OTABitmap_fromb64( $b64, $format );
21         return -1 if $arr == -1;
22
23         return OTACLIicon_makestream( 72, 14, 1, $arr ); 
24 }
25
26 sub OTACLIicon_fromfile {
27         my ($file) = @_;
28
29         my $arr = OTABitmap_fromfile( $file );
30         return -1 if $arr == -1;
31
32         return OTACLIicon_makestream( 72, 14, 1, $arr );
33 }
34
35 sub OTACLIicon_makestream {
36         my ($width, $height, $depth, $ref_bytearray) = @_;
37
38         my $stream;
39
40         $stream.='00';  # Nokia stuff for CLI identification
41         $stream.=OTABitmap_makestream($width, $height, $depth, $ref_bytearray);
42
43         return $stream;
44 }
45
46 1;
47
48 =head1 NAME
49
50 GSM::SMS::OTA::CLIicon
51
52 =head1 DESCRIPTION
53
54 This package implements encoding of a CLI ( Caller Line Identification ) icon. 
55
56 =head1 METHODS
57
58 =head2 OTACLIicon_fromb64
59
60         $stream = OTACLIicon_fromb64( $b64, $format );
61
62 Generate a CLI icon from a b64 endoded bitmap in the specified format ( gif, png, bmp, ... ).
63
64 =head2 OTACLIicon_fromfile
65
66         $stream =OTACLIicon_fromfile( $file );
67
68 Generate a CLI icon from an image file.
69
70 =head2 OTACLIicon_PORT
71
72 NSB port number for CLI icon message.
73
74 =head1 AUTHOR
75
76 Johan Van den Brande <johan@vandenbrande.com>