Initial commit
authorAlexander Kanavin <alexander.kanavin@nokia.com>
Wed, 10 Nov 2010 14:36:47 +0000 (16:36 +0200)
committerAlexander Kanavin <alexander.kanavin@nokia.com>
Wed, 10 Nov 2010 14:36:47 +0000 (16:36 +0200)
77 files changed:
.gitignore [new file with mode: 0644]
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
README [new file with mode: 0644]
lib/lib.pro [new file with mode: 0644]
lib/libofono-qt_global.h [new file with mode: 0644]
lib/ofono-qt.prf [new file with mode: 0644]
lib/ofonocallbarring.cpp [new file with mode: 0644]
lib/ofonocallbarring.h [new file with mode: 0644]
lib/ofonocallforwarding.cpp [new file with mode: 0644]
lib/ofonocallforwarding.h [new file with mode: 0644]
lib/ofonocallmeter.cpp [new file with mode: 0644]
lib/ofonocallmeter.h [new file with mode: 0644]
lib/ofonocallsettings.cpp [new file with mode: 0644]
lib/ofonocallsettings.h [new file with mode: 0644]
lib/ofonointerface.cpp [new file with mode: 0644]
lib/ofonointerface.h [new file with mode: 0644]
lib/ofonomessagemanager.cpp [new file with mode: 0644]
lib/ofonomessagemanager.h [new file with mode: 0644]
lib/ofonomessagewaiting.cpp [new file with mode: 0644]
lib/ofonomessagewaiting.h [new file with mode: 0644]
lib/ofonomodem.cpp [new file with mode: 0644]
lib/ofonomodem.h [new file with mode: 0644]
lib/ofonomodeminterface.cpp [new file with mode: 0644]
lib/ofonomodeminterface.h [new file with mode: 0644]
lib/ofonomodemmanager.cpp [new file with mode: 0644]
lib/ofonomodemmanager.h [new file with mode: 0644]
lib/ofononetworkoperator.cpp [new file with mode: 0644]
lib/ofononetworkoperator.h [new file with mode: 0644]
lib/ofononetworkregistration.cpp [new file with mode: 0644]
lib/ofononetworkregistration.h [new file with mode: 0644]
lib/ofonophonebook.cpp [new file with mode: 0644]
lib/ofonophonebook.h [new file with mode: 0644]
lib/ofonoradiosettings.cpp [new file with mode: 0644]
lib/ofonoradiosettings.h [new file with mode: 0644]
lib/ofonosimmanager.cpp [new file with mode: 0644]
lib/ofonosimmanager.h [new file with mode: 0644]
lib/ofonosupplementaryservices.cpp [new file with mode: 0644]
lib/ofonosupplementaryservices.h [new file with mode: 0644]
lib/ofonovoicecallmanager.cpp [new file with mode: 0644]
lib/ofonovoicecallmanager.h [new file with mode: 0644]
ofono-qt.pro [new file with mode: 0644]
tests/test_ofonocallbarring.cpp [new file with mode: 0644]
tests/test_ofonocallbarring.pro [new file with mode: 0644]
tests/test_ofonocallforwarding.cpp [new file with mode: 0644]
tests/test_ofonocallforwarding.pro [new file with mode: 0644]
tests/test_ofonocallmeter.cpp [new file with mode: 0644]
tests/test_ofonocallmeter.pro [new file with mode: 0644]
tests/test_ofonocallsettings.cpp [new file with mode: 0644]
tests/test_ofonocallsettings.pro [new file with mode: 0644]
tests/test_ofonointerface.cpp [new file with mode: 0644]
tests/test_ofonointerface.pro [new file with mode: 0644]
tests/test_ofonomessagemanager.cpp [new file with mode: 0644]
tests/test_ofonomessagemanager.pro [new file with mode: 0644]
tests/test_ofonomessagewaiting.cpp [new file with mode: 0644]
tests/test_ofonomessagewaiting.pro [new file with mode: 0644]
tests/test_ofonomodem.cpp [new file with mode: 0644]
tests/test_ofonomodem.pro [new file with mode: 0644]
tests/test_ofonomodemmanager.cpp [new file with mode: 0644]
tests/test_ofonomodemmanager.pro [new file with mode: 0644]
tests/test_ofononetworkoperator.cpp [new file with mode: 0644]
tests/test_ofononetworkoperator.pro [new file with mode: 0644]
tests/test_ofononetworkregistration.cpp [new file with mode: 0644]
tests/test_ofononetworkregistration.pro [new file with mode: 0644]
tests/test_ofonophonebook.cpp [new file with mode: 0644]
tests/test_ofonophonebook.pro [new file with mode: 0644]
tests/test_ofonoradiosettings.cpp [new file with mode: 0644]
tests/test_ofonoradiosettings.pro [new file with mode: 0644]
tests/test_ofonosimmanager.cpp [new file with mode: 0644]
tests/test_ofonosimmanager.pro [new file with mode: 0644]
tests/test_ofonosupplementaryservices.cpp [new file with mode: 0644]
tests/test_ofonosupplementaryservices.pro [new file with mode: 0644]
tests/test_ofonovoicecallmanager.cpp [new file with mode: 0644]
tests/test_ofonovoicecallmanager.pro [new file with mode: 0644]
tests/testcase.pro [new file with mode: 0644]
tests/tests.pro [new file with mode: 0644]
version.pri [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..bdebf01
--- /dev/null
@@ -0,0 +1,10 @@
+*.o
+*.a
+*.moc
+moc_*
+Makefile*
+*.so*
+*.pc
+*.prl
+doxygen.cfg
+doc/
diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..57150d4
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Alexander Kanavin <alexander.kanavin@nokia.com>
+Jukka Saunamäki <jukka.saunamaki@nokia.com>  
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..4362b49
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+\f
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..ac46331
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+This package contains Qt bindings to a number of oFono cellular service interfaces.
diff --git a/lib/lib.pro b/lib/lib.pro
new file mode 100644 (file)
index 0000000..d0613c7
--- /dev/null
@@ -0,0 +1,63 @@
+include(../version.pri)
+
+TEMPLATE = lib
+TARGET = ofono-qt
+
+CONFIG += debug
+DEFINES += BUILD_OFONO_QT_LIBRARY
+
+QT += dbus
+QT -= gui
+INCLUDEPATH += ../
+
+PUBLIC_HEADERS += ofonointerface.h 
+PUBLIC_HEADERS += ofonomodeminterface.h 
+PUBLIC_HEADERS += ofonomodemmanager.h
+PUBLIC_HEADERS += ofonomodem.h
+PUBLIC_HEADERS += ofonophonebook.h
+PUBLIC_HEADERS += ofonomessagemanager.h
+PUBLIC_HEADERS += ofonomessagewaiting.h
+PUBLIC_HEADERS += ofonoradiosettings.h
+PUBLIC_HEADERS += ofonosimmanager.h
+PUBLIC_HEADERS += ofonocallbarring.h
+PUBLIC_HEADERS += ofonocallforwarding.h
+PUBLIC_HEADERS += ofonocallmeter.h
+PUBLIC_HEADERS += ofonocallsettings.h
+PUBLIC_HEADERS += ofononetworkoperator.h
+PUBLIC_HEADERS += ofononetworkregistration.h
+PUBLIC_HEADERS += ofonosupplementaryservices.h
+PUBLIC_HEADERS += ofonovoicecallmanager.h
+
+HEADERS += $$PUBLIC_HEADERS
+
+SOURCES += ofonointerface.cpp 
+SOURCES += ofonomodeminterface.cpp 
+SOURCES += ofonomodemmanager.cpp       
+SOURCES += ofonomodem.cpp
+SOURCES += ofonophonebook.cpp
+SOURCES += ofonomessagemanager.cpp
+SOURCES += ofonomessagewaiting.cpp
+SOURCES += ofonoradiosettings.cpp
+SOURCES += ofonosimmanager.cpp
+SOURCES += ofonocallbarring.cpp
+SOURCES += ofonocallforwarding.cpp
+SOURCES += ofonocallmeter.cpp
+SOURCES += ofonocallsettings.cpp
+SOURCES += ofononetworkoperator.cpp
+SOURCES += ofononetworkregistration.cpp
+SOURCES += ofonosupplementaryservices.cpp
+SOURCES += ofonovoicecallmanager.cpp
+
+target.path = $$[QT_INSTALL_PREFIX]/lib
+headers.files = $$PUBLIC_HEADERS
+headers.path = $$[QT_INSTALL_PREFIX]/include/ofono-qt
+
+CONFIG += create_pc create_prl
+
+pkgconfig.path = $$[QT_INSTALL_PREFIX]/lib/pkgconfig
+pkgconfig.files = ofono-qt.pc
+
+qtconfig.path = $$[QT_INSTALL_PREFIX]/share/qt4/mkspecs/features
+qtconfig.files = ofono-qt.prf
+
+INSTALLS += target headers pkgconfig qtconfig
diff --git a/lib/libofono-qt_global.h b/lib/libofono-qt_global.h
new file mode 100644 (file)
index 0000000..63aaf9c
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONO_QT_GLOBAL_H
+#define OFONO_QT_GLOBAL_H
+
+#include <QtCore/QtGlobal>
+
+#ifdef BUILD_OFONO_QT_LIBRARY
+#  define OFONO_QT_EXPORT Q_DECL_EXPORT
+#else
+#  define OFONO_QT_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // OFONO_QT_GLOBAL_H
diff --git a/lib/ofono-qt.prf b/lib/ofono-qt.prf
new file mode 100644 (file)
index 0000000..b447419
--- /dev/null
@@ -0,0 +1,9 @@
+prefix=/usr
+exec_prefix=$${prefix}
+
+DEPENDPATH += $${prefix}/include
+DEPENDPATH += $${prefix}/include/ofono-qt
+INCLUDEPATH += $${prefix}/include
+INCLUDEPATH += $${prefix}/include/ofono-qt
+LIBS += -L $${exec_prefix}/lib -lofono-qt
+
diff --git a/lib/ofonocallbarring.cpp b/lib/ofonocallbarring.cpp
new file mode 100644 (file)
index 0000000..31a542a
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "ofonocallbarring.h"
+
+#define SET_PROPERTY_TIMEOUT 300000
+
+OfonoCallBarring::OfonoCallBarring(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.CallBarring", OfonoInterface::GetAllOnFirstRequest, parent)
+{
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+    connect(this, SIGNAL(setPropertyFailed(const QString&)), 
+            this, SLOT(setPropertyFailed(const QString&)));
+    connect(this, SIGNAL(requestPropertyComplete(bool, const QString&, const QVariant&)),
+           this, SLOT(requestPropertyComplete(bool, const QString&, const QVariant&)));
+    QDBusConnection::systemBus().connect("org.ofono", path(), ifname(), 
+                                        "IncomingBarringInEffect",
+                                        this,
+                                        SIGNAL(incomingBarringInEffect()));
+    QDBusConnection::systemBus().connect("org.ofono", path(), ifname(), 
+                                        "OutgoingBarringInEffect",
+                                        this,
+                                        SIGNAL(outgoingBarringInEffect()));
+    m_pendingProperty = QString();
+}
+
+OfonoCallBarring::~OfonoCallBarring()
+{
+}
+
+void OfonoCallBarring::setProperty(const QString& name, 
+                                  const QVariant& property, 
+                                  const QString& password)
+{
+    if (m_pendingProperty.length() > 0) {
+        // FIXME: should indicate that a setProperty is already in progress
+        m_errorName = QString();
+        m_errorMessage = QString("Operation already in progress");
+        emit setPropertyFailed(name);
+        return;
+    }
+
+
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "SetProperty");
+    request.setArguments(QList<QVariant>() 
+                        << QVariant(name) 
+                        << QVariant::fromValue(QDBusVariant(property))
+                        << QVariant(password));
+
+    bool result = QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(setPropertyResp()),
+                                       SLOT(setPropertyErr(const QDBusError&)),
+                                       SET_PROPERTY_TIMEOUT);
+    if (!result) {
+        // FIXME: should indicate that sending a message failed
+        m_errorName = QString();
+        m_errorMessage = QString("DBUS sending failed");
+       emit setPropertyFailed(name);
+       return;
+    }
+    m_pendingProperty = name;
+
+
+}
+
+void OfonoCallBarring::setPropertyResp()
+{
+    m_pendingProperty = QString();
+    // emit nothing; we will get a PropertyChanged signal
+}
+
+void OfonoCallBarring::setPropertyErr(const QDBusError& error)
+{
+    QString prop = m_pendingProperty;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    m_pendingProperty = QString();
+    emit setPropertyFailed(prop);
+}
+
+
+void OfonoCallBarring::requestChangePassword(QString old_password, 
+                                            QString new_password)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "ChangePassword");
+    request << old_password << new_password;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(changePasswordResp()),
+                                       SLOT(changePasswordErr(const QDBusError&)));
+}
+
+void OfonoCallBarring::requestDisableAll(QString password)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "DisableAll");
+    request << password;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(disableAllResp()),
+                                       SLOT(disableAllErr(const QDBusError&)));
+}
+
+void OfonoCallBarring::requestDisableAllIncoming(QString password)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "DisableAllIncoming");
+    request << password;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(disableAllIncomingResp()),
+                                       SLOT(disableAllIncomingErr(const QDBusError&)));
+}
+
+void OfonoCallBarring::requestDisableAllOutgoing(QString password)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "DisableAllOutgoing");
+    request << password;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(disableAllOutgoingResp()),
+                                       SLOT(disableAllOutgoingErr(const QDBusError&)));
+}
+
+
+void OfonoCallBarring::requestVoiceIncoming()
+{
+    requestProperty("VoiceIncoming");
+}
+
+void OfonoCallBarring::setVoiceIncoming(QString barrings, QString password)
+{
+    setProperty("VoiceIncoming", qVariantFromValue(barrings), password);
+}
+
+void OfonoCallBarring::requestVoiceOutgoing()
+{
+    requestProperty("VoiceOutgoing");
+}
+
+void OfonoCallBarring::setVoiceOutgoing(QString barrings, QString password)
+{
+    setProperty("VoiceOutgoing", qVariantFromValue(barrings), password);
+}
+
+void OfonoCallBarring::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "VoiceIncoming") { 
+        emit voiceIncomingChanged(value.value<QString>());
+    } else  if (property == "VoiceOutgoing") { 
+        emit voiceOutgoingChanged(value.value<QString>());
+    }
+}
+
+void OfonoCallBarring::setPropertyFailed(const QString& property)
+{
+    if (property == "VoiceIncoming") { 
+        emit setVoiceIncomingFailed();
+    } else if (property == "VoiceOutgoing") {  
+        emit setVoiceOutgoingFailed();
+    }  
+}
+
+void OfonoCallBarring::requestPropertyComplete(bool success, const QString& property, const QVariant& value)
+{
+    if (property == "VoiceIncoming") { 
+        success ? emit voiceIncomingComplete(true, value.value<QString>()) : emit voiceIncomingComplete(false, QString());
+    } else if (property == "VoiceOutgoing") {  
+        success ? emit voiceOutgoingComplete(true, value.value<QString>()) : emit voiceOutgoingComplete(false, QString());
+    }
+}
+
+void OfonoCallBarring::changePasswordResp()
+{
+    emit changePasswordComplete(TRUE);
+}
+
+void OfonoCallBarring::changePasswordErr(QDBusError error)
+{
+    qDebug() << "ChangePassword failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit changePasswordComplete(FALSE);
+}
+
+void OfonoCallBarring::disableAllResp()
+{
+    emit disableAllComplete(TRUE);
+}
+
+void OfonoCallBarring::disableAllErr(QDBusError error)
+{
+    qDebug() << "DisableAll failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit disableAllComplete(FALSE);
+}
+
+void OfonoCallBarring::disableAllIncomingResp()
+{
+    emit disableAllIncomingComplete(TRUE);
+}
+
+void OfonoCallBarring::disableAllIncomingErr(QDBusError error)
+{
+    qDebug() << "DisableAllIncoming failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit disableAllIncomingComplete(FALSE);
+}
+
+void OfonoCallBarring::disableAllOutgoingResp()
+{
+    emit disableAllOutgoingComplete(TRUE);
+}
+
+void OfonoCallBarring::disableAllOutgoingErr(QDBusError error)
+{
+    qDebug() << "DisableAllOutgoing failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit disableAllOutgoingComplete(FALSE);
+}
diff --git a/lib/ofonocallbarring.h b/lib/ofonocallbarring.h
new file mode 100644 (file)
index 0000000..d187c7e
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONOCALLBARRING_H
+#define OFONOCALLBARRING_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoCallBarring : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoCallBarring(QString modemId, QObject *parent=0);
+    ~OfonoCallBarring();
+
+    /* Properties */
+    void requestVoiceIncoming();
+    void setVoiceIncoming(QString barrings, QString password);
+    void requestVoiceOutgoing();
+    void setVoiceOutgoing(QString barrings, QString password);
+
+    /* Methods */
+    void requestChangePassword(QString old_password, QString new_password);
+    void requestDisableAll(QString password);
+    void requestDisableAllIncoming(QString password);
+    void requestDisableAllOutgoing(QString password);
+
+signals:
+    void incomingBarringInEffect();
+    void outgoingBarringInEffect();
+
+    void voiceIncomingComplete(bool success, QString barrings);
+    void voiceOutgoingComplete(bool success, QString barrings);
+    void voiceIncomingChanged(QString barrings);
+    void voiceOutgoingChanged(QString barrings);
+    void setVoiceIncomingFailed();
+    void setVoiceOutgoingFailed();
+
+    void changePasswordComplete(bool success);
+    void disableAllComplete(bool success);
+    void disableAllIncomingComplete(bool success);
+    void disableAllOutgoingComplete(bool success);
+
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void setPropertyFailed(const QString& property);
+    void setPropertyResp();
+    void setPropertyErr(const QDBusError& error);
+    void changePasswordResp();
+    void changePasswordErr(QDBusError error);
+    void disableAllResp();
+    void disableAllErr(QDBusError error);
+    void disableAllIncomingResp();
+    void disableAllIncomingErr(QDBusError error);
+    void disableAllOutgoingResp();
+    void disableAllOutgoingErr(QDBusError error);
+    void requestPropertyComplete(bool success, const QString& property, const QVariant& value);
+
+private:
+    void setProperty(const QString& name, const QVariant& property,
+                       const QString& password);
+
+   QString m_pendingProperty;
+};
+
+#endif  /* !OFONOCALLBARRING_H */
diff --git a/lib/ofonocallforwarding.cpp b/lib/ofonocallforwarding.cpp
new file mode 100644 (file)
index 0000000..07c0570
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "ofonocallforwarding.h"
+
+
+OfonoCallForwarding::OfonoCallForwarding(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.CallForwarding", OfonoInterface::GetAllOnFirstRequest, parent)
+{
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+    connect(this, SIGNAL(setPropertyFailed(const QString&)), 
+            this, SLOT(setPropertyFailed(const QString&)));
+    connect(this, SIGNAL(requestPropertyComplete(bool, const QString&, const QVariant&)),
+           this, SLOT(requestPropertyComplete(bool, const QString&, const QVariant&)));
+}
+
+OfonoCallForwarding::~OfonoCallForwarding()
+{
+}
+
+
+void OfonoCallForwarding::requestDisableAll(QString type)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "DisableAll");
+    request << type;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(disableAllResp()),
+                                       SLOT(disableAllErr(const QDBusError&)));
+}
+
+
+void OfonoCallForwarding::requestVoiceUnconditional()
+{
+    requestProperty("VoiceUnconditional");
+}
+
+void OfonoCallForwarding::setVoiceUnconditional(QString property)
+{
+    setProperty("VoiceUnconditional", qVariantFromValue(property));
+}
+
+void OfonoCallForwarding::requestVoiceBusy()
+{
+    requestProperty("VoiceBusy");
+}
+
+void OfonoCallForwarding::setVoiceBusy(QString property)
+{
+    return setProperty("VoiceBusy", qVariantFromValue(property));
+}
+
+void OfonoCallForwarding::requestVoiceNoReply()
+{
+    requestProperty("VoiceNoReply");
+}
+
+void OfonoCallForwarding::setVoiceNoReply(QString property)
+{
+    return setProperty("VoiceNoReply", qVariantFromValue(property));
+}
+
+void OfonoCallForwarding::requestVoiceNoReplyTimeout()
+{
+    requestProperty("VoiceNoReplyTimeout");
+}
+
+void OfonoCallForwarding::setVoiceNoReplyTimeout(ushort timeout)
+{
+    return setProperty("VoiceNoReplyTimeout", qVariantFromValue(timeout));
+}
+
+void OfonoCallForwarding::requestVoiceNotReachable()
+{
+    requestProperty("VoiceNotReachable");
+}
+
+void OfonoCallForwarding::setVoiceNotReachable(QString property)
+{
+    return setProperty("VoiceNotReachable", qVariantFromValue(property));
+}
+
+
+void OfonoCallForwarding::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "VoiceUnconditional") {    
+        emit voiceUnconditionalChanged(value.value<QString>());
+    } else  if (property == "VoiceBusy") {     
+        emit voiceBusyChanged(value.value<QString>());
+    } else  if (property == "VoiceNoReply") {  
+        emit voiceNoReplyChanged(value.value<QString>());
+    } else  if (property == "VoiceNoReplyTimeout") {   
+        emit voiceNoReplyTimeoutChanged(value.value<ushort>());
+    } else  if (property == "VoiceNotReachable") {     
+        emit voiceNotReachableChanged(value.value<QString>());
+    }
+}
+
+void OfonoCallForwarding::setPropertyFailed(const QString& property)
+{
+    if (property == "VoiceUnconditional") {    
+        emit setVoiceUnconditionalFailed();
+    } else  if (property == "VoiceBusy") {     
+        emit setVoiceBusyFailed();
+    } else  if (property == "VoiceNoReply") {  
+        emit setVoiceNoReplyFailed();
+    } else  if (property == "VoiceNoReplyTimeout") {   
+        emit setVoiceNoReplyTimeoutFailed();
+    } else  if (property == "VoiceNotReachable") {     
+        emit setVoiceNotReachableFailed();
+    }
+}
+
+void OfonoCallForwarding::requestPropertyComplete(bool success, const QString& property, const QVariant& value)
+{
+    if (property == "VoiceUnconditional") {    
+        success ? emit voiceUnconditionalComplete(true, value.value<QString>()) : emit voiceUnconditionalComplete(false, QString());
+    } else if (property == "VoiceBusy") {      
+        success ? emit voiceBusyComplete(true, value.value<QString>()) : emit voiceBusyComplete(false, QString());
+    } else if (property == "VoiceNoReply") {   
+        success ? emit voiceNoReplyComplete(true, value.value<QString>()) : emit voiceNoReplyComplete(false, QString());
+    } else if (property == "VoiceNoReplyTimeout") {
+        success ? emit voiceNoReplyTimeoutComplete(true, value.value<ushort>()) : emit voiceNoReplyTimeoutComplete(false, 0);
+    } else if (property == "VoiceNotReachable") {
+        success ? emit voiceNotReachableComplete(true, value.value<QString>()) : emit voiceNotReachableComplete(false, QString());
+    }
+}
+
+void OfonoCallForwarding::disableAllResp()
+{
+    emit disableAllComplete(TRUE);
+}
+
+void OfonoCallForwarding::disableAllErr(QDBusError error)
+{
+    qDebug() << "DisableAll failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit disableAllComplete(FALSE);
+}
+
diff --git a/lib/ofonocallforwarding.h b/lib/ofonocallforwarding.h
new file mode 100644 (file)
index 0000000..8a90392
--- /dev/null
@@ -0,0 +1,91 @@
+/**
+ * This file is part of CellularQt
+ *
+ * Copyright (C) 2010 Nokia Corporation. All rights reserved.
+ */
+
+#ifndef OFONOCALLFORWARDING_H
+#define OFONOCALLFORWARDING_H
+
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoCallForwarding : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoCallForwarding(QString modemId, QObject *parent=0);
+    ~OfonoCallForwarding();
+
+    /* Properties */
+    void requestVoiceUnconditional(); /* "" | phonenumber */
+    void setVoiceUnconditional(QString property); 
+    void requestVoiceBusy();
+    void setVoiceBusy(QString property);
+    void requestVoiceNoReply();
+    void setVoiceNoReply(QString property);
+    void requestVoiceNoReplyTimeout();
+    void setVoiceNoReplyTimeout(ushort timeout);
+    void requestVoiceNotReachable();
+    void setVoiceNotReachable(QString property);
+    
+    /* Methods */
+    void requestDisableAll(QString type); /* "all" | "conditional" */
+    
+signals:
+    void voiceUnconditionalComplete(bool success, QString property);
+    void voiceBusyComplete(bool success, QString property);
+    void voiceNoReplyComplete(bool success, QString property);
+    void voiceNoReplyTimeoutComplete(bool success, ushort timeout);
+    void voiceNotReachableComplete(bool success, QString property);
+
+    void voiceUnconditionalChanged(QString property);
+    void voiceBusyChanged(QString property);
+    void voiceNoReplyChanged(QString property);
+    void voiceNoReplyTimeoutChanged(ushort timeout);
+    void voiceNotReachableChanged(QString property);
+
+    void setVoiceUnconditionalFailed();
+    void setVoiceBusyFailed();
+    void setVoiceNoReplyFailed();
+    void setVoiceNoReplyTimeoutFailed();
+    void setVoiceNotReachableFailed();
+
+    void disableAllComplete(bool success); 
+
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void setPropertyFailed(const QString& property);
+    void requestPropertyComplete(bool success, const QString& property, const QVariant& value);
+      
+    void disableAllResp();
+    void disableAllErr(QDBusError error);
+};
+
+#endif  /* !OFONOCALLFORWARDING_H */
diff --git a/lib/ofonocallmeter.cpp b/lib/ofonocallmeter.cpp
new file mode 100644 (file)
index 0000000..cbaa2da
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonocallmeter.h"
+
+OfonoCallMeter::OfonoCallMeter(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.CallMeter", OfonoInterface::GetAllOnFirstRequest, parent)
+{
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+    connect(this, SIGNAL(requestPropertyComplete(bool, const QString&, const QVariant&)),
+           this, SLOT(requestPropertyComplete(bool, const QString&, const QVariant&)));
+}
+
+OfonoCallMeter::~OfonoCallMeter()
+{
+}
+
+void OfonoCallMeter::requestCallMeter()
+{
+    requestProperty("CallMeter");
+}
+
+void OfonoCallMeter::requestPropertyComplete(bool success, const QString& property, const QVariant& value)
+{
+    if (property == "CallMeter") {     
+        success ? emit callMeterComplete(true, value.value<uint>()) : emit callMeterComplete(false, 0);
+    }
+}
+
+
+void OfonoCallMeter::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "CallMeter") {     
+        emit callMeterChanged(value.value<uint>());
+    }
+}
diff --git a/lib/ofonocallmeter.h b/lib/ofonocallmeter.h
new file mode 100644 (file)
index 0000000..bd319f4
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONOCALLMETER_H
+#define OFONOCALLMETER_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoCallMeter : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoCallMeter(QString modemId, QObject *parent=0);
+    ~OfonoCallMeter();
+
+    /* Properties */
+    void requestCallMeter();
+    
+signals:
+    void callMeterComplete(bool success, uint value);
+
+    void callMeterChanged(uint value);
+
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void requestPropertyComplete(bool success, const QString& property, const QVariant& value);
+};
+
+#endif  /* !OFONOCALLMETER_H */
diff --git a/lib/ofonocallsettings.cpp b/lib/ofonocallsettings.cpp
new file mode 100644 (file)
index 0000000..cd3dcfb
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonocallsettings.h"
+
+OfonoCallSettings::OfonoCallSettings(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.CallSettings", OfonoInterface::GetAllOnFirstRequest, parent)
+{
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+    connect(this, SIGNAL(setPropertyFailed(const QString&)), 
+            this, SLOT(setPropertyFailed(const QString&)));
+    connect(this, SIGNAL(requestPropertyComplete(bool, const QString&, const QVariant&)),
+           this, SLOT(requestPropertyComplete(bool, const QString&, const QVariant&)));
+}
+
+OfonoCallSettings::~OfonoCallSettings()
+{
+}
+
+void OfonoCallSettings::requestCallingLinePresentation()
+{
+    requestProperty("CallingLinePresentation");
+}
+
+void OfonoCallSettings::requestCalledLinePresentation()
+{
+    requestProperty("CalledLinePresentation");
+}
+
+void OfonoCallSettings::requestCalledLineRestriction()
+{
+    requestProperty("CalledLineRestriction");
+}
+
+void OfonoCallSettings::requestCallingLineRestriction()
+{
+    requestProperty("CallingLineRestriction");
+}
+
+void OfonoCallSettings::requestHideCallerId()
+{
+    requestProperty("HideCallerId");
+}
+
+void OfonoCallSettings::requestVoiceCallWaiting()
+{
+    requestProperty("VoiceCallWaiting");
+}
+
+void OfonoCallSettings::setHideCallerId(QString preference)
+{
+    return setProperty("HideCallerId", qVariantFromValue(preference));
+}
+
+void OfonoCallSettings::setVoiceCallWaiting(QString preference)
+{
+    return setProperty("VoiceCallWaiting", qVariantFromValue(preference));
+}
+
+void OfonoCallSettings::requestPropertyComplete(bool success, const QString& property, const QVariant& value)
+{
+    if (property == "CallingLinePresentation") {       
+        success ? emit callingLinePresentationComplete(true, value.value<QString>()) : emit callingLinePresentationComplete(false, value.value<QString>());
+    } else if (property == "CalledLinePresentation") { 
+        success ? emit calledLinePresentationComplete(true, value.value<QString>()) : emit calledLinePresentationComplete(false, value.value<QString>());
+    } else if (property == "CalledLineRestriction") {  
+        success ? emit calledLineRestrictionComplete(true, value.value<QString>()) : emit calledLineRestrictionComplete(false, value.value<QString>());
+    } else if (property == "CallingLineRestriction") { 
+        success ? emit callingLineRestrictionComplete(true, value.value<QString>()) : emit callingLineRestrictionComplete(false, value.value<QString>());
+    } else if (property == "HideCallerId") {   
+        success ? emit hideCallerIdComplete(true, value.value<QString>()) : emit hideCallerIdComplete(false, value.value<QString>());
+    } else if (property == "VoiceCallWaiting") {       
+        success ? emit voiceCallWaitingComplete(true, value.value<QString>()) : emit voiceCallWaitingComplete(false, value.value<QString>());
+    }
+}
+
+void OfonoCallSettings::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "CallingLinePresentation") {       
+        emit callingLinePresentationChanged(value.value<QString>());
+    } else if (property == "CalledLinePresentation") { 
+        emit calledLinePresentationChanged(value.value<QString>());
+    } else if (property == "CalledLineRestriction") {  
+        emit calledLineRestrictionChanged(value.value<QString>());
+    } else if (property == "CallingLineRestriction") { 
+        emit callingLineRestrictionChanged(value.value<QString>());
+    } else if (property == "HideCallerId") {   
+        emit hideCallerIdChanged(value.value<QString>());
+    } else if (property == "VoiceCallWaiting") {       
+        emit voiceCallWaitingChanged(value.value<QString>());
+    }
+}
+
+void OfonoCallSettings::setPropertyFailed(const QString& property)
+{
+    if (property == "HideCallerId") {  
+        emit setHideCallerIdFailed();
+    } else if (property == "VoiceCallWaiting") {       
+        emit setVoiceCallWaitingFailed();
+    }
+}
diff --git a/lib/ofonocallsettings.h b/lib/ofonocallsettings.h
new file mode 100644 (file)
index 0000000..651c80e
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONOCALLSETTINGS_H
+#define OFONOCALLSETTINGS_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoCallSettings : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoCallSettings(QString modemId, QObject *parent=0);
+    ~OfonoCallSettings();
+
+    /* Properties */
+    void requestCallingLinePresentation();
+    void requestCalledLinePresentation();
+    void requestCalledLineRestriction();
+    void requestCallingLineRestriction();
+    void requestHideCallerId();
+    void setHideCallerId(QString setting);
+    void requestVoiceCallWaiting();
+    void setVoiceCallWaiting(QString setting);
+    
+signals:
+    void callingLinePresentationComplete(bool success, QString setting);
+    void calledLinePresentationComplete(bool success, QString setting);
+    void calledLineRestrictionComplete(bool success, QString setting);
+    void callingLineRestrictionComplete(bool success, QString setting);
+    void hideCallerIdComplete(bool success, QString setting);
+    void voiceCallWaitingComplete(bool success, QString setting);
+
+    void callingLinePresentationChanged(QString setting);
+    void calledLinePresentationChanged(QString setting);
+    void calledLineRestrictionChanged(QString setting);
+    void callingLineRestrictionChanged(QString setting);
+    void hideCallerIdChanged(QString setting);
+    void voiceCallWaitingChanged(QString setting);
+
+    void setHideCallerIdFailed();
+    void setVoiceCallWaitingFailed();
+
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void setPropertyFailed(const QString& property);
+    void requestPropertyComplete(bool success, const QString& property, const QVariant& value);      
+};
+
+#endif  /* !OFONOCALLSETTINGS_H */
diff --git a/lib/ofonointerface.cpp b/lib/ofonointerface.cpp
new file mode 100644 (file)
index 0000000..5ffcd9e
--- /dev/null
@@ -0,0 +1,200 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+#include <QtCore/QDebug>
+
+#include "ofonointerface.h"
+
+#define GET_PROPERTIES_TIMEOUT 300000
+#define SET_PROPERTY_TIMEOUT 300000
+
+OfonoInterface::OfonoInterface(const QString& path, const QString& ifname, GetPropertySetting setting, QObject *parent)
+    : QObject(parent) , m_path(path), m_ifname(ifname), m_getpropsetting(setting)
+{
+    QDBusConnection::systemBus().connect("org.ofono", path, ifname, 
+                                            "PropertyChanged",
+                                            this,
+                                            SLOT(onPropertyChanged(QString, QDBusVariant)));
+    if (setting == GetAllOnStartup && path != "/")
+        m_properties = getAllPropertiesSync();
+}
+
+OfonoInterface::~OfonoInterface()
+{
+}
+
+void OfonoInterface::setPath(const QString& path)
+{
+    QDBusConnection::systemBus().disconnect("org.ofono", m_path, m_ifname, 
+                                            "PropertyChanged",
+                                            this,
+                                            SLOT(onPropertyChanged(QString, QDBusVariant)));
+    m_path = path;
+    QDBusConnection::systemBus().connect("org.ofono", m_path, m_ifname, 
+                                            "PropertyChanged",
+                                            this,
+                                            SLOT(onPropertyChanged(QString, QDBusVariant)));
+
+    if (m_getpropsetting == GetAllOnStartup)
+        m_properties = getAllPropertiesSync();
+    else
+       resetProperties();
+}
+
+QVariantMap OfonoInterface::properties() const
+{
+    return m_properties;
+}
+
+void OfonoInterface::resetProperties()
+{
+    m_properties = QVariantMap();
+}
+
+QVariantMap OfonoInterface::getAllPropertiesSync()
+{
+    QDBusReply<QVariantMap> reply;
+    QVariantMap map;
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                             m_path, m_ifname,
+                                             "GetProperties");
+    reply = QDBusConnection::systemBus().call(request);
+    map = reply;
+    foreach (QString property, map.keys()) {
+        emit propertyChanged(property, map[property]);
+    }
+    return map;
+}
+
+void OfonoInterface::requestProperty(const QString& name)
+{
+    if (m_pendingProperty.length() > 0) {
+        // FIXME: should indicate that a setProperty is already in progress
+        m_errorName = QString();
+        m_errorMessage = QString();
+        emit requestPropertyComplete(false, name, QVariant());
+        return;
+    }
+    
+    if (m_properties.keys().contains(name)) {
+        emit requestPropertyComplete(true, name, m_properties[name]);
+        return;
+    }
+    
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            m_path, m_ifname,
+                                            "GetProperties");
+
+    bool result = QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(getPropertiesAsyncResp(QVariantMap)),
+                                       SLOT(getPropertiesAsyncErr(const QDBusError&)),
+                                       GET_PROPERTIES_TIMEOUT);
+    if (!result) {
+        // FIXME: should indicate that sending a message failed
+        m_errorName = QString();
+        m_errorMessage = QString();
+        emit requestPropertyComplete(false, name, QVariant());
+       return;
+    }
+    m_pendingProperty = name;
+}
+
+void OfonoInterface::getPropertiesAsyncResp(QVariantMap properties)
+{
+    QString prop = m_pendingProperty;
+    m_properties = properties;
+    m_pendingProperty = QString();
+    emit requestPropertyComplete(true, prop, properties[prop]);
+    foreach (QString property, properties.keys()) {
+        emit propertyChanged(property, properties[property]);
+    }
+}
+
+void OfonoInterface::getPropertiesAsyncErr(const QDBusError& error)
+{
+    QString prop = m_pendingProperty;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    m_pendingProperty = QString();
+    emit requestPropertyComplete(false, prop, QVariant());
+}
+
+void OfonoInterface::onPropertyChanged(QString property, QDBusVariant value)
+{
+    m_properties[property] = value.variant();
+    emit propertyChanged(property, value.variant());
+}
+
+void OfonoInterface::setProperty(const QString& name, const QVariant& property)
+{
+    if (m_pendingProperty.length() > 0) {
+        // FIXME: should indicate that a setProperty is already in progress
+        m_errorName = QString();
+        m_errorMessage = QString();
+        emit setPropertyFailed(name);
+        return;
+    }
+
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            m_path, m_ifname,
+                                            "SetProperty");
+    request.setArguments(QList<QVariant>() 
+                        << QVariant(name) 
+                        << QVariant::fromValue(QDBusVariant(property)));
+    bool result = QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(setPropertyResp()),
+                                       SLOT(setPropertyErr(const QDBusError&)),
+                                       SET_PROPERTY_TIMEOUT);
+    if (!result) {
+        // FIXME: should indicate that sending a message failed
+        m_errorName = QString();
+        m_errorMessage = QString();
+       emit setPropertyFailed(name);
+       return;
+    }
+    m_pendingProperty = name;
+}
+
+void OfonoInterface::setPropertyResp()
+{
+    m_pendingProperty = QString();
+    // emit nothing; we will get a PropertyChanged signal
+}
+
+void OfonoInterface::setPropertyErr(const QDBusError& error)
+{
+    QString prop = m_pendingProperty;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    m_pendingProperty = QString();
+    emit setPropertyFailed(prop);
+}
+
diff --git a/lib/ofonointerface.h b/lib/ofonointerface.h
new file mode 100644 (file)
index 0000000..4234cdc
--- /dev/null
@@ -0,0 +1,90 @@
+/**
+ * This file is part of CellularQt
+ *
+ * Copyright (C) 2010 Nokia Corporation. All rights reserved.
+ */
+
+#ifndef OFONOINTERFACE_H
+#define OFONOINTERFACE_H
+
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtCore/QObject>
+#include <QVariant>
+#include <QDBusVariant>
+#include <QDBusError>
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoInterface : public QObject
+{
+    Q_OBJECT
+public:
+    enum GetPropertySetting {
+       GetAllOnStartup,
+       GetAllOnFirstRequest
+    };
+
+    OfonoInterface(const QString& path, const QString& ifname, GetPropertySetting setting, QObject *parent=0);
+    ~OfonoInterface();
+
+    QVariantMap properties() const;
+    void requestProperty(const QString& name);
+    void setProperty(const QString& name, const QVariant& property);
+    void resetProperties();
+    
+    QString path() const {return m_path;}
+    
+    QString ifname() const {return m_ifname;}
+    QString errorName() const {return m_errorName;}
+    QString errorMessage() const {return m_errorMessage;}
+
+signals:
+    void propertyChanged(const QString& name, const QVariant& property);
+    void requestPropertyComplete(bool success, const QString& name, const QVariant& property);
+    void setPropertyFailed(const QString& name);
+
+private slots:
+    void onPropertyChanged(QString property, QDBusVariant value);
+    void getPropertiesAsyncResp(QVariantMap properties);
+    void getPropertiesAsyncErr(const QDBusError&);
+    void setPropertyResp();
+    void setPropertyErr(const QDBusError& error);
+protected slots:
+    void setPath(const QString& path);
+private:
+    QVariantMap getAllPropertiesSync();
+    
+protected:
+   QString m_errorName;
+   QString m_errorMessage;
+    
+private:
+   QString m_path;
+   QString m_ifname;
+   QVariantMap m_properties;
+   QString m_pendingProperty;
+   GetPropertySetting m_getpropsetting;
+};
+
+#endif
diff --git a/lib/ofonomessagemanager.cpp b/lib/ofonomessagemanager.cpp
new file mode 100644 (file)
index 0000000..b4f0418
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonomessagemanager.h"
+
+OfonoMessageManager::OfonoMessageManager(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.MessageManager", OfonoInterface::GetAllOnFirstRequest, parent)
+{
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+    connect(this, SIGNAL(setPropertyFailed(const QString&)), 
+            this, SLOT(setPropertyFailed(const QString&)));
+    connect(this, SIGNAL(requestPropertyComplete(bool, const QString&, const QVariant&)),
+           this, SLOT(requestPropertyComplete(bool, const QString&, const QVariant&)));
+}
+
+OfonoMessageManager::~OfonoMessageManager()
+{
+}
+
+void OfonoMessageManager::requestServiceCenterAddress()
+{
+    requestProperty("ServiceCenterAddress");
+}
+
+void OfonoMessageManager::requestPropertyComplete(bool success, const QString& property, const QVariant& value)
+{
+    if (property == "ServiceCenterAddress") {  
+        success ? emit serviceCenterAddressComplete(true, value.value<QString>()) : emit serviceCenterAddressComplete(false, QString());
+    }
+}
+
+void OfonoMessageManager::setServiceCenterAddress(QString address)
+{
+    setProperty("ServiceCenterAddress", qVariantFromValue(address));
+}
+
+
+void OfonoMessageManager::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "ServiceCenterAddress") {  
+        emit serviceCenterAddressChanged(value.value<QString>());
+    }
+}
+
+void OfonoMessageManager::setPropertyFailed(const QString& property)
+{
+    if (property == "ServiceCenterAddress")
+        emit setServiceCenterAddressFailed();
+}
+
diff --git a/lib/ofonomessagemanager.h b/lib/ofonomessagemanager.h
new file mode 100644 (file)
index 0000000..c350e29
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+#ifndef OFONOMESSAGEMANAGER_H
+#define OFONOMESSAGEMANAGER_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoMessageManager : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoMessageManager(QString modemId, QObject *parent=0);
+    ~OfonoMessageManager();
+
+    /* Properties */
+    void requestServiceCenterAddress();
+    void setServiceCenterAddress(QString address);
+
+signals:
+    void serviceCenterAddressChanged(QString address);
+    void setServiceCenterAddressFailed();
+    
+    void serviceCenterAddressComplete(bool success, QString address);
+
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void setPropertyFailed(const QString& property);
+    void requestPropertyComplete(bool success, const QString& property, const QVariant& value);
+};
+
+#endif  /* !OFONOMESSAGEMANAGER_H */
diff --git a/lib/ofonomessagewaiting.cpp b/lib/ofonomessagewaiting.cpp
new file mode 100644 (file)
index 0000000..5a84984
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonomessagewaiting.h"
+
+
+OfonoMessageWaiting::OfonoMessageWaiting(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.MessageWaiting", OfonoInterface::GetAllOnStartup, parent)
+{
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+    connect(this, SIGNAL(setPropertyFailed(const QString&)), 
+            this, SLOT(setPropertyFailed(const QString&)));
+
+}
+
+OfonoMessageWaiting::~OfonoMessageWaiting()
+{
+}
+
+bool OfonoMessageWaiting::voicemailWaiting()
+{
+    return properties()["VoicemailWaiting"].value<bool>();
+}
+
+int OfonoMessageWaiting::voicemailMessageCount()
+{
+    return properties()["VoicemailMessageCount"].value<int>();
+}
+
+QString OfonoMessageWaiting::voicemailMailboxNumber()
+{
+    return properties()["VoicemailMailboxNumber"].value<QString>();
+}
+
+void OfonoMessageWaiting::setVoicemailMailboxNumber(QString mailboxnumber)
+{
+    setProperty("VoicemailMailboxNumber", qVariantFromValue(mailboxnumber));
+}
+
+void OfonoMessageWaiting::setPropertyFailed(const QString& property)
+{
+    if (property == "VoicemailMailboxNumber")
+        emit setVoicemailMailboxNumberFailed();
+}
+
+void OfonoMessageWaiting::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "VoicemailWaiting")
+        emit voicemailWaitingChanged(value.value<bool>());
+    else if (property == "VoicemailMessageCount")
+        emit voicemailMessageCountChanged(value.value<int>());
+    else if (property == "VoicemailMailboxNumber")
+        emit voicemailMailboxNumberChanged(value.value<QString>());
+}
+
+
diff --git a/lib/ofonomessagewaiting.h b/lib/ofonomessagewaiting.h
new file mode 100644 (file)
index 0000000..b340f4c
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+#ifndef OFONOMESSAGEWAITING_H
+#define OFONOMESSAGEWAITING_H
+
+#include <QtCore/QObject>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoMessageWaiting : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoMessageWaiting(QString modemId, QObject *parent=0);
+    ~OfonoMessageWaiting();
+
+    bool voicemailWaiting();
+    int voicemailMessageCount();
+    QString voicemailMailboxNumber();
+    void setVoicemailMailboxNumber(QString mailboxnumber);
+
+signals:
+    void voicemailWaitingChanged(bool waiting);
+    void voicemailMessageCountChanged(int count);
+    void voicemailMailboxNumberChanged(QString mailboxnumber);
+
+    void setVoicemailMailboxNumberFailed();
+    
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void setPropertyFailed(const QString& property);    
+};
+
+#endif  /* !OFONOMESSAGEWAITING_H */
diff --git a/lib/ofonomodem.cpp b/lib/ofonomodem.cpp
new file mode 100644 (file)
index 0000000..76c0956
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonomodem.h"
+#include "ofonointerface.h"
+#include "ofonomodemmanager.h"
+
+OfonoModem::OfonoModem(QString modemId, QObject *parent)
+    : OfonoInterface("/", "org.ofono.Modem", OfonoInterface::GetAllOnStartup, parent)
+{
+    m_mm = new OfonoModemManager(this);
+    connect(m_mm, SIGNAL(modemAdded(QString)), this, SLOT(modemAdded(QString)));
+    connect(m_mm, SIGNAL(modemRemoved(QString)), this, SLOT(modemRemoved(QString)));
+
+    if (modemId.isEmpty())
+        m_autoChoose = true;
+    else
+        m_autoChoose = false;
+
+    if (m_autoChoose == true)    
+        modemId = m_mm->modems().value(0);
+    
+    if (modemId.isEmpty()) {
+        modemId = "/";
+    } 
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+    connect(this, SIGNAL(setPropertyFailed(const QString&)), 
+            this, SLOT(setPropertyFailed(const QString&)));
+    setPath(modemId);
+    m_isValid = m_mm->modems().contains(modemId);
+}
+
+OfonoModem::~OfonoModem()
+{
+}
+
+void OfonoModem::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "Online")
+        emit onlineChanged(value.value<bool>());
+    else if (property == "Powered")
+        emit poweredChanged(value.value<bool>());
+    else if (property == "Emergency")
+        emit emergencyChanged(value.value<bool>());
+    else if (property == "Name")
+        emit nameChanged(value.value<QString>());
+    else if (property == "Manufacturer")
+        emit manufacturerChanged(value.value<QString>());
+    else if (property == "Model")
+        emit modelChanged(value.value<QString>());
+    else if (property == "Revision")
+        emit revisionChanged(value.value<QString>());
+    else if (property == "Serial")
+        emit serialChanged(value.value<QString>());
+    else if (property == "Features")
+        emit featuresChanged(value.value<QStringList>());
+    else if (property == "Interfaces")
+        emit interfacesChanged(value.value<QStringList>());
+}
+
+void OfonoModem::setPropertyFailed(const QString& property)
+{
+    if (property == "Online")
+        emit setOnlineFailed();
+    else if (property == "Powered")
+        emit setPoweredFailed();
+}
+
+void OfonoModem::modemAdded(QString /*modem*/)
+{
+    modemsChanged();
+}
+
+void OfonoModem::modemRemoved(QString /*modem*/)
+{
+    modemsChanged();
+}
+
+void OfonoModem::modemsChanged()
+{
+    // validity has changed
+    if (isValid() != m_mm->modems().contains(modemId())) {
+        m_isValid = m_mm->modems().contains(modemId());
+        emit validityChanged(isValid());
+    }
+    if (!m_mm->modems().contains(modemId())) {
+        if (m_autoChoose == true) {
+            QString modemId = m_mm->modems().value(0);
+            if (modemId.isEmpty()) {
+                modemId = "/";
+            }
+            setPath(modemId);
+            emit modemIdChanged(modemId);
+        }
+    }
+    // validity has changed
+    if (isValid() != m_mm->modems().contains(modemId())) {
+        m_isValid = m_mm->modems().contains(modemId());
+        emit validityChanged(isValid());
+    }
+}
+
+
+bool OfonoModem::isValid() const
+{
+    return m_isValid;
+}
+
+QString OfonoModem::modemId() const
+{
+    return path();
+}
+
+bool OfonoModem::powered() const
+{
+    return properties()["Powered"].value<bool>();
+}
+
+void OfonoModem::setPowered(bool powered)
+{
+    setProperty("Powered", qVariantFromValue(powered));
+}
+
+bool OfonoModem::online() const
+{
+    return properties()["Online"].value<bool>();
+}
+
+void OfonoModem::setOnline(bool online)
+{
+    setProperty("Online", qVariantFromValue(online));
+}
+
+bool OfonoModem::emergency() const
+{
+    return properties()["Emergency"].value<bool>();
+}
+
+QString OfonoModem::name() const
+{
+    return properties()["Name"].value<QString>();
+}
+
+QString OfonoModem::manufacturer() const
+{
+    return properties()["Manufacturer"].value<QString>();
+}
+
+QString OfonoModem::model() const
+{
+    return properties()["Model"].value<QString>();
+}
+
+QString OfonoModem::revision() const
+{
+    return properties()["Revision"].value<QString>();
+}
+
+QString OfonoModem::serial() const
+{
+    return properties()["Serial"].value<QString>();
+}
+
+QStringList OfonoModem::features() const
+{
+    return properties()["Features"].value<QStringList>();
+}
+
+QStringList OfonoModem::interfaces() const
+{
+    return properties()["Interfaces"].value<QStringList>();
+}
+
+
diff --git a/lib/ofonomodem.h b/lib/ofonomodem.h
new file mode 100644 (file)
index 0000000..8e63d6b
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONOMODEM_H
+#define OFONOMODEM_H
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+#include "ofonointerface.h"
+#include "libofono-qt_global.h"
+
+class OfonoModemManager;
+
+class OFONO_QT_EXPORT OfonoModem : public OfonoInterface 
+{
+
+Q_OBJECT
+
+public:
+
+    OfonoModem(QString modemId, QObject *parent);
+
+    ~OfonoModem();
+
+    bool isValid() const;
+    QString modemId() const;
+    
+    bool powered() const;
+    void setPowered(bool powered);
+    bool online() const;
+    void setOnline(bool online);
+    bool emergency() const;
+    
+    QString name() const;
+    QString manufacturer() const;
+    QString model() const;
+    QString revision() const;
+    QString serial() const;
+    
+    QStringList features() const;
+    QStringList interfaces() const;
+
+signals:
+    void validityChanged(bool validity);
+    void modemIdChanged(QString modemId);
+    
+    void poweredChanged(bool powered);
+    void setPoweredFailed();
+    void onlineChanged(bool online);
+    void setOnlineFailed();
+    void emergencyChanged(bool emergency);
+
+    void nameChanged(QString name);
+    void manufacturerChanged(QString manufacturer);
+    void modelChanged(QString model);
+    void revisionChanged(QString revision);
+    void serialChanged(QString serial);
+
+    void featuresChanged(QStringList features);
+    void interfacesChanged(QStringList interfaces);
+
+
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void setPropertyFailed(const QString& property);
+    void modemAdded(QString modem);
+    void modemRemoved(QString modem);
+
+private:
+    void modemsChanged();
+
+private:
+    OfonoModemManager *m_mm;
+    bool m_autoChoose;
+    bool m_isValid;
+};
+#endif
diff --git a/lib/ofonomodeminterface.cpp b/lib/ofonomodeminterface.cpp
new file mode 100644 (file)
index 0000000..5acafcd
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+#include <QtCore/QDebug>
+
+#include "ofonomodeminterface.h"
+#include "ofonomodem.h"
+
+OfonoModemInterface::OfonoModemInterface(const QString& modemId, const QString& ifname, GetPropertySetting setting, QObject *parent)
+    : OfonoInterface("/", ifname, setting, parent)
+{
+
+    m_m = new OfonoModem(modemId, this);
+    connect(m_m, SIGNAL(validityChanged(bool)), this, SLOT(modemValidityChanged(bool)));
+    connect(m_m, SIGNAL(interfacesChanged(QStringList)), this, SLOT(interfacesChanged(QStringList)));
+    connect(m_m, SIGNAL(modemIdChanged(QString)), this, SLOT(setPath(QString)));
+
+    setPath(m_m->modemId());
+    m_isValid = checkValidity();
+}
+
+OfonoModemInterface::~OfonoModemInterface()
+{
+}
+
+bool OfonoModemInterface::isValid() const
+{
+    return m_isValid;
+}
+
+OfonoModem* OfonoModemInterface::modem() const
+{
+    return m_m;
+}
+
+bool OfonoModemInterface::checkValidity()
+{
+    return (m_m->isValid() && m_m->interfaces().contains(ifname()));
+}
+
+void OfonoModemInterface::updateValidity()
+{
+    if (isValid() != checkValidity()) {
+        m_isValid = checkValidity();
+        emit validityChanged(isValid());
+    }
+}
+
+void OfonoModemInterface::modemValidityChanged(bool /*validity*/)
+{
+    updateValidity();
+}
+
+void OfonoModemInterface::interfacesChanged(QStringList /*interfaces*/)
+{
+    updateValidity();
+}
+
diff --git a/lib/ofonomodeminterface.h b/lib/ofonomodeminterface.h
new file mode 100644 (file)
index 0000000..d2ee023
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONOMODEMINTERFACE_H
+#define OFONOMODEMINTERFACE_H
+
+#include <QtCore/QObject>
+#include <QVariant>
+#include <QDBusVariant>
+#include <QStringList>
+#include "ofonointerface.h"
+#include "libofono-qt_global.h"
+
+class OfonoModem;
+
+class OFONO_QT_EXPORT OfonoModemInterface : public OfonoInterface
+{
+    Q_OBJECT
+public:
+    OfonoModemInterface(const QString& modemId, const QString& ifname, GetPropertySetting setting, QObject *parent=0);
+    ~OfonoModemInterface();
+
+    bool isValid() const;
+    OfonoModem *modem() const;
+
+signals:
+    void validityChanged(bool validity);
+
+private:
+    bool checkValidity();
+    void updateValidity();
+
+private slots:
+    void modemValidityChanged(bool validity);
+    void interfacesChanged(QStringList interfaces);
+
+private:
+    OfonoModem *m_m;
+    bool m_isValid;
+};
+#endif
diff --git a/lib/ofonomodemmanager.cpp b/lib/ofonomodemmanager.cpp
new file mode 100644 (file)
index 0000000..4555017
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonomodemmanager.h"
+#include "ofonointerface.h"
+
+QDBusArgument &operator<<(QDBusArgument &argument, const OfonoModemStruct &modem)
+{
+    argument.beginStructure();
+    argument << modem.path << modem.properties;
+    argument.endStructure();
+    return argument;
+}   
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, OfonoModemStruct &modem)
+{   
+    argument.beginStructure();
+    argument >> modem.path >> modem.properties; 
+    argument.endStructure();
+    return argument;
+}
+
+OfonoModemManager::OfonoModemManager(QObject *parent)
+    : QObject(parent)
+{
+    QDBusReply<OfonoModemList> reply;
+    OfonoModemList modems;
+
+    QDBusMessage request;
+
+    qDBusRegisterMetaType<OfonoModemStruct>();
+    qDBusRegisterMetaType<OfonoModemList>();
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            "/", "org.ofono.Manager",
+                                            "GetModems");
+    reply = QDBusConnection::systemBus().call(request);
+
+    modems = reply;
+    foreach(OfonoModemStruct modem, modems) {
+       m_modems << modem.path.path();
+    }
+
+    QDBusConnection::systemBus().connect("org.ofono","/","org.ofono.Manager",
+                                        "ModemAdded", this, 
+                                        SLOT(onModemAdded(const QDBusObjectPath&, const QVariantMap&)));
+    QDBusConnection::systemBus().connect("org.ofono","/","org.ofono.Manager",
+                                        "ModemRemoved", this, 
+                                        SLOT(onModemRemoved(const QDBusObjectPath&)));
+
+}
+
+OfonoModemManager::~OfonoModemManager()
+{
+}
+
+QStringList OfonoModemManager::modems()
+{
+    return m_modems;
+}
+
+void OfonoModemManager::onModemAdded(const QDBusObjectPath& path, const QVariantMap& /*map*/)
+{
+    m_modems << path.path();
+    emit modemAdded(path.path());
+}
+
+void OfonoModemManager::onModemRemoved(const QDBusObjectPath& path)
+{
+    m_modems.removeAll(path.path()); 
+    emit modemRemoved(path.path());
+}
+
+
diff --git a/lib/ofonomodemmanager.h b/lib/ofonomodemmanager.h
new file mode 100644 (file)
index 0000000..ac4fe05
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+#ifndef OFONOMODEMMANAGER_H
+#define OFONOMODEMMANAGER_H
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+#include "libofono-qt_global.h"
+
+struct OfonoModemStruct {
+    QDBusObjectPath path;
+    QVariantMap properties;
+};
+typedef QList<OfonoModemStruct> OfonoModemList;
+Q_DECLARE_METATYPE(OfonoModemStruct)
+Q_DECLARE_METATYPE(OfonoModemList)
+// Marshall the ModemStruct data into a D-Bus argument
+QDBusArgument &operator<<(QDBusArgument &argument, const OfonoModemStruct &modem);
+    
+// Retrieve the ModemStruct data from the D-Bus argument
+const QDBusArgument &operator>>(const QDBusArgument &argument, OfonoModemStruct &modem);
+
+
+class OfonoInterface;
+
+class OFONO_QT_EXPORT OfonoModemManager : public QObject {
+
+Q_OBJECT
+
+public:
+
+    OfonoModemManager(QObject *parent);
+
+    ~OfonoModemManager();
+
+    QStringList modems();
+
+private slots:
+    void onModemAdded(const QDBusObjectPath& path, const QVariantMap& map);
+    void onModemRemoved(const QDBusObjectPath& path);
+    
+signals:
+    void modemAdded(QString modem);
+    void modemRemoved(QString modem);
+
+private:
+    QStringList m_modems;
+};
+
+#endif
diff --git a/lib/ofononetworkoperator.cpp b/lib/ofononetworkoperator.cpp
new file mode 100644 (file)
index 0000000..6837497
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+#include <QtCore/QDebug>
+
+#include "ofononetworkoperator.h"
+
+#define REGISTER_TIMEOUT 300000
+
+OfonoNetworkOperator::OfonoNetworkOperator(const QString& operatorId, QObject *parent)
+    : OfonoInterface(operatorId, "org.ofono.NetworkOperator", OfonoInterface::GetAllOnStartup, parent)
+{
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+}
+
+OfonoNetworkOperator::~OfonoNetworkOperator()
+{
+}
+
+void OfonoNetworkOperator::requestRegister()
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "Register");
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(registerResp()),
+                                       SLOT(registerErr(const QDBusError&)),
+                                       REGISTER_TIMEOUT);
+}
+
+void OfonoNetworkOperator::registerResp()
+{
+    emit registerComplete(TRUE);
+}
+
+void OfonoNetworkOperator::registerErr(const QDBusError& error)
+{
+    qDebug() << "Register failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit registerComplete(FALSE);
+}
+
+QString OfonoNetworkOperator::name()
+{
+    return properties()["Name"].value<QString>();
+}
+
+QString OfonoNetworkOperator::status()
+{
+    return properties()["Status"].value<QString>();
+}
+
+QString OfonoNetworkOperator::mcc()
+{
+    return properties()["MobileCountryCode"].value<QString>();
+}
+
+QString OfonoNetworkOperator::mnc()
+{
+    return properties()["MobileNetworkCode"].value<QString>();
+}
+
+QStringList OfonoNetworkOperator::technologies()
+{
+    return properties()["Technologies"].value<QStringList>();
+}
+
+QString OfonoNetworkOperator::additionalInfo()
+{
+    return properties()["AdditionalInformation"].value<QString>();
+}
+
+void OfonoNetworkOperator::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "Name") {  
+        emit nameChanged(value.value<QString>());
+    } else if (property == "Status") { 
+        emit statusChanged(value.value<QString>());
+    } else if (property == "MobileCountryCode") {      
+        emit mccChanged(value.value<QString>());
+    } else if (property == "MobileNetworkCode") {      
+        emit mncChanged(value.value<QString>());
+    } else if (property == "Technologies") {   
+        emit technologiesChanged(value.value<QStringList>());
+    } else if (property == "AdditionalInformation") {  
+        emit additionalInfoChanged(value.value<QString>());
+    }
+}
diff --git a/lib/ofononetworkoperator.h b/lib/ofononetworkoperator.h
new file mode 100644 (file)
index 0000000..c690058
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONONETWORKOPERATOR_H
+#define OFONONETWORKOPERATOR_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include <QVariant>
+#include <QDBusVariant>
+#include <QStringList>
+#include "ofonointerface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoNetworkOperator : public OfonoInterface
+{
+    Q_OBJECT
+public:
+    OfonoNetworkOperator(const QString& operatorId, QObject *parent=0);
+    ~OfonoNetworkOperator();
+
+    void requestRegister();
+    
+    QString name();
+    QString status();
+    QString mcc();
+    QString mnc();
+    QStringList technologies();
+    QString additionalInfo();
+    
+signals:
+    void registerComplete(bool success);
+    
+    void nameChanged(QString name);
+    void statusChanged(QString status);
+    void mccChanged(QString mcc);
+    void mncChanged(QString mnc);
+    void technologiesChanged(QStringList technologies);
+    void additionalInfoChanged(QString additionalInfo);
+
+private:
+
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    
+    void registerResp();
+    void registerErr(const QDBusError& error);
+
+
+private:
+
+
+};
+#endif
diff --git a/lib/ofononetworkregistration.cpp b/lib/ofononetworkregistration.cpp
new file mode 100644 (file)
index 0000000..603eb59
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofononetworkregistration.h"
+
+#define REGISTER_TIMEOUT 300000
+#define SCAN_TIMEOUT 300000
+
+QDBusArgument &operator<<(QDBusArgument &argument, const OfonoOperatorStruct &op)
+{
+    argument.beginStructure();
+    argument << op.path << op.properties;
+    argument.endStructure();
+    return argument;
+}   
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, OfonoOperatorStruct &op)
+{   
+    argument.beginStructure();
+    argument >> op.path >> op.properties; 
+    argument.endStructure();
+    return argument;
+}
+
+
+OfonoNetworkRegistration::OfonoNetworkRegistration(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.NetworkRegistration", OfonoInterface::GetAllOnStartup, parent)
+{
+    qDBusRegisterMetaType<OfonoOperatorStruct>();
+    qDBusRegisterMetaType<OfonoOperatorList>();
+
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+}
+
+OfonoNetworkRegistration::~OfonoNetworkRegistration()
+{
+}
+
+void OfonoNetworkRegistration::requestRegister()
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "Register");
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(registerResp()),
+                                       SLOT(registerErr(const QDBusError&)),
+                                       REGISTER_TIMEOUT);
+}
+
+void OfonoNetworkRegistration::requestDeregister()
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "Deregister");
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(deregisterResp()),
+                                       SLOT(deregisterErr(const QDBusError&)),
+                                       REGISTER_TIMEOUT);
+}
+
+void OfonoNetworkRegistration::requestScan()
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "Scan");
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(scanResp(OfonoOperatorList)),
+                                       SLOT(scanErr(const QDBusError&)),
+                                       REGISTER_TIMEOUT);
+}
+
+void OfonoNetworkRegistration::requestGetOperators()
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "GetOperators");
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(getOperatorsResp(OfonoOperatorList)),
+                                       SLOT(getOperatorsErr(const QDBusError&)),
+                                       SCAN_TIMEOUT);
+}
+
+QString OfonoNetworkRegistration::mode()
+{
+    return properties()["Mode"].value<QString>();
+}
+
+QString OfonoNetworkRegistration::status()
+{
+    return properties()["Status"].value<QString>();
+}
+
+uint OfonoNetworkRegistration::locationAreaCode()
+{
+    return properties()["LocationAreaCode"].value<uint>();
+}
+
+uint OfonoNetworkRegistration::cellId()
+{
+    return properties()["CellId"].value<uint>();
+}
+
+QString OfonoNetworkRegistration::mcc()
+{
+    return properties()["MobileCountryCode"].value<QString>();
+}
+
+QString OfonoNetworkRegistration::mnc()
+{
+    return properties()["MobileNetworkCode"].value<QString>();
+}
+
+QString OfonoNetworkRegistration::technology()
+{
+    return properties()["Technology"].value<QString>();
+}
+
+QString OfonoNetworkRegistration::name()
+{
+    return properties()["Name"].value<QString>();
+}
+
+uint OfonoNetworkRegistration::strength()
+{
+    return properties()["Strength"].value<uint>();
+}
+
+QString OfonoNetworkRegistration::baseStation()
+{
+    return properties()["BaseStation"].value<QString>();
+}
+
+void OfonoNetworkRegistration::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "Mode") {  
+        emit modeChanged(value.value<QString>());
+    } else if (property == "Status") { 
+        emit statusChanged(value.value<QString>());
+    } else if (property == "LocationAreaCode") {       
+        emit locationAreaCodeChanged(value.value<uint>());
+    } else if (property == "CellId") { 
+        emit cellIdChanged(value.value<uint>());
+    } else if (property == "MobileCountryCode") {      
+        emit mccChanged(value.value<QString>());
+    } else if (property == "MobileNetworkCode") {      
+        emit mncChanged(value.value<QString>());
+    } else if (property == "Technology") {     
+        emit technologyChanged(value.value<QString>());
+    } else if (property == "Name") {   
+        emit nameChanged(value.value<QString>());
+    } else if (property == "Strength") {       
+        emit strengthChanged(value.value<uint>());
+    } else if (property == "BaseStation") {    
+        emit baseStationChanged(value.value<QString>());
+    }
+}
+
+void OfonoNetworkRegistration::registerResp()
+{
+    emit registerComplete(TRUE);
+}
+
+void OfonoNetworkRegistration::registerErr(QDBusError error)
+{
+    qDebug() << "Register failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit registerComplete(FALSE);
+}
+
+void OfonoNetworkRegistration::deregisterResp()
+{
+    emit deregisterComplete(TRUE);
+}
+
+void OfonoNetworkRegistration::deregisterErr(QDBusError error)
+{
+    qDebug() << "Deregister failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit deregisterComplete(FALSE);
+}
+
+void OfonoNetworkRegistration::getOperatorsResp(OfonoOperatorList list)
+{
+    QStringList oplist;
+    foreach(OfonoOperatorStruct op, list) {
+       oplist << op.path.path();
+    }
+    emit getOperatorsComplete(TRUE, oplist);
+}
+
+void OfonoNetworkRegistration::getOperatorsErr(QDBusError error)
+{
+    qDebug() << "GetOperators failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit getOperatorsComplete(FALSE, QStringList());
+}
+
+void OfonoNetworkRegistration::scanResp(OfonoOperatorList list)
+{
+    QStringList oplist;
+    foreach(OfonoOperatorStruct op, list) {
+       oplist << op.path.path();
+    }
+    emit scanComplete(TRUE, oplist);
+}
+
+void OfonoNetworkRegistration::scanErr(QDBusError error)
+{
+    qDebug() << "Scan failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit scanComplete(FALSE, QStringList());
+}
+
diff --git a/lib/ofononetworkregistration.h b/lib/ofononetworkregistration.h
new file mode 100644 (file)
index 0000000..c003a93
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONONETWORKREGISTRATION_H
+#define OFONONETWORKREGISTRATION_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include <QStringList>
+#include <QDBusError>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+struct OfonoOperatorStruct {
+    QDBusObjectPath path;
+    QVariantMap properties;
+};
+typedef QList<OfonoOperatorStruct> OfonoOperatorList;
+Q_DECLARE_METATYPE(OfonoOperatorStruct)
+Q_DECLARE_METATYPE(OfonoOperatorList)
+// Marshall the ModemStruct data into a D-Bus argument
+QDBusArgument &operator<<(QDBusArgument &argument, const OfonoOperatorStruct &modem);
+    
+// Retrieve the ModemStruct data from the D-Bus argument
+const QDBusArgument &operator>>(const QDBusArgument &argument, OfonoOperatorStruct &modem);
+
+
+class OFONO_QT_EXPORT OfonoNetworkRegistration : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoNetworkRegistration(QString modemId, QObject *parent=0);
+    ~OfonoNetworkRegistration();
+    
+    /* Properties */
+    QString mode();
+    QString status();
+    uint locationAreaCode();
+    uint cellId();
+    QString mcc();
+    QString mnc();
+    QString technology();
+    QString name();
+    uint strength();
+    QString baseStation();
+    
+    void requestRegister();
+    void requestDeregister();
+    void requestGetOperators();
+    void requestScan();
+    
+signals:
+    void modeChanged(QString mode);
+    void statusChanged(QString status);
+    void locationAreaCodeChanged(uint locationAreaCode);
+    void cellIdChanged(uint cellId);
+    void mccChanged(QString mcc);
+    void mncChanged(QString mnc);
+    void technologyChanged(QString technology);
+    void nameChanged(QString name);
+    void strengthChanged(uint strength);
+    void baseStationChanged(QString baseStation);
+
+    void registerComplete(bool success);
+    void deregisterComplete(bool success);
+    void getOperatorsComplete(bool success, QStringList operatorIds);
+    void scanComplete(bool success, QStringList operatorIds);
+
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void registerResp();
+    void registerErr(QDBusError error);
+    void deregisterResp();
+    void deregisterErr(QDBusError error);
+    void getOperatorsResp(OfonoOperatorList list);
+    void getOperatorsErr(QDBusError error);
+    void scanResp(OfonoOperatorList list);
+    void scanErr(QDBusError error);
+
+private:
+
+};
+
+#endif  /* !OFONONETWORKREGISTRATION_H */
diff --git a/lib/ofonophonebook.cpp b/lib/ofonophonebook.cpp
new file mode 100644 (file)
index 0000000..d0f3739
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonophonebook.h"
+
+#define IMPORT_TIMEOUT 300000
+
+OfonoPhonebook::OfonoPhonebook(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.Phonebook", OfonoInterface::GetAllOnFirstRequest, parent)
+{
+
+}
+
+OfonoPhonebook::~OfonoPhonebook()
+{
+}
+
+void OfonoPhonebook::requestImport()
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "Import");
+    request.setArguments(QList<QVariant>());
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(importResp(QString)),
+                                       SLOT(importErr(const QDBusError&)),
+                                       IMPORT_TIMEOUT);
+}
+
+void OfonoPhonebook::importResp(QString entries)
+{
+    emit importComplete(true, entries);
+}
+
+void OfonoPhonebook::importErr(const QDBusError& error)
+{
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+
+    emit importComplete(false, QString());
+}
+
diff --git a/lib/ofonophonebook.h b/lib/ofonophonebook.h
new file mode 100644 (file)
index 0000000..323593d
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONOPHONEBOOK_H
+#define OFONOPHONEBOOK_H
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoPhonebook : public OfonoModemInterface
+{
+
+Q_OBJECT
+
+public:
+
+    OfonoPhonebook(QString modemId, QObject *parent);
+
+    ~OfonoPhonebook();
+
+    void requestImport();
+
+signals:
+    void importComplete(bool success, QString entries);
+
+private slots:
+    void importResp(QString entries);
+    void importErr(const QDBusError& error);
+
+private:
+
+};
+#endif
diff --git a/lib/ofonoradiosettings.cpp b/lib/ofonoradiosettings.cpp
new file mode 100644 (file)
index 0000000..38dc299
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonoradiosettings.h"
+
+OfonoRadioSettings::OfonoRadioSettings(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.RadioSettings", OfonoInterface::GetAllOnStartup, parent)
+{
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+    connect(this, SIGNAL(setPropertyFailed(const QString&)), 
+            this, SLOT(setPropertyFailed(const QString&)));}
+
+OfonoRadioSettings::~OfonoRadioSettings()
+{
+}
+
+QString OfonoRadioSettings::technologyPreference()
+{
+    return properties()["TechnologyPreference"].value<QString>();
+}
+
+void OfonoRadioSettings::setTechnologyPreference(QString preference)
+{
+    setProperty("TechnologyPreference", qVariantFromValue(preference));
+}
+
+void OfonoRadioSettings::setPropertyFailed(const QString& property)
+{
+    if (property == "TechnologyPreference")
+        emit setTechnologyPreferenceFailed();
+}
+
+void OfonoRadioSettings::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "TechnologyPreference") {  
+        emit technologyPreferenceChanged(value.value<QString>());
+    }
+}
diff --git a/lib/ofonoradiosettings.h b/lib/ofonoradiosettings.h
new file mode 100644 (file)
index 0000000..ab83f2e
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONORADIOSETTINGS_H
+#define OFONORADIOSETTINGS_H
+
+#include <QtCore/QObject>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoRadioSettings : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoRadioSettings(QString modemId, QObject *parent=0);
+    ~OfonoRadioSettings();
+
+    QString technologyPreference();
+    void setTechnologyPreference(QString preference);
+
+signals:
+    void technologyPreferenceChanged(QString preference);
+    void setTechnologyPreferenceFailed();
+        
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void setPropertyFailed(const QString& property);    
+};
+
+
+#endif  /* !OFONORADIOSETTINGS_H */
diff --git a/lib/ofonosimmanager.cpp b/lib/ofonosimmanager.cpp
new file mode 100644 (file)
index 0000000..d3fc9ff
--- /dev/null
@@ -0,0 +1,266 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonosimmanager.h"
+
+
+OfonoSimManager::OfonoSimManager(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.SimManager", OfonoInterface::GetAllOnStartup, parent)
+{
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+    connect(this, SIGNAL(setPropertyFailed(const QString&)), 
+            this, SLOT(setPropertyFailed(const QString&)));
+
+}
+
+OfonoSimManager::~OfonoSimManager()
+{
+}
+
+void OfonoSimManager::requestChangePin(QString pintype, QString oldpin, QString newpin)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "ChangePin");
+    request << pintype << oldpin << newpin;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(changePinResp()),
+                                       SLOT(changePinErr(const QDBusError&)));
+}
+
+void OfonoSimManager::requestEnterPin(QString pintype, QString pin)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "EnterPin");
+    request << pintype << pin;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(enterPinResp()),
+                                       SLOT(enterPinErr(const QDBusError&)));
+}
+
+void OfonoSimManager::requestResetPin(QString pintype, QString puk, QString newpin)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "ResetPin");
+    request << pintype << puk << newpin;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(resetPinResp()),
+                                       SLOT(resetPinErr(const QDBusError&)));
+}
+
+void OfonoSimManager::requestLockPin(QString pintype, QString pin)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "LockPin");
+    request << pintype << pin;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(lockPinResp()),
+                                       SLOT(lockPinErr(const QDBusError&)));
+}
+
+void OfonoSimManager::requestUnlockPin(QString pintype, QString pin)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "UnlockPin");
+    request << pintype << pin;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(unlockPinResp()),
+                                       SLOT(unlockPinErr(const QDBusError&)));
+}
+
+void OfonoSimManager::setSubscriberNumbers(QStringList numbers)
+{
+    setProperty("SubscriberNumbers", qVariantFromValue(numbers));
+}
+
+bool OfonoSimManager::present()
+{
+    return properties()["Present"].value<bool>();
+}
+
+QString OfonoSimManager::subscriberIdentity()
+{
+    return properties()["SubscriberIdentity"].value<QString>();
+}
+
+QString OfonoSimManager::mobileCountryCode()
+{
+    return properties()["MobileCountryCode"].value<QString>();
+}
+
+QString OfonoSimManager::mobileNetworkCode()
+{
+    return properties()["MobileNetworkCode"].value<QString>();
+}
+
+QStringList OfonoSimManager::subscriberNumbers()
+{
+    return properties()["SubscriberNumbers"].value<QStringList>();
+}
+
+QMap<QString, QString> OfonoSimManager::serviceNumbers()
+{
+    QMap<QString, QString> map;
+    properties()["ServiceNumbers"].value<QDBusArgument>() >> map;
+    return map;
+}
+
+QString OfonoSimManager::pinRequired()
+{
+    return properties()["PinRequired"].value<QString>();
+}
+
+QStringList OfonoSimManager::lockedPins()
+{
+    return properties()["LockedPins"].value<QStringList>();
+}
+
+QString OfonoSimManager::cardIdentifier()
+{
+    return properties()["CardIdentifier"].value<QString>();
+}
+
+QStringList OfonoSimManager::preferredLanguages()
+{
+    return properties()["PreferredLanguages"].value<QStringList>();
+}
+
+
+void OfonoSimManager::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "Present") {       
+        emit presenceChanged(value.value<bool>());
+    } else if (property == "SubscriberIdentity") {     
+        emit subscriberIdentityChanged(value.value<QString>());
+    } else if (property == "MobileCountryCode") {      
+        emit mobileCountryCodeChanged(value.value<QString>());
+    } else if (property == "MobileNetworkCode") {      
+        emit mobileNetworkCodeChanged(value.value<QString>());
+    } else if (property == "SubscriberNumbers") {      
+        emit subscriberNumbersChanged(value.value<QStringList>());
+    } else if (property == "ServiceNumbers") { 
+        QMap<QString, QString> map;
+        value.value<QDBusArgument>() >> map;
+        emit serviceNumbersChanged(map);
+    } else if (property == "PinRequired") {    
+        emit pinRequiredChanged(value.value<QString>());
+    } else if (property == "LockedPins") {     
+        emit lockedPinsChanged(value.value<QStringList>());
+    } else if (property == "CardIdentifier") { 
+        emit cardIdentifierChanged(value.value<QString>());
+    } else if (property == "PreferredLanguages") {     
+        emit preferredLanguagesChanged(value.value<QStringList>());
+    }
+}
+
+void OfonoSimManager::setPropertyFailed(const QString& property)
+{
+    if (property == "SubscriberNumbers")
+        emit setSubscriberNumbersFailed();
+}
+
+void OfonoSimManager::changePinResp()
+{
+    emit changePinComplete(TRUE);
+}
+
+void OfonoSimManager::changePinErr(QDBusError error)
+{
+    qDebug() << "ChangePin failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit changePinComplete(FALSE);
+}
+
+void OfonoSimManager::enterPinResp()
+{
+    emit enterPinComplete(TRUE);
+}
+
+void OfonoSimManager::enterPinErr(QDBusError error)
+{
+    qDebug() << "EnterPin failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit enterPinComplete(FALSE);
+}
+
+void OfonoSimManager::resetPinResp()
+{
+    emit resetPinComplete(TRUE);
+}
+
+void OfonoSimManager::resetPinErr(QDBusError error)
+{
+    qDebug() << "ResetPin failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit resetPinComplete(FALSE);
+}
+
+void OfonoSimManager::lockPinResp()
+{
+    emit lockPinComplete(TRUE);
+}
+void OfonoSimManager::lockPinErr(QDBusError error)
+{
+    qDebug() << "LockPin failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit lockPinComplete(FALSE);
+}
+
+void OfonoSimManager::unlockPinResp()
+{
+    emit unlockPinComplete(TRUE);
+}
+void OfonoSimManager::unlockPinErr(QDBusError error)
+{
+    qDebug() << "UnlockPin failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit unlockPinComplete(FALSE);
+}
diff --git a/lib/ofonosimmanager.h b/lib/ofonosimmanager.h
new file mode 100644 (file)
index 0000000..40958de
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONOSIMMANAGER_H
+#define OFONOSIMMANAGER_H
+
+#include <QtCore/QObject>
+#include <QStringList>
+#include <QDBusError>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoSimManager : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoSimManager(QString modemId, QObject *parent=0);
+    ~OfonoSimManager();
+
+    /* Properties */
+    bool present();
+    QString subscriberIdentity();
+    QString mobileCountryCode();
+    QString mobileNetworkCode();
+    QStringList subscriberNumbers();
+    QMap<QString, QString> serviceNumbers();
+    QString pinRequired();
+    QStringList lockedPins();
+    QString cardIdentifier();
+    QStringList preferredLanguages();
+
+    void requestChangePin(QString pintype, QString oldpin, QString newpin);
+    void requestEnterPin(QString pintype, QString pin);
+    void requestResetPin(QString pintype, QString puk, QString newpin);
+    void requestLockPin(QString pintype, QString pin);
+    void requestUnlockPin(QString pintype, QString pin);
+
+    void setSubscriberNumbers(QStringList numbers);
+
+signals:
+    void presenceChanged(bool ispresent);
+    void subscriberIdentityChanged(QString imsi);
+    void mobileCountryCodeChanged(QString mcc);
+    void mobileNetworkCodeChanged(QString mnc);
+    void subscriberNumbersChanged(QStringList msisdns);
+    void setSubscriberNumbersFailed();
+    void serviceNumbersChanged(QMap<QString, QString> sdns);
+    void pinRequiredChanged(QString pintype);
+    void lockedPinsChanged(QStringList pins);
+    void cardIdentifierChanged(QString iccid);
+    void preferredLanguagesChanged(QStringList languages);
+
+    void changePinComplete(bool success);
+    void enterPinComplete(bool success);
+    void resetPinComplete(bool success);
+    void lockPinComplete(bool success);
+    void unlockPinComplete(bool success);
+
+
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void setPropertyFailed(const QString& property);    
+
+    void changePinResp();
+    void changePinErr(QDBusError error);
+    void enterPinResp();
+    void enterPinErr(QDBusError error);
+    void resetPinResp();
+    void resetPinErr(QDBusError error);
+    void lockPinResp();
+    void lockPinErr(QDBusError error);
+    void unlockPinResp();
+    void unlockPinErr(QDBusError error);
+
+private:
+
+};
+
+#endif  /* !OFONOSIMMANAGER_H */
diff --git a/lib/ofonosupplementaryservices.cpp b/lib/ofonosupplementaryservices.cpp
new file mode 100644 (file)
index 0000000..8d7f4c5
--- /dev/null
@@ -0,0 +1,196 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonosupplementaryservices.h"
+
+#define REQUEST_TIMEOUT 60000
+
+OfonoSupplementaryServices::OfonoSupplementaryServices(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.SupplementaryServices", OfonoInterface::GetAllOnStartup, parent)
+{
+
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+    QDBusConnection::systemBus().connect("org.ofono", path(), ifname(), 
+                                            "NotificationReceived",
+                                            this,
+                                            SIGNAL(notificationReceived(QString)));
+    QDBusConnection::systemBus().connect("org.ofono", path(), ifname(), 
+                                            "RequestReceived",
+                                            this,
+                                            SIGNAL(requestReceived(QString)));
+}
+
+OfonoSupplementaryServices::~OfonoSupplementaryServices()
+{
+}
+
+void OfonoSupplementaryServices::requestInitiate(QString command)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "Initiate");
+    request << command;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(initiateResp(QString, QDBusVariant)),
+                                       SLOT(initiateErr(const QDBusError&)),
+                                       REQUEST_TIMEOUT);
+}
+
+void OfonoSupplementaryServices::requestRespond(QString reply)
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "Respond");
+    request << reply;
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(respondResp(QString)),
+                                       SLOT(respondErr(const QDBusError&)),
+                                       REQUEST_TIMEOUT);
+}
+
+void OfonoSupplementaryServices::requestCancel()
+{
+    QDBusMessage request;
+
+    request = QDBusMessage::createMethodCall("org.ofono",
+                                            path(), ifname(),
+                                            "Cancel");
+
+    QDBusConnection::systemBus().callWithCallback(request, this,
+                                       SLOT(cancelResp(QString)),
+                                       SLOT(cancelErr(const QDBusError&)),
+                                       REQUEST_TIMEOUT);
+}
+
+QString OfonoSupplementaryServices::state()
+{
+    return properties()["State"].value<QString>();
+}
+
+void OfonoSupplementaryServices::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "State") { 
+        emit stateChanged(value.value<QString>());
+    } 
+}
+
+void OfonoSupplementaryServices::initiateResp(QString message, QDBusVariant details)
+{
+    const QDBusArgument argument = details.variant().value<QDBusArgument>();
+    if (message == "USSD") {
+       QString ussdResp;
+       argument >> ussdResp;
+        emit initiateUSSDComplete(ussdResp);
+    } else if (message == "CallBarring") {
+        QString ssOp, cbService;
+        QVariantMap cbMap;
+        argument.beginStructure();
+        argument >> ssOp >> cbService >> cbMap;
+        argument.endStructure();
+        emit barringComplete(ssOp, cbService, cbMap);
+    } else if (message == "CallForwarding") {
+        QString ssOp, cfService;
+        QVariantMap cfMap;
+        argument.beginStructure();
+        argument >> ssOp >> cfService >> cfMap;
+        argument.endStructure();
+        emit forwardingComplete(ssOp, cfService, cfMap);
+    } else if (message == "CallWaiting") {
+        QString ssOp;
+        QVariantMap cwMap;
+        argument.beginStructure();
+        argument >> ssOp >> cwMap;
+        argument.endStructure();
+        emit waitingComplete(ssOp, cwMap);
+    } else if (message == "CallingLinePresentation") {
+        QString ssOp, status;
+        argument.beginStructure();
+        argument >> ssOp >> status;
+        argument.endStructure();
+        emit callingLinePresentationComplete(ssOp, status);
+    } else if (message == "CalledLinePresentation") {
+        QString ssOp, status;
+        argument.beginStructure();
+        argument >> ssOp >> status;
+        argument.endStructure();
+        emit calledLinePresentationComplete(ssOp, status);
+    } else if (message == "CallingLineRestriction") {
+        QString ssOp, status;
+        argument.beginStructure();
+        argument >> ssOp >> status;
+        argument.endStructure();
+        emit callingLineRestrictionComplete(ssOp, status);
+    } else if (message == "CalledLineRestriction") {
+        QString ssOp, status;
+        argument.beginStructure();
+        argument >> ssOp >> status;
+        argument.endStructure();
+        emit calledLineRestrictionComplete(ssOp, status);
+    } 
+}
+
+void OfonoSupplementaryServices::initiateErr(QDBusError error)
+{
+    qDebug() << "Initiate failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit initiateFailed();
+}
+
+
+void OfonoSupplementaryServices::respondResp(QString message)
+{
+    emit respondComplete(TRUE, message);
+}
+
+void OfonoSupplementaryServices::respondErr(QDBusError error)
+{
+    qDebug() << "Respond failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit respondComplete(FALSE, QString());
+}
+
+void OfonoSupplementaryServices::cancelResp()
+{
+    emit cancelComplete(TRUE);
+}
+
+void OfonoSupplementaryServices::cancelErr(QDBusError error)
+{
+    qDebug() << "Cancel failed" << error;
+    m_errorName = error.name();
+    m_errorMessage = error.message();
+    emit cancelComplete(FALSE);
+}
+
diff --git a/lib/ofonosupplementaryservices.h b/lib/ofonosupplementaryservices.h
new file mode 100644 (file)
index 0000000..bce6eea
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONOSUPPLEMENTARYSERVICES_H
+#define OFONOSUPPLEMENTARYSERVICES_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include <QStringList>
+#include <QDBusError>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoSupplementaryServices : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoSupplementaryServices(QString modemId, QObject *parent=0);
+    ~OfonoSupplementaryServices();
+    
+    /* Properties */
+    QString state();
+    
+    void requestInitiate(QString command);
+    void requestRespond(QString reply);
+    void requestCancel();
+    
+signals:
+    void notificationReceived(QString message);
+    void requestReceived(QString message);
+
+    void stateChanged(QString state);
+
+    void initiateUSSDComplete(QString ussdResp);
+    void barringComplete(QString ssOp, QString cbService, QVariantMap cbMap);
+    void forwardingComplete(QString ssOp, QString cfService, QVariantMap cfMap);
+    void waitingComplete(QString ssOp, QVariantMap cwMap);
+    void callingLinePresentationComplete(QString ssOp, QString status);
+    void calledLinePresentationComplete(QString ssOp, QString status);
+    void callingLineRestrictionComplete(QString ssOp, QString status);
+    void calledLineRestrictionComplete(QString ssOp, QString status);
+    void initiateFailed();
+    void respondComplete(bool success, QString message);
+    void cancelComplete(bool success);
+    
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+    void initiateResp(QString message, QDBusVariant details);
+    void initiateErr(QDBusError error);
+    void respondResp(QString message);
+    void respondErr(QDBusError error);
+    void cancelResp();
+    void cancelErr(QDBusError error);
+
+private:
+
+};
+
+#endif  /* !OFONOSUPPLEMETARYSERVICES_H */
diff --git a/lib/ofonovoicecallmanager.cpp b/lib/ofonovoicecallmanager.cpp
new file mode 100644 (file)
index 0000000..ba1f61a
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <QtDBus/QtDBus>
+#include <QtCore/QObject>
+
+#include "ofonovoicecallmanager.h"
+
+OfonoVoiceCallManager::OfonoVoiceCallManager(QString modemId, QObject *parent)
+    : OfonoModemInterface(modemId, "org.ofono.VoiceCallManager", OfonoInterface::GetAllOnStartup, parent)
+{
+    connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)), 
+            this, SLOT(propertyChanged(const QString&, const QVariant&)));
+}
+
+OfonoVoiceCallManager::~OfonoVoiceCallManager()
+{
+}
+
+QStringList OfonoVoiceCallManager::emergencyNumbers()
+{
+    return properties()["EmergencyNumbers"].value<QStringList>();
+}
+
+void OfonoVoiceCallManager::propertyChanged(const QString& property, const QVariant& value)
+{
+    if (property == "EmergencyNumbers") {      
+        emit emergencyNumbersChanged(value.value<QStringList>());
+    }
+}
diff --git a/lib/ofonovoicecallmanager.h b/lib/ofonovoicecallmanager.h
new file mode 100644 (file)
index 0000000..126ca0c
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * This file is part of ofono-qt
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef OFONOVOICECALLMANAGER_H
+#define OFONOVOICECALLMANAGER_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "ofonomodeminterface.h"
+#include "libofono-qt_global.h"
+
+class OFONO_QT_EXPORT OfonoVoiceCallManager : public OfonoModemInterface
+{
+    Q_OBJECT
+
+public:
+    OfonoVoiceCallManager(QString modemId, QObject *parent=0);
+    ~OfonoVoiceCallManager();
+
+    /* Properties */
+    QStringList emergencyNumbers();
+    
+signals:
+    void emergencyNumbersChanged(QStringList numbers);
+
+private slots:
+    void propertyChanged(const QString& property, const QVariant& value);
+};
+
+#endif  /* !OFONOVOICECALLMANAGER_H */
diff --git a/ofono-qt.pro b/ofono-qt.pro
new file mode 100644 (file)
index 0000000..1d2f642
--- /dev/null
@@ -0,0 +1,6 @@
+include(version.pri)
+TEMPLATE = subdirs
+CONFIG += ordered
+SUBDIRS += lib tests
+
+
diff --git a/tests/test_ofonocallbarring.cpp b/tests/test_ofonocallbarring.cpp
new file mode 100644 (file)
index 0000000..790151b
--- /dev/null
@@ -0,0 +1,143 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonocallbarring.h>
+
+#include <QtDebug>
+
+
+class TestOfonoCallBarring : public QObject
+{
+    Q_OBJECT
+
+public slots:
+
+    void validityChanged(bool validity)
+    {
+       qDebug() << "ValidityChanged" << validity;
+    }
+
+    void voiceIncomingComplete(bool success, QString barrings)
+    {
+       qDebug() << "voiceIncomingComplete" << success << barrings;
+    }
+
+    void voiceOutgoingComplete(bool success, QString barrings)
+    {
+       qDebug() << "voiceOutgoingComplete" << success << barrings;
+    }
+
+    void voiceIncomingChanged(QString barrings)
+    {
+       qDebug() << "voiceIncomingChanged" << barrings;
+    }
+
+    void voiceOutgoingChanged(QString barrings)
+    {
+       qDebug() << "voiceOutgoingChanged" << barrings;
+    }
+
+    void setVoiceIncomingFailed()
+    {
+       qDebug() << "setVoiceIncomingFailed" << m->errorName() << m->errorMessage();
+    }
+
+    void setVoiceOutgoingFailed()
+    {
+       qDebug() << "setVoiceOutgoingFailed" << m->errorName() << m->errorMessage();
+    }
+
+    void incomingBarringInEffect()
+    {
+       qDebug() << "incomingBarringInEffect signal";
+    }
+
+    void outgoingBarringInEffect()
+    {
+       qDebug() << "outgoingBarringInEffect signal";
+    }
+
+
+    void disableAllComplete(bool success)
+    {
+       qDebug() << "disableAllComplete:" << success;
+    }
+
+    void changePasswordComplete(bool success)
+    {
+       qDebug() << "changePasswordComplete:" << success;
+    }
+
+private slots:
+
+    void initTestCase()
+    {
+       m = new OfonoCallBarring(QString(), this);
+       connect(m, SIGNAL(validityChanged(bool)), this, 
+               SLOT(validityChanged(bool)));
+       connect(m, SIGNAL(voiceIncomingComplete(bool, QString)), this, 
+               SLOT(voiceIncomingComplete(bool, QString)));
+       connect(m, SIGNAL(voiceOutgoingComplete(bool, QString)), this, 
+               SLOT(voiceOutgoingComplete(bool, QString)));
+       connect(m, SIGNAL(voiceIncomingChanged(QString)), this, 
+               SLOT(voiceIncomingChanged(QString)));
+       connect(m, SIGNAL(voiceOutgoingChanged(QString)), this, 
+               SLOT(voiceOutgoingChanged(QString)));
+       connect(m, SIGNAL(setVoiceIncomingFailed()), this, 
+               SLOT(setVoiceIncomingFailed()));
+       connect(m, SIGNAL(setVoiceOutgoingFailed()), this, 
+               SLOT(setVoiceOutgoingFailed()));
+       connect(m, SIGNAL(incomingBarringInEffect()), this, 
+               SLOT(incomingBarringInEffect()));
+       connect(m, SIGNAL(outgoingBarringInEffect()), this, 
+               SLOT(outgoingBarringInEffect()));
+       // Wait for properties to arrive...
+       QTest::qWait(1000);
+    }
+
+    void testOfonoCallbarring()
+    {
+       qDebug() << "validity:" << m->isValid();
+       m->requestVoiceIncoming();
+       QTest::qWait(5000);
+       m->requestVoiceOutgoing();
+       QTest::qWait(5000);
+
+       qDebug() << "setVoiceIncoming(always)";
+       m->setVoiceIncoming("always", "3579");
+       QTest::qWait(1000);
+       qDebug() << "setVoiceOutgoing(international)";
+       m->setVoiceOutgoing("international", "3579");
+       QTest::qWait(1000);
+
+       connect(m, SIGNAL(disableAllComplete(bool)), 
+               this, SLOT(disableAllComplete(bool)));
+       m->requestDisableAll("3579");
+       QTest::qWait(1000);
+       m->requestVoiceIncoming();
+       QTest::qWait(5000);
+       m->requestVoiceOutgoing();
+       QTest::qWait(5000);
+
+       connect(m, SIGNAL(changePasswordComplete(bool)), 
+               this, SLOT(changePasswordComplete(bool)));
+       m->requestChangePassword("3579", "1234");
+       QTest::qWait(1000);
+       m->requestChangePassword("1234", "3579");
+
+       QTest::qWait(2000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoCallBarring *m;
+};
+
+QTEST_MAIN(TestOfonoCallBarring)
+#include "test_ofonocallbarring.moc"
diff --git a/tests/test_ofonocallbarring.pro b/tests/test_ofonocallbarring.pro
new file mode 100644 (file)
index 0000000..4ef528a
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonocallbarring.cpp
+
diff --git a/tests/test_ofonocallforwarding.cpp b/tests/test_ofonocallforwarding.cpp
new file mode 100644 (file)
index 0000000..8809cbe
--- /dev/null
@@ -0,0 +1,149 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonocallforwarding.h>
+
+#include <QtDebug>
+
+
+class TestOfonoCallForwarding : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void validityChanged(bool validity)
+    {
+       qDebug() << "ValidityChanged" << validity;
+    }
+    void voiceUnconditionalComplete(bool success, QString property)
+    {
+       qDebug() << "voiceUnconditionalComplete" << success <<  property;
+    }
+    void voiceBusyComplete(bool success, QString property)
+    {
+       qDebug() << "voiceBusyComplete" << success <<  property;
+    }
+    void voiceNoReplyComplete(bool success, QString property)
+    {
+       qDebug() << "voiceNoReplyComplete" << success <<  property;
+    }
+    void voiceNoReplyTimeoutComplete(bool success, ushort timeout)
+    {
+       qDebug() << "voiceNoReplyTimeoutComplete" << success <<  timeout;
+    }
+    void voiceNotReachableComplete(bool success, QString property)
+    {
+       qDebug() << "voiceNotReachableComplete" << success <<  property;
+    }
+
+    void voiceUnconditionalChanged(QString property)
+    {
+       qDebug() << "voiceUnconditionalChanged" << property;
+    }
+    void voiceBusyChanged(QString property)
+    {
+       qDebug() << "voiceBusyChanged" << property;
+    }
+    void voiceNoReplyChanged(QString property)
+    {
+       qDebug() << "voiceNoReplyChanged" << property;
+    }
+    void voiceNoReplyTimeoutChanged(ushort timeout)
+    {
+       qDebug() << "voiceNoReplyTimeoutChanged" << timeout;
+    }
+    void voiceNotReachableChanged(QString property)
+    {
+       qDebug() << "voiceNotReachableChanged" << property;
+    }
+
+    void disableAllComplete(bool success)
+    {
+       qDebug() << "disableAllComplete:" << success;
+    }
+
+
+    void initTestCase()
+    {
+       m = new OfonoCallForwarding(QString(), this);
+       connect(m, SIGNAL(validityChanged(bool)), this, 
+               SLOT(validityChanged(bool)));
+       connect(m, SIGNAL(voiceUnconditionalChanged(QString)), this, 
+               SLOT(voiceUnconditionalChanged(QString)));
+       connect(m, SIGNAL(voiceBusyChanged(QString)), this, 
+               SLOT(voiceBusyChanged(QString)));
+       connect(m, SIGNAL(voiceNoReplyChanged(QString)), this, 
+               SLOT(voiceNoReplyChanged(QString)));
+       connect(m, SIGNAL(voiceNoReplyTimeoutChanged(ushort)), this, 
+               SLOT(voiceNoReplyTimeoutChanged(ushort)));
+       connect(m, SIGNAL(voiceNotReachableChanged(QString)), this, 
+               SLOT(voiceNotReachableChanged(QString)));
+       connect(m, SIGNAL(voiceUnconditionalComplete(bool, QString)), this, 
+               SLOT(voiceUnconditionalComplete(bool, QString)));
+       connect(m, SIGNAL(voiceBusyComplete(bool, QString)), this, 
+               SLOT(voiceBusyComplete(bool, QString)));
+       connect(m, SIGNAL(voiceNoReplyComplete(bool, QString)), this, 
+               SLOT(voiceNoReplyComplete(bool, QString)));
+       connect(m, SIGNAL(voiceNoReplyTimeoutComplete(bool, ushort)), this, 
+               SLOT(voiceNoReplyTimeoutComplete(bool, ushort)));
+       connect(m, SIGNAL(voiceNotReachableComplete(bool, QString)), this, 
+               SLOT(voiceNotReachableComplete(bool, QString)));
+       //FIXME: should connect to setSomethingFailed signals too
+    }
+
+    void testOfonoCallForwarding()
+    {
+       qDebug() << "validity:" << m->isValid();
+       m->requestVoiceUnconditional();
+       QTest::qWait(1000);
+       m->requestVoiceBusy();
+       QTest::qWait(1000);
+       m->requestVoiceNoReply();
+       QTest::qWait(1000);
+       m->requestVoiceNoReplyTimeout();
+       QTest::qWait(1000);
+       m->requestVoiceNotReachable();
+       QTest::qWait(1000);
+
+       qDebug() << "setVoiceBusy():";
+       m->setVoiceBusy("12345678");
+       qDebug() << "setVoiceNoReply():";
+       m->setVoiceNoReply("12345678");
+       qDebug() << "setVoiceNoReplyTimeout():";
+       m->setVoiceNoReplyTimeout(30);
+       qDebug() << "setVoiceNotReachable():";
+       m->setVoiceNotReachable("12345678");
+       qDebug() << "setVoiceUnconditional():";
+       m->setVoiceUnconditional("12345678");
+       QTest::qWait(1000);
+       qDebug() << "setVoiceBusy():";
+       m->setVoiceBusy("");
+       qDebug() << "setVoiceNoReply():";
+       m->setVoiceNoReply("");
+       qDebug() << "setVoiceNotReachable():";
+       m->setVoiceNotReachable("");
+       qDebug() << "setVoiceUnconditional():";
+       m->setVoiceUnconditional("");
+
+
+       connect(m, SIGNAL(disableAllComplete(bool)), 
+               this, SLOT(disableAllComplete(bool)));
+       m->requestDisableAll("all");
+
+       QTest::qWait(120000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoCallForwarding *m;
+};
+
+QTEST_MAIN(TestOfonoCallForwarding)
+#include "test_ofonocallforwarding.moc"
diff --git a/tests/test_ofonocallforwarding.pro b/tests/test_ofonocallforwarding.pro
new file mode 100644 (file)
index 0000000..9c86284
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonocallforwarding.cpp
+
diff --git a/tests/test_ofonocallmeter.cpp b/tests/test_ofonocallmeter.cpp
new file mode 100644 (file)
index 0000000..a0a72ba
--- /dev/null
@@ -0,0 +1,60 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonocallmeter.h>
+
+#include <QtDebug>
+
+
+class TestOfonoCallMeter : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void validityChanged(bool validity)
+    {
+       qDebug() << "ValidityChanged" << validity;
+    }
+
+    void callMeterComplete(bool success, uint value)
+    {
+       qDebug() << "callMeterComplete" << success << value;
+    }
+
+    void callMeterChanged(uint value)
+    {
+       qDebug() << "callMeterChanged" << value;
+    }
+
+    void initTestCase()
+    {
+       m = new OfonoCallMeter(QString(), this);
+       connect(m, SIGNAL(validityChanged(bool)), this, 
+               SLOT(validityChanged(bool)));
+       connect(m, SIGNAL(callMeterChanged(uint)), this, 
+               SLOT(callMeterChanged(uint)));
+       connect(m, SIGNAL(callMeterComplete(bool, uint)), this, 
+               SLOT(callMeterComplete(bool, uint)));
+    }
+
+    void testOfonoCallMeter()
+    {
+       qDebug() << "validity:" << m->isValid();
+       m->requestCallMeter();
+       QTest::qWait(1000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoCallMeter *m;
+};
+
+QTEST_MAIN(TestOfonoCallMeter)
+#include "test_ofonocallmeter.moc"
diff --git a/tests/test_ofonocallmeter.pro b/tests/test_ofonocallmeter.pro
new file mode 100644 (file)
index 0000000..205243a
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonocallmeter.cpp
+
diff --git a/tests/test_ofonocallsettings.cpp b/tests/test_ofonocallsettings.cpp
new file mode 100644 (file)
index 0000000..a92b85b
--- /dev/null
@@ -0,0 +1,155 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonocallsettings.h>
+
+#include <QtDebug>
+
+
+class TestOfonoCallSettings : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void validityChanged(bool validity)
+    {
+       qDebug() << "ValidityChanged" << validity;
+    }
+
+    void callingLinePresentationComplete(bool success, QString setting)
+    {
+       qDebug() << "callingLinePresentationComplete" << success << setting;
+    }
+    void calledLinePresentationComplete(bool success, QString setting)
+    {
+       qDebug() << "calledLinePresentationComplete" << success << setting;
+    }
+    void calledLineRestrictionComplete(bool success, QString setting)
+    {
+       qDebug() << "calledLineRestrictionComplete" << success << setting;
+    }
+    void callingLineRestrictionComplete(bool success, QString setting)
+    {
+       qDebug() << "callingLineRestrictionComplete" << success << setting;
+    }
+    void hideCallerIdComplete(bool success, QString setting)
+    {
+       qDebug() << "hideCallerIdComplete" << success << setting;
+    }
+    void voiceCallWaitingComplete(bool success, QString setting)
+    {
+       qDebug() << "voiceCallWaitingComplete" << success << setting;
+    }
+
+    void callingLinePresentationChanged(QString setting)
+    {
+       qDebug() << "callingLinePresentationChanged" << setting;
+    }
+    void calledLinePresentationChanged(QString setting)
+    {
+       qDebug() << "calledLinePresentationChanged" << setting;
+    }
+    void calledLineRestrictionChanged(QString setting)
+    {
+       qDebug() << "calledLineRestrictionChanged" << setting;
+    }
+    void callingLineRestrictionChanged(QString setting)
+    {
+       qDebug() << "callingLineRestrictionChanged" << setting;
+    }
+    void hideCallerIdChanged(QString setting)
+    {
+       qDebug() << "hideCallerIdChanged" << setting;
+    }
+    void voiceCallWaitingChanged(QString setting)
+    {
+       qDebug() << "voiceCallWaitingChanged" << setting;
+    }
+
+    void setHideCallerIdFailed()
+    {
+       qDebug() << "setHideCallerIdFailed";
+    }
+    void setVoiceCallWaitingFailed()
+    {
+       qDebug() << "setVoiceCallWaitingFailed";
+    }
+
+    void initTestCase()
+    {
+       m = new OfonoCallSettings(QString(), this);
+       connect(m, SIGNAL(validityChanged(bool)), this, 
+               SLOT(validityChanged(bool)));
+       connect(m, SIGNAL(callingLinePresentationChanged(QString)), this, 
+               SLOT(callingLinePresentationChanged(QString)));
+       connect(m, SIGNAL(calledLinePresentationChanged(QString)), this, 
+               SLOT(calledLinePresentationChanged(QString)));
+       connect(m, SIGNAL(calledLineRestrictionChanged(QString)), this, 
+               SLOT(calledLineRestrictionChanged(QString)));
+       connect(m, SIGNAL(callingLineRestrictionChanged(QString)), this, 
+               SLOT(callingLineRestrictionChanged(QString)));
+       connect(m, SIGNAL(hideCallerIdChanged(QString)), this, 
+               SLOT(hideCallerIdChanged(QString)));
+       connect(m, SIGNAL(voiceCallWaitingChanged(QString)), this, 
+               SLOT(voiceCallWaitingChanged(QString)));
+       connect(m, SIGNAL(setHideCallerIdFailed()), this, 
+               SLOT(setHideCallerIdFailed()));
+       connect(m, SIGNAL(setVoiceCallWaitingFailed()), this, 
+               SLOT(setVoiceCallWaitingFailed()));
+
+       connect(m, SIGNAL(callingLinePresentationComplete( bool, QString)), this, 
+               SLOT(callingLinePresentationComplete( bool, QString)));
+       connect(m, SIGNAL(calledLinePresentationComplete( bool, QString)), this, 
+               SLOT(calledLinePresentationComplete( bool, QString)));
+       connect(m, SIGNAL(calledLineRestrictionComplete( bool, QString)), this, 
+               SLOT(calledLineRestrictionComplete( bool, QString)));
+       connect(m, SIGNAL(callingLineRestrictionComplete( bool, QString)), this, 
+               SLOT(callingLineRestrictionComplete( bool, QString)));
+       connect(m, SIGNAL(hideCallerIdComplete( bool, QString)), this, 
+               SLOT(hideCallerIdComplete( bool, QString)));
+       connect(m, SIGNAL(voiceCallWaitingComplete( bool, QString)), this, 
+               SLOT(voiceCallWaitingComplete( bool, QString)));
+
+    }
+
+    void testOfonoCallSettings()
+    {
+       qDebug() << "validity:" << m->isValid();
+       m->requestCallingLinePresentation();
+       QTest::qWait(1000);
+       m->requestCalledLinePresentation();
+       QTest::qWait(1000);
+       m->requestCalledLineRestriction();
+       QTest::qWait(1000);
+       m->requestCallingLineRestriction();
+       QTest::qWait(1000);
+       m->requestHideCallerId();
+       QTest::qWait(1000);
+       m->requestVoiceCallWaiting();
+       QTest::qWait(1000);
+       qDebug() << "setHideCallerId(enabled):";
+       m->setHideCallerId("enabled");
+       qDebug() << "setVoiceCallWaiting(enabled):";
+       m->setVoiceCallWaiting("enabled");
+       qDebug() << "setHideCallerId(disabled):";
+       m->setHideCallerId("disabled");
+       qDebug() << "setVoiceCallWaiting(disabled):";
+       m->setVoiceCallWaiting("disabled");
+
+       QTest::qWait(120000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoCallSettings *m;
+};
+
+QTEST_MAIN(TestOfonoCallSettings)
+#include "test_ofonocallsettings.moc"
diff --git a/tests/test_ofonocallsettings.pro b/tests/test_ofonocallsettings.pro
new file mode 100644 (file)
index 0000000..7e9b88e
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonocallsettings.cpp
+
diff --git a/tests/test_ofonointerface.cpp b/tests/test_ofonointerface.cpp
new file mode 100644 (file)
index 0000000..79d7492
--- /dev/null
@@ -0,0 +1,45 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonointerface.h>
+
+#include <QtDebug>
+
+class TestOfonoInterface : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void onPropertyChanged(const QString& name, const QVariant& property)
+    {
+    qDebug() << name << property;
+    qDebug () << oi->properties();
+    }
+
+    void initTestCase()
+    {
+       oi = new OfonoInterface("/isimodem1", "org.ofono.Modem", OfonoInterface::GetAllOnStartup, this);
+       connect(oi, SIGNAL(propertyChanged(const QString&, const QVariant&)), this, SLOT(onPropertyChanged(const QString&, const QVariant&)));
+    }
+
+    void testOfonoInterface()
+    {
+    oi->setProperty("Online", qVariantFromValue(true));
+    QTest::qWait(30000);
+//    qDebug() << oi->properties();
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoInterface *oi;
+};
+
+QTEST_MAIN(TestOfonoInterface)
+#include "test_ofonointerface.moc"
diff --git a/tests/test_ofonointerface.pro b/tests/test_ofonointerface.pro
new file mode 100644 (file)
index 0000000..16bcbfa
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonointerface.cpp
+
diff --git a/tests/test_ofonomessagemanager.cpp b/tests/test_ofonomessagemanager.cpp
new file mode 100644 (file)
index 0000000..820f58d
--- /dev/null
@@ -0,0 +1,82 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonomessagemanager.h>
+
+#include <QtDebug>
+
+
+class TestOfonoMessageManager : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void serviceCenterAddressChanged(const QString numbers)
+    {
+       qDebug() << "serviceCenterAddressChanged" << numbers;
+    }
+
+    void setServiceCenterAddressFailed()
+    {
+       qDebug() << "serviceCenterAddressFailed";
+    }
+
+    void serviceCenterAddressComplete(bool success, const QString numbers)
+    {
+       qDebug() << "serviceCenterAddressComplete" << success << numbers;
+       m_sca = numbers;
+    }
+
+    void validityChanged(bool validity)
+    {
+       qDebug() << "ValidityChanged" << validity;
+    }
+
+    void initTestCase()
+    {
+       m = new OfonoMessageManager(QString(), this);
+       connect(m, SIGNAL(validityChanged(bool)), this, 
+               SLOT(validityChanged(bool)));
+       connect(m, SIGNAL(serviceCenterAddressChanged(QString)), 
+               this, 
+               SLOT(serviceCenterAddressChanged(QString)));
+       connect(m, SIGNAL(setServiceCenterAddressFailed()), 
+               this, 
+               SLOT(setServiceCenterAddressFailed()));
+       connect(m, SIGNAL(serviceCenterAddressComplete(bool, QString)), 
+               this, 
+               SLOT(serviceCenterAddressComplete(bool, QString)));
+    }
+
+    void testOfonoMessageManager()
+    {
+       qDebug() << "validity:" << m->isValid();
+       if (m->isValid()) {
+           m->requestServiceCenterAddress();
+           QTest::qWait(2000);
+           if (m_sca.length() == 0)
+               return;
+           qDebug() << "setServiceCenterAddress(+123456)";
+           m->setServiceCenterAddress("+123456");
+           QTest::qWait(1000);
+           qDebug() << "setServiceCenterAddress(original)";
+           m->setServiceCenterAddress(m_sca);
+       }
+       QTest::qWait(1000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoMessageManager *m;
+    QString m_sca;
+};
+
+QTEST_MAIN(TestOfonoMessageManager)
+#include "test_ofonomessagemanager.moc"
diff --git a/tests/test_ofonomessagemanager.pro b/tests/test_ofonomessagemanager.pro
new file mode 100644 (file)
index 0000000..35882c1
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonomessagemanager.cpp
+
diff --git a/tests/test_ofonomessagewaiting.cpp b/tests/test_ofonomessagewaiting.cpp
new file mode 100644 (file)
index 0000000..ce5d0c1
--- /dev/null
@@ -0,0 +1,68 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonomessagewaiting.h>
+
+#include <QtDebug>
+
+class TestOfonoMessageWaiting : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void voicemailWaitingChanged(bool waiting)
+    {
+       qDebug() << "voicemailWaitingChanged" << waiting;
+    }
+
+    void voicemailMessageCountChanged(int count)
+    {
+       qDebug() << "voicemailMessageCountChanged" << count;
+    }
+
+    void voicemailMailboxNumberChanged(QString mailboxnumber)
+    {
+       qDebug() << "voicemailMailboxNumberChanged" << mailboxnumber;
+    }
+
+    void validityChanged(bool validity)
+    {
+       qDebug() << "ValidityChanged" << validity;
+    }
+
+    void initTestCase()
+    {
+       m = new OfonoMessageWaiting(QString(), this);
+       connect(m, SIGNAL(validityChanged(bool)), this, 
+               SLOT(validityChanged(bool)));
+       connect(m, SIGNAL(voicemailWaitingChanged(bool)), this, 
+               SLOT(voicemailWaitingChanged(bool)));
+       connect(m, SIGNAL(voicemailMessageCountChanged(int)), this, 
+               SLOT(voicemailMessageCountChanged(int)));
+       connect(m, SIGNAL(voicemailMailboxNumberChanged(QString)), this, 
+               SLOT(voicemailMailboxNumberChanged(QString)));
+    }
+
+    void testOfonoMessageWaiting()
+    {
+       qDebug() << "validity:" << m->isValid();
+       qDebug() << "voicemailWaiting():" << m->voicemailWaiting();
+       qDebug() << "voicemailMessageCount():" << m->voicemailMessageCount();
+       qDebug() << "voicemailMailboxNumber():" << m->voicemailMailboxNumber();
+       QTest::qWait(120000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoMessageWaiting *m;
+};
+
+QTEST_MAIN(TestOfonoMessageWaiting)
+#include "test_ofonomessagewaiting.moc"
diff --git a/tests/test_ofonomessagewaiting.pro b/tests/test_ofonomessagewaiting.pro
new file mode 100644 (file)
index 0000000..77f21a2
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonomessagewaiting.cpp
+
diff --git a/tests/test_ofonomodem.cpp b/tests/test_ofonomodem.cpp
new file mode 100644 (file)
index 0000000..e79ad74
--- /dev/null
@@ -0,0 +1,113 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonomodem.h>
+
+#include <QtDebug>
+
+class TestOfonoModem : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void validityChanged(bool validity)
+    {
+    qDebug() << "ValidityChanged" << validity;
+       qDebug() << "validity" << m->isValid() << "modemid" << m->modemId();
+    }
+
+    void modemIdChanged(QString modemId)
+    {
+    qDebug() << "ModemIdChanged" << modemId;
+       qDebug() << "validity" << m->isValid() << "modemid" << m->modemId();
+    }
+
+    void poweredChanged(bool powered)
+    {
+    qDebug() << "PoweredChanged" << powered;
+    }
+
+    void onlineChanged(bool online)
+    {
+    qDebug() << "OnlineChanged" << online;
+    }
+
+    void nameChanged(QString name)
+    {
+    qDebug() << "nameChanged" << name;
+    }
+    
+    void manufacturerChanged(QString manufacturer)
+    {
+    qDebug() << "manufacturerChanged" << manufacturer;
+    }
+
+    void modelChanged(QString model)
+    {
+    qDebug() << "modelChanged" << model;
+    }
+
+    void revisionChanged(QString revision)
+    {
+    qDebug() << "revisionChanged" << revision;
+    }
+
+    void serialChanged(QString serial)
+    {
+    qDebug() << "serialChanged" << serial;
+    }
+
+    void featuresChanged(QStringList features)
+    {
+    qDebug() << "FeaturesChanged" << features;
+    }
+
+    void interfacesChanged(QStringList interfaces)
+    {
+    qDebug() << "InterfacesChanged" << interfaces;
+    }
+
+    void initTestCase()
+    {
+       m = new OfonoModem("/isimodem0", this);
+//     m = new OfonoModem(this);
+       connect(m, SIGNAL(validityChanged(bool)), this, SLOT(validityChanged(bool)));
+    connect(m, SIGNAL(modemIdChanged(QString)),
+           this, SLOT(modemIdChanged(QString)));
+       connect(m, SIGNAL(poweredChanged(bool)), this, SLOT(poweredChanged(bool)));
+       connect(m, SIGNAL(onlineChanged(bool)), this, SLOT(onlineChanged(bool)));
+   connect(m, SIGNAL(nameChanged(QString)),
+           this, SLOT(nameChanged(QString)));
+    connect(m, SIGNAL(manufacturerChanged(QString)),
+           this, SLOT(manufacturerChanged(QString)));
+    connect(m, SIGNAL(modelChanged(QString)),
+           this, SLOT(modelChanged(QString)));
+    connect(m, SIGNAL(revisionChanged(QString)),
+           this, SLOT(revisionChanged(QString)));
+    connect(m, SIGNAL(serialChanged(QString)),
+           this, SLOT(serialChanged(QString)));
+       connect(m, SIGNAL(featuresChanged(QStringList)), this, SLOT(featuresChanged(QStringList)));
+       connect(m, SIGNAL(interfacesChanged(QStringList)), this, SLOT(interfacesChanged(QStringList)));
+    }
+
+    void testOfonoModem()
+    {
+       qDebug() << "validity" << m->isValid() << "modemid" << m->modemId();
+    qDebug() << m->powered() << m->online() << m->manufacturer() << m->model() << m->revision() << m->serial() << m->features() << m->interfaces();
+    m->setOnline(true);
+    QTest::qWait(120000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoModem *m;
+};
+
+QTEST_MAIN(TestOfonoModem)
+#include "test_ofonomodem.moc"
diff --git a/tests/test_ofonomodem.pro b/tests/test_ofonomodem.pro
new file mode 100644 (file)
index 0000000..f935e56
--- /dev/null
@@ -0,0 +1,2 @@
+include(testcase.pro)
+SOURCES = test_ofonomodem.cpp
diff --git a/tests/test_ofonomodemmanager.cpp b/tests/test_ofonomodemmanager.cpp
new file mode 100644 (file)
index 0000000..50b3dea
--- /dev/null
@@ -0,0 +1,49 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonomodemmanager.h>
+
+#include <QtDebug>
+
+
+class TestOfonoModemManager : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void modemAdded(QString modem)
+    {
+    qDebug() << "Modem added" << modem;
+    }
+
+    void modemRemoved(QString modem)
+    {
+    qDebug() << "Modem removed" << modem;
+    }
+
+    void initTestCase()
+    {
+       mm = new OfonoModemManager(this);
+       connect(mm, SIGNAL(modemAdded(QString)), this, SLOT(modemAdded(QString)));
+       connect(mm, SIGNAL(modemRemoved(QString)), this, SLOT(modemRemoved(QString)));
+    }
+
+    void testOfonoModemManager()
+    {
+    qDebug() << mm->modems();
+    QTest::qWait(30000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoModemManager *mm;
+};
+
+QTEST_MAIN(TestOfonoModemManager)
+#include "test_ofonomodemmanager.moc"
diff --git a/tests/test_ofonomodemmanager.pro b/tests/test_ofonomodemmanager.pro
new file mode 100644 (file)
index 0000000..7706885
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonomodemmanager.cpp
+
diff --git a/tests/test_ofononetworkoperator.cpp b/tests/test_ofononetworkoperator.cpp
new file mode 100644 (file)
index 0000000..94bd5f7
--- /dev/null
@@ -0,0 +1,60 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofononetworkoperator.h>
+
+#include <QtDebug>
+
+
+class TestOfonoNetworkOperator : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void statusChanged(QString status)
+    {
+       qDebug() << "statusChanged" << status;
+    }
+
+    void registerComplete(bool success)
+    {
+       qDebug() << "registerComplete:" << success;
+    }
+
+    void initTestCase()
+    {
+       m = new OfonoNetworkOperator("/phonesim/operator/23406", this);
+       connect(m, SIGNAL(registerComplete(bool)), this, 
+               SLOT(registerComplete(bool)));
+       connect(m, SIGNAL(statusChanged(QString)), 
+               this, 
+               SLOT(statusChanged(QString)));
+    }
+
+    void testOfonoNetworkOperator()
+    {
+       qDebug() << "name():" << m->name();
+       qDebug() << "status():" << m->status();
+       qDebug() << "mobileCountryCode():" << m->mcc();
+       qDebug() << "mobileNetworkCode():" << m->mnc();
+       qDebug() << "technologies():" << m->technologies();
+       qDebug() << "additionalInfo():" << m->additionalInfo();
+       m->requestRegister();
+
+       QTest::qWait(120000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoNetworkOperator *m;
+};
+
+QTEST_MAIN(TestOfonoNetworkOperator)
+#include "test_ofononetworkoperator.moc"
diff --git a/tests/test_ofononetworkoperator.pro b/tests/test_ofononetworkoperator.pro
new file mode 100644 (file)
index 0000000..ebb8f55
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofononetworkoperator.cpp
+
diff --git a/tests/test_ofononetworkregistration.cpp b/tests/test_ofononetworkregistration.cpp
new file mode 100644 (file)
index 0000000..bd85c81
--- /dev/null
@@ -0,0 +1,159 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofononetworkregistration.h>
+
+#include <QtDebug>
+
+
+class TestOfonoNetworkRegistration : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void modeChanged(QString mode)
+    {
+       qDebug() << "modeChanged" << mode;
+    }
+
+    void statusChanged(QString status)
+    {
+       qDebug() << "statusChanged" << status;
+    }
+
+    void locationAreaCodeChanged(uint locationAreaCode)
+    {
+       qDebug() << "locationAreaCodeChanged" << locationAreaCode;
+    }
+
+    void cellIdChanged(uint cellId)
+    {
+       qDebug() << "cellIdChanged" << cellId;
+    }
+
+    void mccChanged(QString mcc)
+    {
+       qDebug() << "mccChanged" << mcc;
+    }
+
+    void mncChanged(QString mnc)
+    {
+       qDebug() << "mncChanged" << mnc;
+    }
+
+    void technologyChanged(QString technology)
+    {
+       qDebug() << "technologyChanged" << technology;
+    }
+
+    void nameChanged(QString name)
+    {
+       qDebug() << "nameChanged" << name;
+    }
+
+    void strengthChanged(uint strength)
+    {
+       qDebug() << "strengthChanged" << strength;
+    }
+
+    void baseStationChanged(QString baseStation)
+    {
+       qDebug() << "baseStationChanged" << baseStation;
+    }
+
+    void registerComplete(bool success)
+    {
+       qDebug() << "registerComplete:" << success;
+    }
+
+    void deregisterComplete(bool success)
+    {
+       qDebug() << "deregisterComplete:" << success;
+    }
+
+    void getOperatorsComplete(bool success, QStringList oplist)
+    {
+       qDebug() << "getOperatorsComplete:" << success << oplist;
+    }
+
+    void scanComplete(bool success, QStringList oplist)
+    {
+       qDebug() << "scanComplete:" << success << oplist;
+    }
+
+    void initTestCase()
+    {
+       m = new OfonoNetworkRegistration(QString(), this);
+
+       connect(m, SIGNAL(registerComplete(bool)), this, 
+               SLOT(registerComplete(bool)));
+       connect(m, SIGNAL(deregisterComplete(bool)), this, 
+               SLOT(deregisterComplete(bool)));
+    connect(m, SIGNAL(getOperatorsComplete(bool, QStringList)), 
+            this, SLOT(getOperatorsComplete(bool, QStringList)));
+    connect(m, SIGNAL(scanComplete(bool, QStringList)), 
+            this, SLOT(scanComplete(bool, QStringList)));
+
+       connect(m, SIGNAL(modeChanged(QString)), 
+               this, SLOT(modeChanged(QString)));
+       connect(m, SIGNAL(statusChanged(QString)), 
+               this, SLOT(statusChanged(QString)));
+       connect(m, SIGNAL(locationAreaCodeChanged(uint)), 
+               this, SLOT(locationAreaCodeChanged(uint)));
+       connect(m, SIGNAL(cellIdChanged(uint)), 
+               this, SLOT(cellIdChanged(uint)));
+       connect(m, SIGNAL(mccChanged(QString)), 
+               this, SLOT(mccChanged(QString)));
+       connect(m, SIGNAL(mncChanged(QString)), 
+               this, SLOT(mncChanged(QString)));
+       connect(m, SIGNAL(technologyChanged(QString)), 
+               this, SLOT(technologyChanged(QString)));
+       connect(m, SIGNAL(nameChanged(QString)), 
+               this, SLOT(nameChanged(QString)));
+       connect(m, SIGNAL(strengthChanged(uint)), 
+               this, SLOT(strengthChanged(uint)));
+       connect(m, SIGNAL(baseStationChanged(QString)), 
+               this, SLOT(baseStationChanged(QString)));
+
+    }
+
+    void testOfonoNetworkRegistration()
+    {
+       qDebug() << "mode():" << m->mode();
+       qDebug() << "status():" << m->status();
+       qDebug() << "lac():" << m->locationAreaCode();
+       qDebug() << "cellid():" << m->cellId();
+       qDebug() << "mobileCountryCode():" << m->mcc();
+       qDebug() << "mobileNetworkCode():" << m->mnc();
+       qDebug() << "technology():" << m->technology();
+       qDebug() << "name():" << m->name();
+       qDebug() << "strength():" << m->strength();
+       qDebug() << "baseStation():" << m->baseStation();
+       
+       m->requestGetOperators();
+       QTest::qWait(5000);
+
+       m->requestScan();
+       QTest::qWait(10000);
+       
+       m->requestDeregister();
+       QTest::qWait(10000);
+       m->requestRegister();
+
+       QTest::qWait(120000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoNetworkRegistration *m;
+};
+
+QTEST_MAIN(TestOfonoNetworkRegistration)
+#include "test_ofononetworkregistration.moc"
diff --git a/tests/test_ofononetworkregistration.pro b/tests/test_ofononetworkregistration.pro
new file mode 100644 (file)
index 0000000..480c165
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofononetworkregistration.cpp
+
diff --git a/tests/test_ofonophonebook.cpp b/tests/test_ofonophonebook.cpp
new file mode 100644 (file)
index 0000000..1df0cc5
--- /dev/null
@@ -0,0 +1,51 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonophonebook.h>
+
+#include <QtDebug>
+
+class TestOfonoPhonebook : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void validityChanged(bool validity)
+    {
+    qDebug() << "ValidityChanged" << validity;
+    }
+
+    void importComplete(bool success, QString entries)
+    {
+    qDebug() << "importComplete" << success << entries;
+    }
+
+    void initTestCase()
+    {
+//     m = new OfonoPhonebook("/isimodem0", this);
+       m = new OfonoPhonebook(QString(), this);
+       connect(m, SIGNAL(validityChanged(bool)), this, SLOT(validityChanged(bool)));
+    connect(m, SIGNAL(importComplete(bool, QString)),
+           this, SLOT(importComplete(bool, QString)));
+    }
+
+    void testOfonoPhonebook()
+    {
+       qDebug() << "validity" << m->isValid();
+       m->requestImport();
+    QTest::qWait(120000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoPhonebook *m;
+};
+
+QTEST_MAIN(TestOfonoPhonebook)
+#include "test_ofonophonebook.moc"
diff --git a/tests/test_ofonophonebook.pro b/tests/test_ofonophonebook.pro
new file mode 100644 (file)
index 0000000..8100a58
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonophonebook.cpp
+
diff --git a/tests/test_ofonoradiosettings.cpp b/tests/test_ofonoradiosettings.cpp
new file mode 100644 (file)
index 0000000..19c76bb
--- /dev/null
@@ -0,0 +1,54 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonoradiosettings.h>
+
+#include <QtDebug>
+
+
+class TestOfonoRadioSettings : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void technologyPreferenceChanged(const QString pref)
+    {
+       qDebug() << "technologyPreferenceChanged" << pref;
+    }
+
+    void validityChanged(bool validity)
+    {
+       qDebug() << "ValidityChanged" << validity;
+    }
+
+    void initTestCase()
+    {
+       m = new OfonoRadioSettings(QString(), this);
+       connect(m, SIGNAL(validityChanged(bool)), this, 
+               SLOT(validityChanged(bool)));
+       connect(m, SIGNAL(technologyPreferenceChanged(QString)), 
+               this, 
+               SLOT(technologyPreferenceChanged(QString)));
+    }
+
+    void testOfonoRadioSettings()
+    {
+       qDebug() << "validity:" << m->isValid();
+       qDebug() << "technologyPreference():" << m->technologyPreference();
+       QTest::qWait(120000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoRadioSettings *m;
+};
+
+QTEST_MAIN(TestOfonoRadioSettings)
+#include "test_ofonoradiosettings.moc"
diff --git a/tests/test_ofonoradiosettings.pro b/tests/test_ofonoradiosettings.pro
new file mode 100644 (file)
index 0000000..e4e4e9f
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonoradiosettings.cpp
+
diff --git a/tests/test_ofonosimmanager.cpp b/tests/test_ofonosimmanager.cpp
new file mode 100644 (file)
index 0000000..9645bc6
--- /dev/null
@@ -0,0 +1,184 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonosimmanager.h>
+
+#include <QtDebug>
+
+
+class TestOfonoSimManager : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void validityChanged(bool validity)
+    {
+       qDebug() << "ValidityChanged" << validity;
+    }
+
+    void presenceChanged(bool ispresent)
+    {
+       qDebug() << "presenceChanged" << ispresent;
+    }
+    void subscriberIdentityChanged(QString imsi)
+    {
+       qDebug() << "subscriberIdentityChanged" << imsi;
+    }
+    void mobileCountryCodeChanged(QString mcc)
+    {
+       qDebug() << "mobileCountryCodeChanged" << mcc;
+    }
+    void mobileNetworkCodeChanged(QString mnc)
+    {
+       qDebug() << "mobileNetworkCodeChanged" << mnc;
+    }
+    void subscriberNumbersChanged(QStringList msisdns)
+    {
+       qDebug() << "subscriberNumbersChanged" << msisdns;
+    }
+    void serviceNumbersChanged(QMap<QString, QString> sdns)
+    {
+       qDebug() << "serviceNumbersChanged" << sdns;
+    }
+    void pinRequiredChanged(QString pintype)
+    {
+       qDebug() << "pinRequiredChanged" << pintype;
+    }
+    void lockedPinsChanged(QStringList pins)
+    {
+       qDebug() << "lockedPinsChanged" << pins;
+    }
+    void cardIdentifierChanged(QString iccid)
+    {
+       qDebug() << "cardIdentifierChanged" << iccid;
+    }
+    void preferredLanguagesChanged(QStringList languages)
+    {
+       qDebug() << "preferredLanguagesChanged" << languages;
+    }
+
+    void enterPinComplete(bool success)
+    {
+       qDebug() << "enterPinComplete:" << success;
+       if (!success)
+           qDebug() << "Error name/message" << m->errorName() << m->errorMessage();
+    }
+    void resetPinComplete(bool success)
+    {
+       qDebug() << "resetPinComplete:" << success;
+       if (!success)
+           qDebug() << "Error name/message" << m->errorName() << m->errorMessage();
+    }
+
+    void changePinComplete(bool success)
+    {
+       qDebug() << "changePinComplete:" << success;
+    }
+
+    void lockPinComplete(bool success)
+    {
+       qDebug() << "lockPinComplete:" << success;
+    }
+
+    void unlockPinComplete(bool success)
+    {
+       qDebug() << "unlockPinComplete:" << success;
+    }
+
+    void initTestCase()
+    {
+       m = new OfonoSimManager(QString(), this);
+       connect(m, SIGNAL(validityChanged(bool)), this, 
+               SLOT(validityChanged(bool)));
+       connect(m, SIGNAL(presenceChanged(bool)), 
+               this, 
+               SLOT(presenceChanged(bool)));
+       connect(m, SIGNAL(subscriberIdentityChanged(QString)), this, 
+               SLOT(subscriberIdentityChanged(QString)));
+       connect(m, SIGNAL(mobileCountryCodeChanged(QString)), this, 
+               SLOT(mobileCountryCodeChanged(QString)));
+       connect(m, SIGNAL(mobileNetworkCodeChanged(QString)), this, 
+               SLOT(mobileNetworkCodeChanged(QString)));
+       connect(m, SIGNAL(subscriberNumbersChanged(QStringList)), this, 
+               SLOT(subscriberNumbersChanged(QStringList)));
+       connect(m, SIGNAL(serviceNumbersChanged(QMap<QString, QString>)), this, 
+               SLOT(serviceNumbersChanged(QMap<QString, QString>)));
+       connect(m, SIGNAL(pinRequiredChanged(QString)), this, 
+               SLOT(pinRequiredChanged(QString)));
+       connect(m, SIGNAL(lockedPinsChanged(QStringList)), this, 
+               SLOT(lockedPinsChanged(QStringList)));
+       connect(m, SIGNAL(cardIdentifierChanged(QString)), this, 
+               SLOT(cardIdentifierChanged(QString)));
+       connect(m, SIGNAL(preferredLanguagesChanged(QStringList)), this, 
+               SLOT(preferredLanguagesChanged(QStringList)));
+    }
+
+    void testOfonoSimManager()
+    {
+       qDebug() << "validity:" << m->isValid();
+       qDebug() << "present():" << m->present();
+       qDebug() << "subscriberIdentity():" << m->subscriberIdentity();
+       qDebug() << "mobileCountryCode():" << m->mobileCountryCode();
+       qDebug() << "mobileNetworkCode():" << m->mobileNetworkCode();
+       qDebug() << "subscriberNumbers():" << m->subscriberNumbers();
+       qDebug() << "serviceNumbers():" << m->serviceNumbers();
+       qDebug() << "pinRequired():" << m->pinRequired();
+       qDebug() << "lockedPins():" << m->lockedPins();
+       qDebug() << "cardIdentifier():" << m->cardIdentifier();
+       qDebug() << "preferredLanguages():" << m->preferredLanguages();
+
+       /* If we are using phonesim */
+       if (m->subscriberIdentity() == "246813579") {
+           connect(m, SIGNAL(lockPinComplete(bool)), 
+                   this, SLOT(lockPinComplete(bool)));
+           connect(m, SIGNAL(unlockPinComplete(bool)), 
+                   this, SLOT(unlockPinComplete(bool)));
+           connect(m, SIGNAL(changePinComplete(bool)), 
+                   this, SLOT(changePinComplete(bool)));
+
+           if (m->pinRequired() == "pin") {
+               connect(m, SIGNAL(enterPinComplete(bool)), 
+                       this, SLOT(enterPinComplete(bool)));
+               m->requestEnterPin("pin", "2468");
+               QTest::qWait(1000);
+           } else if (m->pinRequired() == "puk") {
+               connect(m, SIGNAL(resetPinComplete(bool)), 
+                       this, SLOT(resetPinComplete(bool)));
+               m->requestResetPin("puk", "13243546", "2468");      
+           }
+
+           if (m->lockedPins().contains("pin")) {
+               m->requestUnlockPin("pin", "2468");
+               QTest::qWait(1000);
+               m->requestLockPin("pin", "2468");
+               QTest::qWait(1000);
+               m->requestChangePin("pin", "2468", "1234");
+               QTest::qWait(1000);
+               m->requestChangePin("pin", "1234", "2468");
+           } else {
+               m->requestLockPin("pin", "2468");
+               QTest::qWait(1000);
+               m->requestChangePin("pin", "2468", "1234");
+               QTest::qWait(1000);
+               m->requestChangePin("pin", "1234", "2468");
+               QTest::qWait(1000);
+               m->requestUnlockPin("pin", "2468");
+           }
+       }
+       QTest::qWait(120000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoSimManager *m;
+};
+
+QTEST_MAIN(TestOfonoSimManager)
+#include "test_ofonosimmanager.moc"
diff --git a/tests/test_ofonosimmanager.pro b/tests/test_ofonosimmanager.pro
new file mode 100644 (file)
index 0000000..6eb9128
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonosimmanager.cpp
+
diff --git a/tests/test_ofonosupplementaryservices.cpp b/tests/test_ofonosupplementaryservices.cpp
new file mode 100644 (file)
index 0000000..040f018
--- /dev/null
@@ -0,0 +1,69 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonosupplementaryservices.h>
+
+#include <QtDebug>
+
+
+class TestOfonoSupplementaryServices : public QObject
+{
+    Q_OBJECT
+
+public slots:
+
+    void stateChanged(QString state)
+    {
+       qDebug() << "stateChanged" << state;
+    }
+    
+    void initiateFailed()
+    {
+    qDebug() << "initiateFailed" << m->errorName() << m->errorMessage();
+    }
+    
+    void barringComplete(QString ssOp, QString cbService, QVariantMap cbMap)
+    {
+    qDebug() << "barringComplete" << ssOp << cbService << cbMap;
+    }
+
+    void forwardingComplete(QString ssOp, QString cfService, QVariantMap cfMap)
+    {
+    qDebug() << "forwardingComplete" << ssOp << cfService << cfMap;
+    }
+
+private slots:
+    void initTestCase()
+    {
+       m = new OfonoSupplementaryServices(QString(), this);
+       connect(m, SIGNAL(stateChanged(QString)), 
+               this, SLOT(stateChanged(QString)));
+       connect(m, SIGNAL(initiateFailed()), 
+               this, SLOT(initiateFailed()));
+       connect(m, SIGNAL(barringComplete(QString, QString, QVariantMap)), 
+               this, SLOT(barringComplete(QString, QString, QVariantMap)));
+       connect(m, SIGNAL(forwardingComplete(QString, QString, QVariantMap)), 
+               this, SLOT(forwardingComplete(QString, QString, QVariantMap)));
+    }
+
+    void testOfonoNetworkOperator()
+    {
+       qDebug() << "state():" << m->state();
+       m->requestInitiate("*#002**11#");
+
+       QTest::qWait(120000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoSupplementaryServices *m;
+};
+
+QTEST_MAIN(TestOfonoSupplementaryServices)
+#include "test_ofonosupplementaryservices.moc"
diff --git a/tests/test_ofonosupplementaryservices.pro b/tests/test_ofonosupplementaryservices.pro
new file mode 100644 (file)
index 0000000..d3d743b
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonosupplementaryservices.cpp
+
diff --git a/tests/test_ofonovoicecallmanager.cpp b/tests/test_ofonovoicecallmanager.cpp
new file mode 100644 (file)
index 0000000..e6b11a3
--- /dev/null
@@ -0,0 +1,46 @@
+#include <QtTest/QtTest>
+#include <QtCore/QObject>
+
+#include <ofonovoicecallmanager.h>
+
+#include <QtDebug>
+
+
+class TestOfonoVoiceCallManager : public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    void validityChanged(bool validity)
+    {
+       qDebug() << "ValidityChanged" << validity;
+    }
+
+    void initTestCase()
+    {
+       m = new OfonoVoiceCallManager(QString(), this);
+       connect(m, SIGNAL(validityChanged(bool)), this, 
+               SLOT(validityChanged(bool)));
+    }
+
+    void testOfonoVoiceCallManager()
+    {
+       qDebug() << "validity:" << m->isValid();
+       qDebug() << "emergencyNumbers():" << m->emergencyNumbers();
+       QTest::qWait(1000);
+    }
+
+
+    void cleanupTestCase()
+    {
+
+    }
+
+
+private:
+    OfonoVoiceCallManager *m;
+};
+
+QTEST_MAIN(TestOfonoVoiceCallManager)
+#include "test_ofonovoicecallmanager.moc"
diff --git a/tests/test_ofonovoicecallmanager.pro b/tests/test_ofonovoicecallmanager.pro
new file mode 100644 (file)
index 0000000..f98d05f
--- /dev/null
@@ -0,0 +1,3 @@
+include(testcase.pro)                     
+SOURCES += test_ofonovoicecallmanager.cpp
+
diff --git a/tests/testcase.pro b/tests/testcase.pro
new file mode 100644 (file)
index 0000000..6c56ebb
--- /dev/null
@@ -0,0 +1,7 @@
+CONFIG += testcase
+QT = core testlib dbus
+INCLUDEPATH += ../lib ../
+LIBS += -L ../lib -lofono-qt
+
+target.path = $$[QT_INSTALL_PREFIX]/lib/tests/libofono-qt
+INSTALLS += target
diff --git a/tests/tests.pro b/tests/tests.pro
new file mode 100644 (file)
index 0000000..2652e06
--- /dev/null
@@ -0,0 +1,17 @@
+TEMPLATE = subdirs
+SUBDIRS += test_ofonointerface.pro
+SUBDIRS += test_ofonomodemmanager.pro
+SUBDIRS += test_ofonomodem.pro
+SUBDIRS += test_ofonophonebook.pro
+SUBDIRS += test_ofonomessagewaiting.pro
+SUBDIRS += test_ofonomessagemanager.pro
+SUBDIRS += test_ofonoradiosettings.pro
+SUBDIRS += test_ofonosimmanager.pro
+SUBDIRS += test_ofonocallbarring.pro
+SUBDIRS += test_ofonocallforwarding.pro
+SUBDIRS += test_ofonocallmeter.pro
+SUBDIRS += test_ofonocallsettings.pro
+SUBDIRS += test_ofononetworkoperator.pro
+SUBDIRS += test_ofononetworkregistration.pro
+SUBDIRS += test_ofonosupplementaryservices.pro
+SUBDIRS += test_ofonovoicecallmanager.pro
diff --git a/version.pri b/version.pri
new file mode 100644 (file)
index 0000000..f69ac30
--- /dev/null
@@ -0,0 +1 @@
+VERSION = 1.0.0