--ems-melody-file-send wrapper implemented
authorshort <>
Mon, 14 Jan 2002 02:24:38 +0000 (02:24 +0000)
committershort <>
Mon, 14 Jan 2002 02:24:38 +0000 (02:24 +0000)
 - it is just EMS iMelody _encapsulation_, source file already must be:
   ^BEGIN:IMELODY\r\n.*END:IMELODY\r\n$

GSM/SMS/NBS/Message.pm
GSM/examples/commandline/gsmcmd

index 7ece53a..ed6fbe3 100644 (file)
@@ -19,6 +19,7 @@ use constant USERDATA_LENGTH    => 140;
 use constant DECONCAT_TOTAL     => "_deconcat_total";  # internal: undef=>try single message, *=>try & messages
 use constant TEXT_POSITION      => "text_position";    # numeric position in $payload, UDH IE will be present only once
 
+use constant IEI_IMELODY          => 0x0C;  #IEI: User Defined Sound (iMelody max 128 bytes)
 use constant IEI_ANIMATION_LARGE  => 0x0E;  #IEI: EMS large animation (16x16 x4 = 128 bytes)
 use constant IEI_ANIMATION_SMALL  => 0x0F;  #IEI: EMS small animation ( 8x 8 x4 =  32 bytes)
 use constant IEI_PICTURE_LARGE    => 0x10;  #IEI: EMS large    picture (32x32 = 128 bytes)
@@ -153,6 +154,15 @@ sub _ie_ems_animation {
        );
 }
 
+sub _ie_ems_melody {
+       my ($self, %args) = @_;
+       
+       return $self->_iebuilder(IEI_IMELODY,
+                       $args{TEXT_POSITION}, # position in the SMS
+                       unpack("C*",$args{"textdata"}),
+       );
+}
+
 sub _ie_alcatel {
        my ($self, %args) = @_;
 
index c378ee4..8adb0da 100755 (executable)
@@ -24,6 +24,7 @@ my $opt_logo_group_send;
 my $opt_ems_force_variable;
 my $opt_ems_picture_send;
 my $opt_ems_animation_send;
+my $opt_ems_melody_file_send;
 my $opt_alcatel_name;
 my $opt_alcatel_picture_send;
 my $opt_alcatel_animation_send;
@@ -36,6 +37,7 @@ GetOptions(
        "ems-force-variable"              => \$opt_ems_force_variable,
        "ems-picture-send:s"              => \$opt_ems_picture_send,
        "ems-animation-send:s"            => \$opt_ems_animation_send,
+       "ems-melody-file-send:s"          => \$opt_ems_melody_file_send,
        "alcatel-name:s"                  => \$opt_alcatel_name,
        "alcatel-picture-send:s"          => \$opt_alcatel_picture_send,
        "alcatel-animation-send:s"        => \$opt_alcatel_animation_send,
@@ -50,6 +52,7 @@ Usage: $0 [--verbose] [--transport=<transport.conf>]
        [--ems-force-variable]
        [--ems-picture-send=<image file>]
        [--ems-animation-send=<image file>]
+       [--ems-melody-file-send=<iMelody file>]
        [--alcatel-name=<resource name>]
        [--alcatel-picture-send=<image file>]
        [--alcatel-animation-send=<image file>]
@@ -106,6 +109,20 @@ for $msisdn (@ARGV) {
                } ]);
        }
 
+       if ($opt_ems_melody_file_send) {
+               local (*F);
+               open F, $opt_ems_melody_file_send;
+               my $ems_melody_file_data = <F>;
+               close F;
+               warn "EMS iMelody file format not recognized, wrapping anyway"
+                               if $ems_melody_file_data!~/^BEGIN:IMELODY\r\n.*END:IMELODY\r\n$/s;
+               $nbs->sendsms($msisdn, "", udh=>[ {
+                               "type"=>"ems_melody",
+                               TEXT_POSITION=>0,
+                               "textdata"=>$ems_melody_file_data,
+               } ]);
+       }
+
        if ($opt_alcatel_picture_send) {
                my $bitmap = GSM::SMS::Bitmap->new($opt_alcatel_picture_send);
                my ($msg, $udh) = GSM::SMS::NBS::Alcatel->alcatel_picture($bitmap);