1 |
#!/usr/bin/perl |
2 |
|
3 |
# $Id: cellcom.pl,v 1.1 2003/04/16 12:24:20 joko Exp $ |
4 |
# $Log: cellcom.pl,v $ |
5 |
|
6 |
|
7 |
# cellrap - or Cellular2Pim |
8 |
|
9 |
# requirements: |
10 |
# 1. testing, modularizing |
11 |
# 2. high-speed phonebook (complete?) backup |
12 |
# 3. FollowMe: automagically detect connection, read IMEI |
13 |
# 4. status, introspection, command-groups, schema |
14 |
# 5. protocol-declaration in xml (it's a "service"!) |
15 |
# 6. actions from command line |
16 |
# 7. web frontend via WebExplorer |
17 |
# 8. synchronize clock with some time server via ntp(?) |
18 |
|
19 |
# changelog: |
20 |
# x first steps |
21 |
# x Data::Storage::Handler::Cellphone |
22 |
# x integration with Data::Rap for executing "actions" |
23 |
# a integration with master /etc/rap.xml on grasshopper - two new targets: cellphone.clock, cellphone.* |
24 |
|
25 |
|
26 |
package ctrl; |
27 |
|
28 |
use strict; |
29 |
use warnings; |
30 |
|
31 |
use lib '../../../libs'; |
32 |
|
33 |
use Data::Dumper; |
34 |
use Data::Storage::Handler::Cellphone; |
35 |
use Data::Rap; |
36 |
|
37 |
#require 'modules/me45/ME45.pm'; |
38 |
#my $me45 = ME45->new('COM1'); |
39 |
#$me45->get_vendor(); |
40 |
|
41 |
|
42 |
my $cellular; |
43 |
|
44 |
sub do { |
45 |
my $command = shift; |
46 |
return $cellular->{rap}->perform_target($command); |
47 |
} |
48 |
|
49 |
sub start { |
50 |
$cellular = Data::Storage::Handler::Cellphone->new( |
51 |
specfile => 'siemens_x45.xml', |
52 |
port => 'COM1', |
53 |
baudrate => 115200, |
54 |
command_type => 'GSM', |
55 |
); |
56 |
#$cellular->response_read(); |
57 |
} |
58 |
|
59 |
sub stop { |
60 |
$cellular->transport_shutdown(); |
61 |
} |
62 |
|
63 |
sub help { |
64 |
$cellular->{rap}->start(); |
65 |
} |
66 |
|
67 |
|
68 |
package main; |
69 |
|
70 |
use strict; |
71 |
use warnings; |
72 |
|
73 |
my $target = shift; |
74 |
#$target ||= ''; |
75 |
|
76 |
ctrl::start(); |
77 |
if (!ctrl::do($target)) { |
78 |
ctrl::help(); |
79 |
} |
80 |
ctrl::stop(); |
81 |
|
82 |
1; |
83 |
__END__ |